本文整理汇总了Python中PathScripts.PathGeom.PathGeom.wireForPath方法的典型用法代码示例。如果您正苦于以下问题:Python PathGeom.wireForPath方法的具体用法?Python PathGeom.wireForPath怎么用?Python PathGeom.wireForPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathScripts.PathGeom.PathGeom
的用法示例。
在下文中一共展示了PathGeom.wireForPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [as 别名]
def __init__(self, obj):
PathLog.track(obj.Base.Name)
self.obj = obj
self.wire, rapid = PathGeom.wireForPath(obj.Base.Path)
self.rapid = _RapidEdges(rapid)
self.edges = self.wire.Edges
self.baseWire = self.findBottomWire(self.edges)
示例2: execute
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [as 别名]
def execute(self, obj):
if not obj.Base:
return
if not obj.Base.isDerivedFrom("Path::Feature"):
return
if not obj.Base.Path:
return
if obj.Angle >= 90:
obj.Angle = 89.9
elif obj.Angle <= 0:
obj.Angle = 0.1
if hasattr(obj, 'UseStartDepth'):
self.ignoreAboveEnabled = obj.UseStartDepth
self.ignoreAbove = obj.DressupStartDepth
else:
self.ignoreAboveEnabled = False
self.ignoreAbove = 0
self.angle = obj.Angle
self.method = obj.Method
self.wire, self.rapids = PathGeom.wireForPath(obj.Base.Path)
if self.method in ['RampMethod1', 'RampMethod2', 'RampMethod3']:
self.outedges = self.generateRamps()
else:
self.outedges = self.generateHelix()
obj.Path = self.createCommands(obj, self.outedges)
示例3: execute
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [as 别名]
def execute(self, obj):
if not obj.Base:
return
if not obj.Base.isDerivedFrom("Path::Feature"):
return
if not obj.Base.Path:
return
if obj.Length < 0:
PathLog.error(translate("Length/Radius positiv not Null\n"))
obj.Length = 0.1
self.wire, self.rapids = PathGeom.wireForPath(obj.Base.Path)
obj.Path = self.generateLeadInOutCurve(obj)
示例4: execute
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [as 别名]
def execute(self, obj):
if not obj.Base:
return
if not obj.Base.isDerivedFrom("Path::Feature"):
return
if not obj.Base.Path:
return
if obj.Angle >= 90:
obj.Angle = 89.9
elif obj.Angle <= 0:
obj.Angle = 0.1
self.angle = obj.Angle
self.method = obj.Method
self.wire, self.rapids = PathGeom.wireForPath(obj.Base.Path)
if self.method == 'RampMethod1' or self.method == 'RampMethod2' or self.method == 'RampMethod3':
self.outedges = self.generateRamps()
else:
self.outedges = self.generateHelix()
obj.Path = self.createCommands(obj, self.outedges)
示例5: test50
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [as 别名]
def test50(self):
"""Verify proper wire(s) aggregation from a Path."""
commands = []
commands.append(Path.Command('G1', {'X': 1}))
commands.append(Path.Command('G1', {'Y': 1}))
commands.append(Path.Command('G0', {'X': 0}))
commands.append(Path.Command('G1', {'Y': 0}))
wire = PathGeom.wireForPath(Path.Path(commands))
self.assertEqual(len(wire.Edges), 4)
self.assertLine(wire.Edges[0], Vector(0,0,0), Vector(1,0,0))
self.assertLine(wire.Edges[1], Vector(1,0,0), Vector(1,1,0))
self.assertLine(wire.Edges[2], Vector(1,1,0), Vector(0,1,0))
self.assertLine(wire.Edges[3], Vector(0,1,0), Vector(0,0,0))
wires = PathGeom.wiresForPath(Path.Path(commands))
self.assertEqual(len(wires), 2)
self.assertEqual(len(wires[0].Edges), 2)
self.assertLine(wires[0].Edges[0], Vector(0,0,0), Vector(1,0,0))
self.assertLine(wires[0].Edges[1], Vector(1,0,0), Vector(1,1,0))
self.assertEqual(len(wires[1].Edges), 1)
self.assertLine(wires[1].Edges[0], Vector(0,1,0), Vector(0,0,0))
示例6: execute
# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import wireForPath [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()