Skip to content
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

preferred way to make blank part? #1

Closed
ipsod opened this issue Jun 24, 2021 · 3 comments
Closed

preferred way to make blank part? #1

ipsod opened this issue Jun 24, 2021 · 3 comments

Comments

@ipsod
Copy link

ipsod commented Jun 24, 2021

I've found it useful to start parts off with part(). This lets me comment-out/move/etc. the first item, just like I can the rest of them.

Example:

thing = part()
thing += cube([10, 10, 10])
thing += right(10)(cube([5, 5, 5]))

Since your fork doesn't support part(), what would be the preferred way to make a blank part?

@jeff-dh
Copy link
Owner

jeff-dh commented Jul 7, 2021

I would suggest to use a "native OpenSCAD container" because that's what it actually is, right?

>>> from solid import *
>>> a = union()
>>> a += cube(5)
>>> a += sphere(1)
>>> a
union() {
        cube(size = 5);
        sphere(r = 1);
}

If you don't want a union, you can do the same with a difference or intersection.

@jeff-dh
Copy link
Owner

jeff-dh commented Jul 7, 2021

Btw: If you really really want or need to, you can import the legacy-extension and continue using parts. But I would strongly recommend to explicitly use union,difference and intersection instead like mentioned above.

>>> from solid import *
>>> from solid.extensions.legacy import *
>>> p = part()
>>> p += cube(1)
>>> p += sphere(1)
>>> p
union() {
        cube(size = 1);
        sphere(r = 1);
}

(This might be a good solution to get (your) old code running without changes except for the import)

@ipsod
Copy link
Author

ipsod commented Jul 7, 2021

union makes more sense. Thank you!

@ipsod ipsod closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants