Weird behaviour when subtracting cylinders to sphere

88 views
Skip to first unread message

Pa Dalton

unread,
Jun 29, 2023, 3:17:03 AM6/29/23
to CadQuery
I want to subtract 4 cylinders from a hemisphere. The four cylinders are aligned to (1,0,0), (-1,0,0), (0,1,0), (0,-1,0) and do intersect.

When intersecting one part won't be subtracted!
xFi91.jpg

Whit non-intersecting cones I get the following as expected!
iWArq.jpg

In case I use cylinders instead of cones everything works fine.
Maybe you can help me out :)
code.txt

Jeremy Wright

unread,
Jun 29, 2023, 6:57:21 AM6/29/23
to Pa Dalton, CadQuery
I'm not set up to use OCP VSCode so I can't try your code, but you could try unioning all the cylinders together before cutting them from the hemisphere.

--
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 the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/5fd623ee-f1ed-4c17-bfea-97f611e2aa4bn%40googlegroups.com.

Pa Dalton

unread,
Jun 29, 2023, 11:41:21 AM6/29/23
to CadQuery
Unfortunately this also doesn't work: the cones won't unite correctly.
Bildschirmfoto 2023-06-29 um 17.40.20.jpg

Jeremy Wright

unread,
Jun 29, 2023, 12:07:50 PM6/29/23
to Pa Dalton, CadQuery
I meant to union the cylinders. The cones may not be touching correctly to union.

Pa Dalton

unread,
Jun 29, 2023, 12:23:42 PM6/29/23
to CadQuery
As I said in the original post, using cylinders it works, but it is not what I want to achieve. 
I need it working with cones. 

I also tried using CQ-Editor: the problem is identical.

Jeremy Wright

unread,
Jun 29, 2023, 12:27:24 PM6/29/23
to Pa Dalton, CadQuery
Can you ensure that there is a little bit of intersection between the cone volumes, or will that not work with your design? It doesn't have to be much overlap, just a tiny bit should allow the cones to fuse properly.

Pa Dalton

unread,
Jun 29, 2023, 12:40:58 PM6/29/23
to CadQuery
The cones do pairwise overlap (they aren't tangent to each other): the problem seems to be in the intersection of cone (-1,0,0) and (0,-1,0). 

Pa Dalton

unread,
Jun 29, 2023, 1:02:35 PM6/29/23
to CadQuery
Yes! 
I managed to fix it. The less rotations I perform, the less issues I get!

- I changed my align function performing only 1 rotation instead of 2.
- I made my cones intersect at the origin instead of cutting the top.
Bildschirmfoto 2023-06-29 um 19.01.31.jpg
The corrections can be found in code.py adapted for cq-editor.

But, this fixes only nice coordinates. If I use (-1,1,1),  (1,-1,1),  (1,1,-1) the issue still remains. :(
Bildschirmfoto 2023-06-29 um 19.00.33.jpg
code.py

Pa Dalton

unread,
Jun 29, 2023, 1:06:54 PM6/29/23
to CadQuery
Ok, I found the solution:
I need the tips of the cone to intersect, so, instead of using a radius = 0 , i need to pick something bigger (eg. 0.1).
At this point any cone will work.

Many thanks Jeremy Wright for your help and for responding so fast!
Have a nice day!
Reply all
Reply to author
Forward
0 new messages