Skip to content

Commit

Permalink
add BSpline support to Draft.makeSketch
Browse files Browse the repository at this point in the history
  • Loading branch information
tomate44 authored and yorikvanhavre committed Oct 30, 2017
1 parent 2bc75bd commit d2f4fcb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Mod/Draft/Draft.py
Expand Up @@ -2756,11 +2756,13 @@ def addRadiusConstraint(edge):
ok = True
elif tp == "BSpline":
nobj.addGeometry(obj.Shape.Edges[0].Curve)
nobj.exposeInternalGeometry(nobj.GeometryCount-1)
ok = True
elif tp == "BezCurve":
bez = obj.Shape.Edges[0].Curve
bsp = bez.toBSpline(bez.FirstParameter,bez.LastParameter)
nobj.addGeometry(bsp)
nobj.exposeInternalGeometry(nobj.GeometryCount-1)
ok = True
elif tp == 'Shape' or obj.isDerivedFrom("Part::Feature"):
shape = obj if tp == 'Shape' else obj.Shape
Expand All @@ -2779,8 +2781,15 @@ def addRadiusConstraint(edge):
norm = obj.Placement.Rotation.Axis
for e in shape.Edges:
if DraftGeomUtils.geomType(e) in ["BSplineCurve","BezierCurve"]:
FreeCAD.Console.PrintError(translate("draft","BSplines and Bezier curves are not supported by this tool"))
return None
if DraftGeomUtils.geomType(e) == "BezierCurve":
bsp = e.Curve.toBSpline(e.Curve.FirstParameter,e.Curve.LastParameter)
else:
bsp = e.Curve
nobj.addGeometry(bsp)
nobj.exposeInternalGeometry(nobj.GeometryCount-1)
ok = True
#FreeCAD.Console.PrintError(translate("draft","BSplines and Bezier curves are not supported by this tool"))
#return None
# if not addTo:
# nobj.Placement.Rotation = DraftGeomUtils.calculatePlacement(shape).Rotation

Expand Down

0 comments on commit d2f4fcb

Please sign in to comment.