-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to iteratively loft wires in cadquery 2? #319
Comments
I have tried
I have supposed it is right from the documentation here:
|
Why do you want to actually loft? There is a |
I need control on the section orientation: yaw, roll and pitch |
Here is an example with sweep:
The section starts with a triangle oriented towards the Z axes, and does not stay as this along the path. |
Is this what you want to get? I used raw OCC features, in the end it will be implemented in CQ in relation to #97 import cadquery as cq
from math import sin, cos, pi
SEGMENTS = 148
def sinusoidal_ring(rad=250, segments=SEGMENTS, N = 1):
outline = []
for i in range(segments):
angle = N*i * 2 * pi / segments
x = rad * (cos(angle) + i/segments)
y = rad * sin(angle)
z = 2 * rad * (sin(angle) / 5 + i / segments)
outline.append((x, y, z))
return outline
def triangle(base = 15, ratio = 2):
return [(-base/2, 0), (base/2, 0), (0, base*ratio)]
def extrude_example():
shape = triangle()
p= cq.Workplane("XY",origin=(0,0,30)).spline(path,includeCurrent=True)
s = cq.Workplane("YZ").polyline(shape).close().sweep(p,isFrenet=True)
return s,p
path = sinusoidal_ring(rad=50)
p1 = cq.Workplane("XY",origin=(0,0,30)).spline(path,includeCurrent=True)
p2 = cq.Workplane("XY",origin=(0,0,0)).spline(path,includeCurrent=True)
t = cq.Workplane("YZ").polyline(triangle()).close()
result,p = extrude_example()
import OCC
ps = OCC.Core.BRepOffsetAPI.BRepOffsetAPI_MakePipeShell(p1.wire().val().wrapped)
ps.Add(t.val().wrapped)
ps.SetMode(p2.wire().val().wrapped,True)
ps.Build()
ps.MakeSolid()
res = cq.Shape(ps.Shape())
show_object(res)
show_object(p1)
show_object(p2) |
Oh yes, thank you very much Adam! I cannot use OCC directly at this time, so, you have saved me. Very nice to ear from you it will be in CQ. |
I would like also to explore the different OCC options:
raises the error:
|
Adam, I have made a more realistic test and unfortunatly, what brings
As you can see from the bottom view, the pattern don't rotate and the section of the volume becomes a line. Think of my need as a stair handrail. In my post here, my use case is (1, 1, 0) no yaw, but the section can roll when the handrail turns right or left, and can pitch when it climbs. OCC is very hard to learn because the documentation is light and one has to test thoroughly to figure out what it can perform, or review the code if possible - and testing is hard because it lacks examples. Probably there is a way to use |
Here is the working code:
The point is to push back the last wire in the CQ stack, what a simple python assigment could not do ( |
Same post as here. I can loft a 2D shape from one plane to another like this:
image
![image](https://user-images.githubusercontent.com/3611049/79256560-8594e080-7e88-11ea-8f90-612afe196d52.png)
I would like to repeat the operation several times like this:
I have the following error:
At least, If I suppress the for loop and keep the same variable decomposition, it works:
I think I am close to the result, but I cannot find where I mistake myself. The problem occurs when I come in the loop the second time. I think I have accumulated already two wires in wp2. I should keep only the last one before adding a new one, but I don't know how to do it.
The text was updated successfully, but these errors were encountered: