easyw-fc wrote: ↑
Sat Oct 28, 2017 8:12 pm
Would you have some suggestions or some code tips?
Thanks in advance for any suggestion...
I don't use the sketcher a lot, so I don't know much about sketcher scripting.
I gave a try at the conversion, with no success.
Here is what I tried :
Code: Select all
edge = FreeCADGui.Selection.getSelection().Shape.Edges
# create the list of circles (control points)
circles = 
for pole in edge.Curve.getPoles():
sk = App.activeDocument().addObject('Sketcher::SketchObject','Sketch')
# add the circles to the sketch, as construction geometries
for c in circles:
# set the radius of the first circle to 10
# set the constraints of the following circles
w = edge.Curve.getWeights()
for i in range(1,len(circles)):
if w[i] == w:
sk.addConstraint(Sketcher.Constraint('Radius',i,10.0 * w[i] / w))
# add the BSplineCurve to the sketch
# below should be the "glue" code between the circles and the BSplineCurve
conList = 
for i range(len(circles)):
# I don't know the meaning of the numbers at the end of the following command
# the following line fails, I don't know why
# and in the resulting sketch, the circles have no effect on the curve shape ...