split with a plane issue

69 views
Skip to first unread message

Laurent Alebarde

unread,
Apr 13, 2023, 5:33:26 PM4/13/23
to CadQuery

I am trying to cut a solid with three successive planes like this :

```
import cadquery as cq
from math import sin as sin, pi as pi, atan as atan
r1 = 240
r2 = 250
sabot = cq.Workplane("XY" ) \
    .ellipseArc(x_radius = r1, y_radius = r1, angle1 = 0, angle2 = 20, sense = -1, startAtCurrent = False) \
    .line(10, 0) \
    .center(0, 0) \
    .ellipseArc(x_radius = r2, y_radius = r2, angle1 = 0, angle2 = 20, sense = 1, startAtCurrent = False) \
    .close() \
    .extrude(100) \
    .faces("<Z").transformed(rotate=(5, 0, 0)).split(keepTop=True) \
    .faces("<Z").transformed(rotate=(40, 0, 0)).split(keepBottom=True) \
    .faces("<Z").transformed(rotate=(40, 0, 0), offset=(0, 100, 0)).split(keepTop=True)

It works well with the two first splits:

Capture d’écran_2023-04-13_23-21-39.png

But not with the 3rd one supposed to be parallel to the second one and offset on y :

Capture d’écran_2023-04-13_23-23-06.png

Expected result is something like :
Capture d’écran_2023-04-13_23-21-40.png

Lorenz

unread,
Apr 13, 2023, 11:08:32 PM4/13/23
to CadQuery
Try changing the last three lines to:

    .transformed(rotate=(5, 0, 0)).split(keepTop=True) \
    .transformed(rotate=(40, 0, 0)).split(keepBottom=True) \
    .transformed(offset=(0, 0, -40)).split(keepTop=True)


Rotation is not required in the last transformed call since you would like the final split to be parallel (and the workplane is already parallel to the split).

Offset is in the Z because this is the workplane normal direction.

Laurent Alebarde

unread,
Apr 14, 2023, 1:12:08 AM4/14/23
to CadQuery
2nd one shouldn't it be then with 35° to obtain 40° ?
For the 3rd one, I have then to correct the offset to take into account the angle of the new reference plane, or is there a way to define the offset in the world coordinate system?

Lorenz Neureuter

unread,
Apr 14, 2023, 1:57:52 AM4/14/23
to Laurent Alebarde, CadQuery
Yes, 35 for the 2nd rotate if the goal is total of 40.

For the 3rd one maybe something like the following:

offset = sabot.plane.toLocalCoords(cq.Vector(0, 20, 0))
sabot = sabot.transformed(offset=offset).split(keepTop=True)


--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to a topic in the Google Groups "CadQuery" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cadquery/_TckSx0UbRA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/4228142d-4640-4369-88b9-6d6f62730590n%40googlegroups.com.

Laurent Alebarde

unread,
Apr 15, 2023, 8:23:11 AM4/15/23
to CadQuery
Thanks Lorenz. Eventually, I have made the 3rd splitting plan offset perpendicularly to the 2nd one :

```
import cadquery as cq
from math import pi as pi, sin as sin, cos as cos, atan as atan

sabot = cq.Workplane("XY" ) \
    .ellipseArc(x_radius = 240, y_radius = 240, angle1 = 0, angle2 = 30, sense = -1, startAtCurrent = False) \
    .line(10, 0) \
    .center(0, 0) \
    .ellipseArc(x_radius = 250, y_radius = 250, angle1 = 0, angle2 = 30, sense = 1, startAtCurrent = False) \
    .close() \
    .extrude(50) \
    .faces("<Z").workplane().tag("baseplaneSabot") \
    .workplaneFromTagged("baseplaneSabot").transformed(rotate=(5, 0, 0)).split(keepBottom=True) \
    .workplaneFromTagged("baseplaneSabot").transformed(rotate=(30, 0, 0)).split(keepTop=True) \
    .transformed(offset=(0, 0, 20)).split(keepBottom=True)
#    .workplaneFromTagged("baseplaneSabot").transformed(rotate=(30, 0, 0), offset=(0, 0, 40)).split(keepBottom=True)
```
Reply all
Reply to author
Forward
0 new messages