Doing set operations on included top-level objects? #110

Closed
iamwilhelm opened this Issue Apr 30, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

iamwilhelm commented Apr 30, 2012

In the manual, it says there's a difference between include and use. In "include", it renders any top-level objects, whereas "use" does not.

My question is, how do I do set operations on the models that show up when I do include?

intersection() {
    include <cup.scad>
    include <tube.scad>
}

That currently is invalid syntax. Is there another way to do that?

Contributor

GilesBathgate commented Apr 30, 2012

Fyi this is done in RapCAD thus:

import <cup.scad> as mycup;
import <tube.scad> as mytube;

difference() {
    mycup();
    mytube();
}

Regards

Giles

Contributor

iamwilhelm commented Apr 30, 2012

Is RapCAD a superset of the OpenSCAD language? Or is it a different language altogether?

Contributor

GilesBathgate commented Apr 30, 2012

Yes its a superset of the OpenSCAD language, but a completely different implementation.

Contributor

iamwilhelm commented Apr 30, 2012

When I try it, I get:

Info: Importing '/Applications/tree1.scad'

Warning: Unknown import type 'scad'

I downloaded RapCAD 0.6.0. Any tips? I also tried it from the command line, so the path was correct, but it still complained about the import type.

Contributor

GilesBathgate commented May 1, 2012

Sorry I forgot import works for stl.

To do what you want in OpenSCAD.

cup.scad:

module cup() {
...
}

cup();

tube.scad:

module tube() {
...
}

tube();

main.scad:

use <cup.scad>
use <tube.scad>

difference() {
    cup();
    tube();
}

I realise that this doesn't answer your question as to how you can do set operations on top-level objects, the simple answer is that you can't. However if you simply edit the files you are trying to include and wrap all the top level objects in a module then you should be able to achieve what you want. Also thanks for trying out RapCAD.

Regards

Giles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment