本文整理汇总了Python中PathScripts.PathGeom.PathGeom.commandEndPoint方法的典型用法代码示例。如果您正苦于以下问题:Python PathGeom.commandEndPoint方法的具体用法?Python PathGeom.commandEndPoint怎么用?Python PathGeom.commandEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathScripts.PathGeom.PathGeom
的用法示例。
在下文中一共展示了PathGeom.commandEndPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import commandEndPoint [as 别名]
def execute(self, obj):
PathLog.track()
if not obj.Base:
PathLog.error(translate('Path_DressupTag', 'No Base object found.'))
return
if not obj.Base.isDerivedFrom('Path::Feature'):
PathLog.error(translate('Path_DressupTag', 'Base is not a Path::Feature object.'))
return
if not obj.Base.Path:
PathLog.error(translate('Path_DressupTag', 'Base doesn\'t have a Path to dress-up.'))
return
if not obj.Base.Path.Commands:
PathLog.error(translate('Path_DressupTag', 'Base Path is empty.'))
return
self.obj = obj
minZ = +sys.maxint
minX = minZ
minY = minZ
maxZ = -sys.maxint
maxX = maxZ
maxY = maxZ
# the assumption is that all helixes are in the xy-plane - in other words there is no
# intermittent point of a command that has a lower/higher Z-position than the start and
# and end positions of a command.
lastPt = FreeCAD.Vector(0, 0, 0)
for cmd in obj.Base.Path.Commands:
pt = PathGeom.commandEndPoint(cmd, lastPt)
if lastPt.x != pt.x:
maxX = max(pt.x, maxX)
minX = min(pt.x, minX)
if lastPt.y != pt.y:
maxY = max(pt.y, maxY)
minY = min(pt.y, minY)
if lastPt.z != pt.z:
maxZ = max(pt.z, maxZ)
minZ = min(pt.z, minZ)
lastPt = pt
PathLog.debug("bb = (%.2f, %.2f, %.2f) ... (%.2f, %.2f, %.2f)" % (minX, minY, minZ, maxX, maxY, maxZ))
self.ptMin = FreeCAD.Vector(minX, minY, minZ)
self.ptMax = FreeCAD.Vector(maxX, maxY, maxZ)
self.masterSolid = TagSolid(self, minZ, self.toolRadius())
self.solids = [self.masterSolid.cloneAt(pos) for pos in self.obj.Positions]
self.tagSolid = Part.Compound(self.solids)
self.wire, rapid = PathGeom.wireForPath(obj.Base.Path)
self.edges = self.wire.Edges
maxTagZ = minZ + obj.Height.Value
# lastX = 0
# lastY = 0
lastZ = 0
commands = []
for cmd in obj.Base.Path.Commands:
if cmd in PathGeom.CmdMove:
if lastZ <= maxTagZ or cmd.Parameters.get('Z', lastZ) <= maxTagZ:
pass
else:
commands.append(cmd)
else:
commands.append(cmd)
obj.Path = obj.Base.Path
PathLog.track()