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


Python PathGeom.xy方法代码示例

本文整理汇总了Python中PathScripts.PathGeom.PathGeom.xy方法的典型用法代码示例。如果您正苦于以下问题:Python PathGeom.xy方法的具体用法?Python PathGeom.xy怎么用?Python PathGeom.xy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PathScripts.PathGeom.PathGeom的用法示例。


在下文中一共展示了PathGeom.xy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: isValidTagStartIntersection

# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import xy [as 别名]
 def isValidTagStartIntersection(self, edge, i):
     if PathGeom.pointsCoincide(i, edge.valueAt(edge.LastParameter)):
         return False
     p1 = edge.valueAt(edge.FirstParameter)
     p2 = edge.valueAt(edge.LastParameter)
     if PathGeom.pointsCoincide(PathGeom.xy(p1), PathGeom.xy(p2)):
         # if this vertical goes up, it can't be the start of a tag intersection
         if p1.z < p2.z:
             return False
     return True
开发者ID:lanigb,项目名称:FreeCAD,代码行数:12,代码来源:PathDressupHoldingTags.py

示例2: isStrut

# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import xy [as 别名]
 def isStrut(self, edge):
     p1 = PathGeom.xy(edge.valueAt(edge.FirstParameter))
     p2 = PathGeom.xy(edge.valueAt(edge.LastParameter))
     return PathGeom.pointsCoincide(p1, p2)
开发者ID:lanigb,项目名称:FreeCAD,代码行数:6,代码来源:PathDressupHoldingTags.py

示例3: createRampMethod2

# 需要导入模块: from PathScripts.PathGeom import PathGeom [as 别名]
# 或者: from PathScripts.PathGeom.PathGeom import xy [as 别名]
    def createRampMethod2(self, rampedges, p0, projectionlen, rampangle):
        """
        This method generates ramp with following pattern:
        1. Start from the original startpoint of the plunge
        2. Calculate the distance on the path which is needed to implement the ramp
           and travel that distance while maintaining start depth
        3. Start ramping while travelling the original path backwards until reaching the
           original plunge end point
        4. Continue with the original path
        """
        outedges = []
        rampremaining = projectionlen
        curPoint = p0  # start from the upper point of plunge
        if PathGeom.pointsCoincide(PathGeom.xy(p0), PathGeom.xy(rampedges[-1].valueAt(rampedges[-1].LastParameter))):
            PathLog.debug("The ramp forms a closed wire, needless to move on original Z height")
        else:
            for i, redge in enumerate(rampedges):
                if redge.Length >= rampremaining:
                    # this edge needs to be split
                    p1 = self.getSplitPoint(redge, rampremaining)
                    splitEdge = PathGeom.splitEdgeAt(redge, p1)
                    PathLog.debug("Got split edges with lengths: {}, {}".format(splitEdge[0].Length, splitEdge[1].Length))
                    # ramp starts at the last point of first edge
                    p1 = splitEdge[0].valueAt(splitEdge[0].LastParameter)
                    p1.z = p0.z
                    outedges.append(self.createRampEdge(splitEdge[0], curPoint, p1))
                    # now we have reached the beginning of the ramp.
                    # start that by going to the beginning of this splitEdge
                    deltaZ = splitEdge[0].Length / math.tan(math.radians(rampangle))
                    newPoint = FreeCAD.Base.Vector(splitEdge[0].valueAt(splitEdge[0].FirstParameter).x, splitEdge[0].valueAt(splitEdge[0].FirstParameter).y, p1.z - deltaZ)
                    outedges.append(self.createRampEdge(splitEdge[0], p1, newPoint))
                    curPoint = newPoint
                elif i == len(rampedges) - 1:
                    # last ramp element but still did not reach the full length?
                    # Probably a rounding issue on floats.
                    # Lets start the ramp anyway
                    p1 = redge.valueAt(redge.LastParameter)
                    p1.z = p0.z
                    outedges.append(self.createRampEdge(redge, curPoint, p1))
                    # and go back that edge
                    deltaZ = redge.Length / math.tan(math.radians(rampangle))
                    newPoint = FreeCAD.Base.Vector(redge.valueAt(redge.FirstParameter).x, redge.valueAt(redge.FirstParameter).y, p1.z - deltaZ)
                    outedges.append(self.createRampEdge(redge, p1, newPoint))
                    curPoint = newPoint

                else:
                    # we are travelling on start depth
                    newPoint = FreeCAD.Base.Vector(redge.valueAt(redge.LastParameter).x, redge.valueAt(redge.LastParameter).y, p0.z)
                    outedges.append(self.createRampEdge(redge, curPoint, newPoint))
                    curPoint = newPoint
                    rampremaining = rampremaining - redge.Length

            # the last edge got handled previously
            rampedges.pop()
        # ramp backwards to the plunge position
        for i, redge in enumerate(reversed(rampedges)):
            deltaZ = redge.Length / math.tan(math.radians(rampangle))
            newPoint = FreeCAD.Base.Vector(redge.valueAt(redge.FirstParameter).x, redge.valueAt(redge.FirstParameter).y, curPoint.z - deltaZ)
            if i == len(rampedges) - 1:
                # make sure that the last point of the ramps ends to the original position
                newPoint = redge.valueAt(redge.FirstParameter)
            outedges.append(self.createRampEdge(redge, curPoint, newPoint))
            curPoint = newPoint

        return outedges
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:67,代码来源:PathDressupRampEntry.py


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