def execute(self, fp): e1 = _utils.getShape(fp, "Edge1", "Edge") e2 = _utils.getShape(fp, "Edge2", "Edge") if e1 and e2: bc = nurbs_tools.blendCurve(e1, e2) bc.param1 = e1.FirstParameter + fp.Parameter1 * (e1.LastParameter - e1.FirstParameter) bc.param2 = e2.FirstParameter + fp.Parameter2 * (e2.LastParameter - e2.FirstParameter) bc.cont1 = self.getContinuity(fp.Continuity1) bc.cont2 = self.getContinuity(fp.Continuity2) bc.scale1 = fp.Scale1 bc.scale2 = fp.Scale2 bc.maxDegree = fp.DegreeMax bc.compute() if bc.Curve is None: fp.CurvePts = [] fp.Shape = Part.Shape() else: fp.CurvePts = bc.Curve.getPoles() if fp.Output == "Wire": fp.Shape = bc.getWire() elif fp.Output == "Joined": fp.Shape = bc.getJoinedCurve().toShape() else: fp.Shape = bc.Curve.toShape()
def unsetEdit(self, vobj, mode=0): e1 = _utils.getShape(self.Object, "Edge1", "Edge") e2 = _utils.getShape(self.Object, "Edge2", "Edge") if isinstance(self.ip, pointEditor): v = Part.Vertex(self.m1.point) proj = v.distToShape(self.m1.snap_shape)[1][0][1] pa1 = e1.Curve.parameter(proj) self.Object.Parameter1 = (pa1 - self.m1.snap_shape.FirstParameter ) / (self.m1.snap_shape.LastParameter - self.m1.snap_shape.FirstParameter) self.Object.Scale1 = self.t1.parameter self.Object.Continuity1 = self.c1.text[0] v = Part.Vertex(self.m2.point) proj = v.distToShape(self.m2.snap_shape)[1][0][1] pa2 = e2.Curve.parameter(proj) self.Object.Parameter2 = (pa2 - self.m2.snap_shape.FirstParameter ) / (self.m2.snap_shape.LastParameter - self.m2.snap_shape.FirstParameter) self.Object.Scale2 = self.t2.parameter self.Object.Continuity2 = self.c2.text[0] vobj.Selectable = self.select_state vobj.PointSize = self.ps self.ip.quit() self.ip = None self.active = False #vobj.Visibility = True return True
def execute(self, obj): v1 = _utils.getShape(obj, "Vertex1", "Vertex") v2 = _utils.getShape(obj, "Vertex2", "Vertex") if v1 and v2: l = Part.LineSegment(v1.Point, v2.Point) obj.Shape = l.toShape() else: FreeCAD.Console.PrintError("%s broken !\n" % obj.Label)
def execute(self, obj): v1 = _utils.getShape(obj, "Vertex1", "Vertex") v2 = _utils.getShape(obj, "Vertex2", "Vertex") if v1 and v2: l = Part.LineSegment(v1.Point, v2.Point) obj.Shape = l.toShape() else: FreeCAD.Console.PrintError("%s broken !\n"%obj.Label)
def onChanged(self, obj, prop): if prop == "Parameter": e = _utils.getShape(obj, "Edge", "Edge") f = _utils.getShape(obj, "Face", "Face") p = e.FirstParameter + (e.LastParameter - e.FirstParameter) * obj.Parameter loc = e.valueAt(p) u, v = f.Surface.parameter(loc) norm = f.normalAt(u, v) #print("{0!s} - {1!s}".format(p, loc)) x = norm.cross(e.tangentAt(p)) rot = FreeCAD.Rotation(x, norm, e.tangentAt(p)) obj.Placement.Base = loc obj.Placement.Rotation = rot
def onChanged(self, fp, prop): e = _utils.getShape(fp, "Edge", "Edge") if not e: return if prop == "Edge": debug("Split : Edge changed") if prop == "Method": debug("Split : Method changed") if fp.Method == "Percent": fp.Value = self.ParamToPercent(e, fp.Param) elif fp.Method == "Distance": fp.Value = self.ParamToDistance(e, fp.Param) else: fp.Value = fp.Param if prop == "Value": if fp.Method == "Percent": if fp.Value < 0: fp.Value = 0 elif fp.Value > 100: fp.Value = 100 fp.Param = self.PercentToParam(e, fp.Value) elif fp.Method == "Distance": if fp.Value < -e.Length: fp.Value = -e.Length elif fp.Value > e.Length: fp.Value = e.Length fp.Param = self.DistanceToParam(e, fp.Value) else: # fp.Method == "Parameter" if fp.Value < e.FirstParameter: fp.Value = e.FirstParameter elif fp.Value > e.LastParameter: fp.Value = e.LastParameter fp.Param = fp.Value self.execute(fp)
def execute(self, obj): edge = _utils.getShape(obj, "Edge", "Edge") curve = curveExtend.getTrimmedCurve(edge) cont_start = 1 if hasattr(obj, "TypeStart"): if obj.TypeStart == "G2 curve": cont_start = 2 cont_end = 1 if hasattr(obj, "TypeEnd"): if obj.TypeEnd == "G2 curve": cont_end = 2 ext = [] if obj.LengthStart > 0: ext.append( curveExtend.extendCurve(curve, 0, obj.LengthStart, cont_start)) if obj.LengthEnd > 0: ext.append( curveExtend.extendCurve(curve, 1, obj.LengthEnd, cont_end)) if not ext == []: if hasattr(obj, "Output"): if obj.Output == "SingleEdge": for c in ext: curve.join(c.toBSpline()) obj.Shape = curve.toShape() else: ext.append(curve) edges = [] for c in ext: edges.append(Part.Edge(c)) w = Part.Wire(Part.__sortEdges__(edges)) w.fixWire() obj.Shape = w
def execute(self, obj): edge = _utils.getShape(obj, "Edge", "Edge") curve = curveExtend.getTrimmedCurve(edge) cont_start = 1 if hasattr(obj, "TypeStart"): if obj.TypeStart == "G2 curve": cont_start = 2 cont_end = 1 if hasattr(obj, "TypeEnd"): if obj.TypeEnd == "G2 curve": cont_end = 2 ext = [] if obj.LengthStart > 0: ext.append(curveExtend.extendCurve( curve, 0, obj.LengthStart, cont_start)) if obj.LengthEnd > 0: ext.append(curveExtend.extendCurve( curve, 1, obj.LengthEnd, cont_end)) if not ext == []: if hasattr(obj, "Output"): if obj.Output == "SingleEdge": for c in ext: curve.join(c.toBSpline()) obj.Shape = curve.toShape() else: ext.append(curve) edges = [] for c in ext: edges.append(Part.Edge(c)) w = Part.Wire(Part.__sortEdges__(edges)) w.fixWire() obj.Shape = w
def execute(self, obj): f = _utils.getShape(obj, "Source", "Face") bs = f.toNurbs().Faces[0].Surface surfs = list() u0, u1, v0, v1 = bs.bounds() cutKnotsU = [u0, u1] cutKnotsV = [v0, v1] if obj.Option == "Auto": if obj.Direction in ["U", "Both"]: knots = bs.getUKnots() mults = bs.getUMultiplicities() cutKnotsU = self.get_intervals(knots, mults) if obj.Direction in ["V", "Both"]: knots = bs.getVKnots() mults = bs.getVMultiplicities() cutKnotsV = self.get_intervals(knots, mults) elif obj.Option == "Custom": for k in obj.KnotsU: if (k > u0) and (k < u1): cutKnotsU.append(k) for k in obj.KnotsV: if (k > v0) and (k < v1): cutKnotsV.append(k) cutKnotsU = list(set(cutKnotsU)) cutKnotsV = list(set(cutKnotsV)) cutKnotsU.sort() cutKnotsV.sort() for i in range(len(cutKnotsU) - 1): for j in range(len(cutKnotsV) - 1): s = bs.copy() s.segment(cutKnotsU[i], cutKnotsU[i + 1], cutKnotsV[j], cutKnotsV[j + 1]) surfs.append(s) obj.Shape = Part.Shell([s.toShape() for s in surfs])
def setEdit(self, vobj, mode=0): if mode == 0: if vobj.Selectable: self.select_state = True vobj.Selectable = False self.ps = vobj.PointSize vobj.PointSize = 0.0 pts = list() sl = self.Object.Source e = _utils.getShape(self.Object, "Source", "Edge") params = [] if hasattr(self.Object, "Values"): params = self.Object.Proxy.parse_values(e, self.Object.Values) if params == []: return False pts = list() print("Creating markers") for p in params: print("{} -> {}".format(p, e.valueAt(p))) m = MarkerOnEdge([e.valueAt(p)], e) #m = manipulators.EdgeSnapAndTangent(e.valueAt(p), e) pts.append(m) print(pts) self.ip = pointEditor(pts, self.Object) #self.ip.curve = e.Curve #vobj.Visibility = False self.active = True print("Edit setup OK") return True return False
def getPoints(self, obj): if obj.Source: return [v.Point for v in obj.Source.Shape.Vertexes] elif obj.PointList: vl = _utils.getShape(obj, "PointList", "Vertex") return [v.Point for v in vl] else: return []
def compute(self, fp): e1 = _utils.getShape(fp, "Edge1", "Edge") e2 = _utils.getShape(fp, "Edge2", "Edge") if e1 and e2: bc = nurbs_tools.blendCurve(e1, e2) bc.param1 = e1.FirstParameter + fp.Parameter1 * (e1.LastParameter - e1.FirstParameter) bc.param2 = e2.FirstParameter + fp.Parameter2 * (e2.LastParameter - e2.FirstParameter) bc.cont1 = self.getContinuity(fp.Continuity1) bc.cont2 = self.getContinuity(fp.Continuity2) bc.scale1 = fp.Scale1 bc.scale2 = fp.Scale2 bc.maxDegree = fp.DegreeMax bc.compute() return bc return None
def execute(self, obj): faces = _utils.getShape(obj, "Faces", "Face") shell = Part.Shell(faces) solid = Part.Solid(shell) if solid.isValid(): obj.Shape = solid elif shell.isValid(): obj.Shape = shell else: obj.Shape = Part.Compound(faces)
def execute(self, obj): sh = None if len(obj.IndivFaces) > 0: faces = _utils.getShape(obj, "IndivFaces", "Face") sh = Part.Compound(faces) elif hasattr(obj.Source,"Shape"): sh = obj.Source.Shape try: obj.Shape = sh.reflectLines(obj.ViewDir, obj.ViewPos, obj.UpDir) except AttributeError: pass
def execute(self, obj): edge = _utils.getShape(obj, 'InputEdge', 'Edge') # self.getEdge(obj) face = _utils.getShape(obj, 'Face', 'Face') # self.getFace(obj) cos = curveOnSurface.curveOnSurface(edge, face) if obj.Reverse: cos.reverse() if obj.Closed: cos.closed = True cos.reverseTangent = obj.ReverseTangent cos.reverseNormal = obj.ReverseNormal cos.reverseBinormal = obj.ReverseBinormal if obj.Output == "Normal face": obj.Shape = cos.normalFace(obj.Samples, float(obj.FaceWidth), obj.Tolerance, obj.Symmetric) elif obj.Output == "Binormal face": obj.Shape = cos.binormalFace(obj.Samples, float(obj.FaceWidth), obj.Tolerance, obj.Symmetric) else: obj.Shape = cos.getEdge() #obj.Placement.Base = face.Placement.Base return(cos)
def onChanged(self, fp, prop): e = None if hasattr(fp, "Source"): e = _utils.getShape(fp, "Source", "Edge") if not e: return if prop == "Source": debug("Split : Source changed") self.execute(fp) if prop == "Values": debug("Split : Values changed") self.execute(fp)
def update_shape(self): e1 = _utils.getShape(self.Object, "Edge1", "Edge") e2 = _utils.getShape(self.Object, "Edge2", "Edge") if e1 and e2: bc = nurbs_tools.blendCurve(e1, e2) v = Part.Vertex(self.m1.point) proj = v.distToShape(self.m1.snap_shape)[1][0][1] bc.param1 = e1.Curve.parameter(proj) #bc.param1 = (pa1 - self.m1.snap_shape.FirstParameter) / (self.m1.snap_shape.LastParameter - self.m1.snap_shape.FirstParameter) bc.scale1 = self.t1.parameter bc.cont1 = self.Object.Proxy.getContinuity(self.c1.text[0]) v = Part.Vertex(self.m2.point) proj = v.distToShape(self.m2.snap_shape)[1][0][1] bc.param2 = e2.Curve.parameter(proj) #bc.param2 = (pa2 - self.m2.snap_shape.FirstParameter) / (self.m2.snap_shape.LastParameter - self.m2.snap_shape.FirstParameter) bc.scale2 = self.t2.parameter bc.cont2 = self.Object.Proxy.getContinuity(self.c2.text[0]) bc.maxDegree = self.Object.DegreeMax bc.compute() self.Object.Shape = bc.Curve.toShape() return bc
def execute(self, obj): edge = _utils.getShape(obj, 'InputEdge', 'Edge') # self.getEdge(obj) face = _utils.getShape(obj, 'Face', 'Face') # self.getFace(obj) cos = curveOnSurface.curveOnSurface(edge, face) if obj.Reverse: cos.reverse() if obj.Closed: cos.closed = True cos.reverseTangent = obj.ReverseTangent cos.reverseNormal = obj.ReverseNormal cos.reverseBinormal = obj.ReverseBinormal if obj.Output == "Normal face": obj.Shape = cos.normalFace(obj.Samples, float(obj.FaceWidth), obj.Tolerance, obj.Symmetric) elif obj.Output == "Binormal face": obj.Shape = cos.binormalFace(obj.Samples, float(obj.FaceWidth), obj.Tolerance, obj.Symmetric) else: obj.Shape = cos.getEdge() #obj.Placement.Base = face.Placement.Base return (cos)
def get_curves(self, obj): curves = [] edges = [] for o in obj.SourceObjects: curves.extend(o.Shape.Wires) edges.extend(o.Shape.Edges) if len(curves) == 2: return curves[0], curves[1] if len(edges) == 2: return edges[0], edges[1] edges = _utils.getShape(obj, "SourceShapes", "Edge") if len(edges) == 2: return edges[0], edges[1]
def execute(self, fp): e1 = _utils.getShape(fp, "Edge1", "Edge") e2 = _utils.getShape(fp, "Edge2", "Edge") if e1 and e2: bc = nurbs_tools.blendCurve(e1,e2) bc.param1 = e1.FirstParameter + fp.Parameter1 * (e1.LastParameter - e1.FirstParameter) bc.param2 = e2.FirstParameter + fp.Parameter2 * (e2.LastParameter - e2.FirstParameter) bc.cont1 = self.getContinuity(fp.Continuity1) bc.cont2 = self.getContinuity(fp.Continuity2) bc.scale1 = fp.Scale1 bc.scale2 = fp.Scale2 bc.maxDegree = fp.DegreeMax bc.compute() if bc.Curve is None: fp.CurvePts = [] fp.Shape = Part.Shape() else: fp.CurvePts = bc.Curve.getPoles() if fp.Output == "Wire": fp.Shape = bc.getWire() elif fp.Output == "Joined": fp.Shape = bc.getJoinedCurve().toShape() else: fp.Shape = bc.Curve.toShape()
def execute(self, obj): sh = None rl = False if len(obj.IndivFaces) > 0: faces = _utils.getShape(obj, "IndivFaces", "Face") sh = Part.Compound(faces) elif hasattr(obj.Source,"Shape"): sh = obj.Source.Shape try: rl = sh.reflectLines(obj.ViewDir, obj.ViewPos, obj.UpDir) except AttributeError: pass if rl and obj.ShapeCleaning: edges = rl.Edges rl = Part.Compound(nurbs_tools.remove_subsegments(edges, num=obj.Samples, tol=obj.Tolerance)) if rl: obj.Shape = rl
def unsetEdit(self, vobj, mode=0): e = _utils.getShape(self.Object, "Source", "Edge") if isinstance(self.ip, pointEditor): params = list() for p in self.ip.points: if isinstance(p, MarkerOnEdge): pt = p.points[0] par = e.Curve.parameter(FreeCAD.Vector(pt)) temp = e.Curve.trim(e.FirstParameter, par) params.append("{:.3f}mm".format(temp.length())) self.Object.Values = params vobj.Selectable = self.select_state vobj.PointSize = self.ps self.ip.quit() self.ip = None self.active = False #vobj.Visibility = True return True
def execute(self, obj): e = _utils.getShape(obj, "Edge", "Edge") p = obj.Value if obj.Method == "Percent": p = self.PercentToParam(e, obj.Value) elif obj.Method == "Distance": p = self.DistanceToParam(e, obj.Value) if p > e.FirstParameter and p < e.LastParameter: w = e.split(p) if obj.Output == "Start": obj.Shape = w.Edges[0] elif obj.Output == "End": obj.Shape = w.Edges[-1] else: obj.Shape = w else: obj.Shape = e obj.Placement = e.Placement
def execute(self, obj): e = _utils.getShape(obj, "Source", "Edge") params = [] if hasattr(obj, "Values"): params = self.parse_values(e, obj.Values) if params == []: obj.Shape = e return if params[0] > e.FirstParameter: params.insert(0, e.FirstParameter) if params[-1] < e.LastParameter: params.append(e.LastParameter) edges = [] for i in range(len(params) - 1): c = e.Curve.trim(params[i], params[i + 1]) edges.append(c.toShape()) w = Part.Wire(edges) if w.isValid(): obj.Shape = w else: FreeCAD.Console.PrintError("Split curve : Invalid Wire !") obj.Shape = e
def execute(self, obj): debug("\n\nExecuting PipeShell\n") path = None profs = [] edges = _utils.getShape(obj, "Spine", "Edge") path = Part.Wire(Part.__sortEdges__(edges)) if path.isValid(): debug("Valid spine : %s"%path) if hasattr(obj, "Profiles"): profs = obj.Profiles if not (path and profs): return(None) debug("Creating PipeShell") # create the pipeShell object ps = Part.BRepOffsetAPI.MakePipeShell(path) ps.setMaxDegree(self.getprop(obj, "MaxDegree") or 3) ps.setMaxSegments(self.getprop(obj, "MaxSegments") or 32) t3 = self.getprop(obj, "Tol3d") or 1.0e-4 tb = self.getprop(obj, "TolBound") or 1.0e-4 ta = self.getprop(obj, "TolAng") or 1.0e-2 ps.setTolerance(t3, tb, ta) mode = self.getprop(obj, "Mode")# or "DiscreteTrihedron" if mode in ["Binormal","FixedTrihedron"]: direction = self.getprop(obj, "Direction") if not direction: direction = FreeCAD.Vector(0,0,1) obj.Direction = direction FreeCAD.Console.PrintError("\nWrong direction, defaulting to +Z\n") elif direction.Length < 1e-7: direction = FreeCAD.Vector(0,0,1) obj.Direction = direction FreeCAD.Console.PrintError("\nDirection has null length, defaulting to +Z\n") if mode == "Binormal": debug("Binormal mode (%r)"%direction) ps.setBiNormalMode(direction) elif mode == "FixedTrihedron": loc = self.getprop(obj, "Location") or FreeCAD.Vector(0,0,0) debug("FixedTrihedron mode (%r %r)"%(loc, direction)) ps.setTrihedronMode(loc, direction) elif mode == "Frenet": fre = self.getprop(obj, "Corrected") debug("Frenet mode (%r)"%fre) ps.setFrenetMode(fre) elif mode == "AuxiliarySpine": aux = self.getprop(obj, "Auxiliary") w = None if aux: if aux.Shape.Wires: w = aux.Shape.Wires[0] elif aux.Shape.Edges: w = Part.Wire(Part.__sortEdges__(aux.Shape.Edges)) if w: curv = self.getprop(obj, "EquiCurvi") or False cont = self.getprop(obj, "Contact") or "NoContact" n = self.getCode(cont) debug("AuxiliarySpine mode (%r %s)"%(curv,cont)) ps.setAuxiliarySpine(w,curv,n) else: FreeCAD.Console.PrintError("\nPlease set a valid Auxiliary Spine Object\n") elif mode == "ShapeSupport": sup = self.getprop(obj, "Support") sh = None if sup: sh = sup.Shape if sh: debug("ShapeSupport mode") ps.setSpineSupport(sh) else: FreeCAD.Console.PrintError("\nPlease set a valid Spine support Object\n") for p in profs: self.add(ps,p) if ps.isReady(): output = self.getprop(obj, "Output") solid = self.getprop(obj, "Solid") or False if (output == "Surface") or (not hasattr(ps,'simulate')): ps.build() if solid: ps.makeSolid() obj.Shape = ps.shape() else: shapes = ps.simulate(self.getprop(obj, "Samples") or 100) if output == "Lofted sections": obj.Shape = Part.makeLoft(shapes, solid, False, False, self.getprop(obj, "MaxDegree")) else: rails = self.getRails(shapes) c = Part.Compound(shapes + rails) obj.Shape = c else: FreeCAD.Console.PrintError("\nFailed to create shape\n")
def execute(self, obj): faces = _utils.getShape(obj, "Faces", "Face") shell = Part.Shell(faces) obj.Shape = Part.Solid(shell)
def getFace(self, obj): return _utils.getShape(obj, "Face", "Face")
def execute(self, obj): faces = _utils.getShape(obj,"Faces","Face") shell = Part.Shell(faces) obj.Shape = Part.Solid(shell)
def execute(self, obj): debug("\n\nExecuting PipeShell\n") path = None profs = [] edges = _utils.getShape(obj, "Spine", "Edge") path = Part.Wire(Part.__sortEdges__(edges)) if path.isValid(): debug("Valid spine : %s" % path) if hasattr(obj, "Profiles"): profs = obj.Profiles if not (path and profs): return (None) debug("Creating PipeShell") # create the pipeShell object ps = Part.BRepOffsetAPI.MakePipeShell(path) ps.setMaxDegree(self.getprop(obj, "MaxDegree") or 3) ps.setMaxSegments(self.getprop(obj, "MaxSegments") or 32) t3 = self.getprop(obj, "Tol3d") or 1.0e-4 tb = self.getprop(obj, "TolBound") or 1.0e-4 ta = self.getprop(obj, "TolAng") or 1.0e-2 ps.setTolerance(t3, tb, ta) mode = self.getprop(obj, "Mode") # or "DiscreteTrihedron" if mode in ["Binormal", "FixedTrihedron"]: direction = self.getprop(obj, "Direction") if not direction: direction = FreeCAD.Vector(0, 0, 1) obj.Direction = direction FreeCAD.Console.PrintError( "\nWrong direction, defaulting to +Z\n") elif direction.Length < 1e-7: direction = FreeCAD.Vector(0, 0, 1) obj.Direction = direction FreeCAD.Console.PrintError( "\nDirection has null length, defaulting to +Z\n") if mode == "Binormal": debug("Binormal mode (%r)" % direction) ps.setBiNormalMode(direction) elif mode == "FixedTrihedron": loc = self.getprop(obj, "Location") or FreeCAD.Vector(0, 0, 0) debug("FixedTrihedron mode (%r %r)" % (loc, direction)) ps.setTrihedronMode(loc, direction) elif mode == "Frenet": fre = self.getprop(obj, "Corrected") debug("Frenet mode (%r)" % fre) ps.setFrenetMode(fre) elif mode == "AuxiliarySpine": aux = self.getprop(obj, "Auxiliary") w = None if aux: if aux.Shape.Wires: w = aux.Shape.Wires[0] elif aux.Shape.Edges: w = Part.Wire(Part.__sortEdges__(aux.Shape.Edges)) if w: curv = self.getprop(obj, "EquiCurvi") or False cont = self.getprop(obj, "Contact") or "NoContact" n = self.getCode(cont) debug("AuxiliarySpine mode (%r %s)" % (curv, cont)) ps.setAuxiliarySpine(w, curv, n) else: FreeCAD.Console.PrintError( "\nPlease set a valid Auxiliary Spine Object\n") elif mode == "ShapeSupport": sup = self.getprop(obj, "Support") sh = None if sup: sh = sup.Shape if sh: debug("ShapeSupport mode") ps.setSpineSupport(sh) else: FreeCAD.Console.PrintError( "\nPlease set a valid Spine support Object\n") for p in profs: self.add(ps, p) if ps.isReady(): output = self.getprop(obj, "Output") solid = self.getprop(obj, "Solid") or False if (output == "Surface") or (not hasattr(ps, 'simulate')): ps.build() if solid: ps.makeSolid() obj.Shape = ps.shape() else: shapes = ps.simulate(self.getprop(obj, "Samples") or 100) if output == "Lofted sections": obj.Shape = Part.makeLoft(shapes, solid, False, False, self.getprop(obj, "MaxDegree")) else: rails = self.getRails(shapes) c = Part.Compound(shapes + rails) obj.Shape = c else: FreeCAD.Console.PrintError("\nFailed to create shape\n")
def getPoints(self, obj): vl = _utils.getShape(obj, "PointList", "Vertex") return ([v.Point for v in vl])
def getPoints( self, obj): vl = _utils.getShape(obj, "PointList", "Vertex") return([v.Point for v in vl])
def setEdit(self, vobj, mode=0): debug("BlendCurve Edit mode = %d" % mode) if mode == 0: if vobj.Selectable: self.select_state = True vobj.Selectable = False self.ps = vobj.PointSize vobj.PointSize = 0.0 pts = list() e1 = _utils.getShape(self.Object, "Edge1", "Edge") e2 = _utils.getShape(self.Object, "Edge2", "Edge") pa1 = e1.FirstParameter + ( e1.LastParameter - e1.FirstParameter) * self.Object.Parameter1 pa2 = e2.FirstParameter + ( e2.LastParameter - e2.FirstParameter) * self.Object.Parameter2 d = e1.valueAt(pa1).distanceToPoint(e2.valueAt(pa2)) self.m1 = manipulators.EdgeSnapAndTangent(e1.valueAt(pa1), e1) self.m1.set_color("cyan") self.m1.marker.markerIndex = coin.SoMarkerSet.CIRCLE_LINE_9_9 pts.append(self.m1) self.c1 = manipulators.CycleText(self.m1) self.c1.text_list = ["C0", "G1", "G2", "G3", "G4"] self.c1.text = self.Object.Continuity1 self.c1.show() pts.append(self.c1) self.t1 = manipulators.TangentSnap(self.m1) self.t1._scale = d / 3.0 self.t1.parameter = self.Object.Scale1 pts.append(self.t1) self.tt1 = manipulators.ParameterText(self.t1) self.tt1.show() pts.append(self.tt1) self.m2 = manipulators.EdgeSnapAndTangent(e2.valueAt(pa2), e2) self.m2.set_color("red") self.m2.marker.markerIndex = coin.SoMarkerSet.CIRCLE_LINE_9_9 pts.append(self.m2) self.c2 = manipulators.CycleText(self.m2) self.c2.text_list = ["C0", "G1", "G2", "G3", "G4"] self.c2.text = self.Object.Continuity2 self.c2.show() pts.append(self.c2) self.t2 = manipulators.TangentSnap(self.m2) self.t2._scale = d / 3.0 self.t2.parameter = self.Object.Scale2 pts.append(self.t2) self.tt2 = manipulators.ParameterText(self.t2) self.tt2.show() pts.append(self.tt2) self.ip = pointEditor(pts, self.Object) debug("pointEditor created\n") self.ip.root.on_drag.append(self.update_shape) self.active = True return True return False