Closed farinha93 closed 1 month ago
Ideally what I would like to do is define these trajectories as polylines and then do a thin feature extrude
This is possible. (I don't know if it helps with your performance issue)
from cadquery.occ_impl.shapes import *
pts = [
(0, 0),
(10, 0),
(10, 10),
(20, 10),
(20, 20),
]
wire1 = polyline(*pts)
wire2 = wire1.fillet(2, wire1.vertices())
shell1 = extrude(wire2, (0, 0, 1))
solid1 = offset(shell1, 1)
Alternative solution:
from cadquery.occ_impl.shapes import *
pts = [
(0, 0),
(10, 0),
(10, 10),
(20, 10),
(20, 20),
]
w = 1
h = 0.5
wire1 = polyline(*pts)
face1 = face(wire1.offset2D(w))
solid1 = extrude(face1, (0,0,h))
Hi both, thank you for your recommendations. I've tested both options now and there is a considerable improvement in performance. This is likely as good as it will get, as there is really nothing that can be done to avoid the recursive step. For my code, I ended up creating one Worplane.polyline.offset2D.extrude geometry per trajectory and used boolean operations to add them together.
Hi all, I'm trying to create an stl file which is composed of a single extruded sketch. This sketch contains something like the trajectories of multiple particles which are generated recursively (imagine that every timestep a particle may divide into 2 and thuse 2 traces need to be tracked from now on). Ideally what I would like to do is define these trajectories as polylines and then do a thin feature extrude, which can be found in some commercial software. I couldn't find a function to straight up do that, so started using Sketch().rect for each segment of each trajectory, combining them, and finally extruding the sketch. - which is slightly more efficient than extruding each time. Unfortunately I'm reaching bottleneck on the number and length of trajectories I can do in useful time. It's my first time using cadquery, so maybe I'm not doing this the smartest way. Would appreciate any suggestions.
Bellow is a simplified example of what I've doing so far: