Test additional Loc ctor
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
import math
|
import math
|
||||||
import unittest
|
import unittest
|
||||||
from tests import BaseTest
|
from tests import BaseTest
|
||||||
from OCP.gp import gp_Vec, gp_Pnt, gp_Ax2, gp_Circ, gp_Elips, gp, gp_XYZ
|
from OCP.gp import gp_Vec, gp_Pnt, gp_Ax2, gp_Circ, gp_Elips, gp, gp_XYZ, gp_Trsf
|
||||||
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
|
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
|
||||||
|
|
||||||
from cadquery import *
|
from cadquery import *
|
||||||
@ -395,7 +395,7 @@ class TestCadObjects(BaseTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def testLocation(self):
|
def testLocation(self):
|
||||||
|
|
||||||
# Vector
|
# Vector
|
||||||
loc1 = Location(Vector(0, 0, 1))
|
loc1 = Location(Vector(0, 0, 1))
|
||||||
|
|
||||||
@ -408,6 +408,13 @@ class TestCadObjects(BaseTest):
|
|||||||
angle = loc2.wrapped.Transformation().GetRotation().GetRotationAngle() * RAD2DEG
|
angle = loc2.wrapped.Transformation().GetRotation().GetRotationAngle() * RAD2DEG
|
||||||
self.assertAlmostEqual(45, angle)
|
self.assertAlmostEqual(45, angle)
|
||||||
|
|
||||||
|
# gp_Trsf
|
||||||
|
T = gp_Trsf()
|
||||||
|
T.SetTranslation(gp_Vec(0,0,1))
|
||||||
|
loc3 = Location(T)
|
||||||
|
|
||||||
|
assert( loc1.wrapped.Transformation().TranslationPart().Z() == loc3.wrapped.Transformation().TranslationPart().Z())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user