discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Compulsory distinct/visible Projection of certain objects

S
sukrit_gupta
Mon, Nov 9, 2015 9:49 PM

For the following code:
projection(cut = true) cylinder (d= 16, h =50, center = true);
projection(cut = true) cube (45, center = true);

is it possible with openSCAD that I can get both circle and square for the
above code?
i.e Can I get compulsory point generation of circle object.
I want to export it to DXF.

In what other ways, can the above objective be achieved?

--
View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

For the following code: projection(cut = true) cylinder (d= 16, h =50, center = true); projection(cut = true) cube (45, center = true); is it possible with openSCAD that I can get both circle and square for the above code? i.e Can I get compulsory point generation of circle object. I want to export it to DXF. In what other ways, can the above objective be achieved? -- View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Mon, Nov 9, 2015 9:58 PM

On 11/09/2015 10:49 PM, sukrit_gupta wrote:

For the following code:
projection(cut = true) cylinder (d= 16, h =50, center = true);
projection(cut = true) cube (45, center = true);

is it possible with openSCAD that I can get both circle and square for the
above code?

like so?

difference() {
square(45, center = true);
circle(d = 16);
}

ciao,
Torsten.

On 11/09/2015 10:49 PM, sukrit_gupta wrote: > For the following code: > projection(cut = true) cylinder (d= 16, h =50, center = true); > projection(cut = true) cube (45, center = true); > > is it possible with openSCAD that I can get both circle and square for the > above code? > like so? difference() { square(45, center = true); circle(d = 16); } ciao, Torsten.
C
ctchin
Tue, Nov 10, 2015 4:02 AM

It does do the trick since it makes a DXF with a square minus a circle.  But
I have a feeling this may not satisfy mr. gupta.  I am guessing he wants a
general solution that lets him make 2D (traditional drafting) DXF out of
some 3D models he designed.

What if one shape isn't entirely within another shape?  difference() won't
preserve both original shapes.  The reason his code doesn't work (missing
circle) is that OpenSCAD implicitly union() all objects at the same level
(top level) unless it's being fed to a module (such as difference()).
Therefore you can never preserve the separate completeness of two
overlapping objects.  In fact, overlapping or not doesn't matter.  OpenSCAD
treats all objects as one, if they don't overlap it just become a disjointed
object.

So except for those special cases (every shape's boundaries don't cross each
other) Signor Torsten's solution won't work.  I remember coming across a
project that claims to create classic 2D drafts from OpenSCAD models, give
that a try.

--
View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14330.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

It does do the trick since it makes a DXF with a square minus a circle. But I have a feeling this may not satisfy mr. gupta. I am guessing he wants a general solution that lets him make 2D (traditional drafting) DXF out of some 3D models he designed. What if one shape isn't entirely within another shape? difference() won't preserve both original shapes. The reason his code doesn't work (missing circle) is that OpenSCAD implicitly union() all objects at the same level (top level) unless it's being fed to a module (such as difference()). Therefore you can never preserve the separate completeness of two overlapping objects. In fact, overlapping or not doesn't matter. OpenSCAD treats all objects as one, if they don't overlap it just become a disjointed object. So except for those special cases (every shape's boundaries don't cross each other) Signor Torsten's solution won't work. I remember coming across a project that claims to create classic 2D drafts from OpenSCAD models, give that a try. -- View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14330.html Sent from the OpenSCAD mailing list archive at Nabble.com.
S
sukrit_gupta
Tue, Nov 10, 2015 7:36 AM

tp3 wrote

difference() {
square(45, center = true);
circle(d = 16);
}

Thanks.
This code also works:
projection(cut = true)
difference(){
cube (45, center = true);
cylinder (d= 16, h =50, center = true);
}

This difference() approach will be valid only till the objects don't
intersect with each other. This won't work in the following case:
projection(cut = true)
difference(){
cube (45, center = true);
translate([22.5,0,0])
cylinder (d= 16, h =50, center = true);
}

Adding a new feature to add this support will be helpful in projection. eg.
projection(cut = true)
{cube (45, center = true);
translate([22.5,0,0])
##cylinder (d= 16, h =50, center = true);
}
where ## under projection() denotes compulsory projection.

--
View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14334.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

tp3 wrote > difference() { > square(45, center = true); > circle(d = 16); > } Thanks. This code also works: projection(cut = true) difference(){ cube (45, center = true); cylinder (d= 16, h =50, center = true); } This difference() approach will be valid only till the objects don't intersect with each other. This won't work in the following case: projection(cut = true) difference(){ cube (45, center = true); translate([22.5,0,0]) cylinder (d= 16, h =50, center = true); } Adding a new feature to add this support will be helpful in projection. eg. projection(cut = true) {cube (45, center = true); translate([22.5,0,0]) ##cylinder (d= 16, h =50, center = true); } where ## under projection() denotes compulsory projection. -- View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14334.html Sent from the OpenSCAD mailing list archive at Nabble.com.
S
sukrit_gupta
Tue, Nov 10, 2015 7:46 AM

ctchin wrote

I am guessing he wants a general solution that lets him make 2D
(traditional drafting) DXF out of some 3D models he designed.

Yes, I want a general solution.

ctchin wrote

I remember coming across a project that claims to create classic 2D drafts
from OpenSCAD models, give that a try.

Can you share the link of that project that you came across?

--
View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14335.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

ctchin wrote > I am guessing he wants a general solution that lets him make 2D > (traditional drafting) DXF out of some 3D models he designed. Yes, I want a general solution. ctchin wrote > I remember coming across a project that claims to create classic 2D drafts > from OpenSCAD models, give that a try. Can you share the link of that project that you came across? -- View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14335.html Sent from the OpenSCAD mailing list archive at Nabble.com.
W
wolf
Tue, Nov 10, 2015 9:56 AM

Google for dimlines.scad
Wolf

--
View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14337.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Google for dimlines.scad Wolf -- View this message in context: http://forum.openscad.org/Compulsory-distinct-visible-Projection-of-certain-objects-tp14327p14337.html Sent from the OpenSCAD mailing list archive at Nabble.com.