Hi all, very new to FreeCAD; I'd like to 3D print some shapes based on parametric paths. Heres the code I'm running that's supposed to make a torus:
Code: Select all
import math
import Part
paths = []
ticks = 360.0
t = 0.0
radius = 1.0
radians = 0.0
x0 = radius
y0 = 0.0
z0 = 1.0
while radians <= 2*math.pi:
radians = 2.0*math.pi*t/ticks
x1 = radius * math.cos(radians)
y1 = radius * math.sin(radians)
z1 = 0.0
paths.append(App.Vector(x1, y1, z1))
x0 = x1
y0 = y1
z0 = z1
t += 1.0
path = Part.BSplineCurve()
path.interpolate(paths)
torus = Part.makeTube(path, 0.1)
>> Traceback (most recent call last):
>> File "<input>", line 1, in <module>
>> TypeError: argument 1 must be Part.Shape, not Part.BSplineCurve
Now, I know I can do this perfectly well using makeCircle, but I want to be able to change the parameters to do various kinds of 3D rosettes and such. I've also tried doing it using a series of line segments and it kind of worked, although then I didn't know how to join them resulting tubes together into one object...any thoughts on how to best approach this? I clearly don't understand how all the basic components get pieced together and converted from one type to another.