当前位置: 首页>>代码示例>>Python>>正文


Python PathGeom.wireForPath方法代码示例

本文整理汇总了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)
开发者ID:lanigb,项目名称:FreeCAD,代码行数:9,代码来源:PathDressupHoldingTags.py

示例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)
开发者ID:lanigb,项目名称:FreeCAD,代码行数:29,代码来源:PathDressupRampEntry.py

示例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)
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:14,代码来源:PathDressupLeadInOut.py

示例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)
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:22,代码来源:PathDressupRampEntry.py

示例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))
开发者ID:,项目名称:,代码行数:24,代码来源:

示例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()
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:73,代码来源:PathDressupTag.py


注:本文中的PathScripts.PathGeom.PathGeom.wireForPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。