本文整理汇总了Python中PathScripts.PathGeom.PathGeom.getAngle方法的典型用法代码示例。如果您正苦于以下问题:Python PathGeom.getAngle方法的具体用法?Python PathGeom.getAngle怎么用?Python PathGeom.getAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathScripts.PathGeom.PathGeom
的用法示例。
在下文中一共展示了PathGeom.getAngle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cloneAt
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import getAngle [as 别名]
def cloneAt(self, pos):
clone = self.solid.copy()
pos.z = 0
angle = -PathGeom.getAngle(pos - self.baseCenter) * 180 / math.pi
clone.rotate(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(0, 0, 1), angle)
pos.z = self.z - self.actualHeight * 0.01
clone.translate(pos)
return clone
示例2: test00
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import getAngle [as 别名]
def test00(self):
"""Verify getAngle functionality."""
self.assertRoughly(PathGeom.getAngle(Vector(1, 0, 0)), 0)
self.assertRoughly(PathGeom.getAngle(Vector(1, 1, 0)), math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(0, 1, 0)), math.pi/2)
self.assertRoughly(PathGeom.getAngle(Vector(-1, 1, 0)), 3*math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(-1, 0, 0)), math.pi)
self.assertRoughly(PathGeom.getAngle(Vector(-1, -1, 0)), -3*math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(0, -1, 0)), -math.pi/2)
self.assertRoughly(PathGeom.getAngle(Vector(1, -1, 0)), -math.pi/4)
示例3: createSolidsAt
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import getAngle [as 别名]
def createSolidsAt(self, z, R):
self.z = z
self.toolRadius = R
r1 = self.fullWidth() / 2
self.r1 = r1
self.r2 = r1
height = self.height * 1.01
radius = 0
if self.angle == 90 and height > 0:
# cylinder
self.isSquare = True
self.solid = Part.makeCylinder(r1, height)
radius = min(min(self.radius, r1), self.height)
PathLog.debug("Part.makeCone(%f, %f)" % (r1, height))
elif self.angle > 0.0 and height > 0.0:
# cone
rad = math.radians(self.angle)
tangens = math.tan(rad)
dr = height / tangens
if dr < r1:
# with top
r2 = r1 - dr
s = height / math.sin(rad)
radius = min(r2, s) * math.tan((math.pi - rad)/2) * 0.95
else:
# triangular
r2 = 0
height = r1 * tangens * 1.01
self.actualHeight = height
self.r2 = r2
PathLog.debug("Part.makeCone(%f, %f, %f)" % (r1, r2, height))
self.solid = Part.makeCone(r1, r2, height)
else:
# degenerated case - no tag
PathLog.debug("Part.makeSphere(%f / 10000)" % (r1))
self.solid = Part.makeSphere(r1 / 10000)
if not R == 0: # testing is easier if the solid is not rotated
angle = -PathGeom.getAngle(self.originAt(0)) * 180 / math.pi
PathLog.debug("solid.rotate(%f)" % angle)
self.solid.rotate(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(0, 0, 1), angle)
orig = self.originAt(z - 0.01 * self.actualHeight)
PathLog.debug("solid.translate(%s)" % orig)
self.solid.translate(orig)
radius = min(self.radius, radius)
self.realRadius = radius
if radius != 0:
PathLog.debug("makeFillet(%.4f)" % radius)
self.solid = self.solid.makeFillet(radius, [self.solid.Edges[0]])