Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Intersecting Solids #188

Closed
fragmuffin opened this issue Sep 9, 2017 · 8 comments
Closed

Intersecting Solids #188

fragmuffin opened this issue Sep 9, 2017 · 8 comments

Comments

@fragmuffin
Copy link
Contributor

👍 for an intersect command.

Example a remake of wikipedia's intersect CSG example

import cadquery as cq
from Helpers import show

sphere = cq.Workplane("XY").sphere(7.5).translate((5, 5, 5))
box = cq.Workplane("XY").box(10, 10, 10)
intersection = sphere.intersect(box)  # error, not implemented

show(intersection)

Workaround can be found in this gist

or am I missing something? (entirely possible 😉)

@dcowden
Copy link
Owner

dcowden commented Sep 9, 2017

This is easy to implement. The intersect method is already implemented at the low level in shapes.py.

App that's needed is to add a method into cq.py that's similar to cut, but uses Solid.intersect instead of Solid.cut

A PR would be welcome

@fragmuffin
Copy link
Contributor Author

I can't help but feel that you've set me up for success.
regardless, I feel warm and fuzzy.

@dcowden
Copy link
Owner

dcowden commented Sep 9, 2017

ha, you are quite funny ( evidently, in addition to being fuzzy).

+10 points for adding a test case, and thanks for the contribution. Thanks also for the little whitespace cleanup you did.

Is it WIP or are you ready for me to merge it in?

@easyw
Copy link

easyw commented Sep 9, 2017

common is different from intersect?

@dcowden
Copy link
Owner

dcowden commented Sep 9, 2017

They are the same. intersect is the name I'm most familiar with, and is commonly used with CSG. But 'common' is what FreeCAD calls it.

@fragmuffin
Copy link
Contributor Author

@dcowden
it's ready to merge, just a simple change.

actually, the WS cleanup was my editor, sometimes it's useful, but other times I get a to-and-fro between conflicting editors... either way, you're welcome 😉

@dcowden
Copy link
Owner

dcowden commented Sep 10, 2017

Awesome, ok thanks again for the contribution!

@dcowden
Copy link
Owner

dcowden commented Sep 10, 2017

Available in master

@dcowden dcowden closed this as completed Sep 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants