discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

aligning/flooring all objects

B
bboett
Thu, Jul 11, 2019 3:30 PM

Hello,
somehow, didn't find anything in the docu, so i must be looking at the wrong
places....

i am still dabbling with my spoolholder, and made one openscad file where i
assembled the 2 pieces (ok, i could print the separately, but since i am
still learning....)

somehow, i managed to put a gap around 1.5mm into my drawings....
so when i try to print them, one is fine, and the other is printed into thin
air.....

now i could tell  the slicer to put in some raft, but thats unelegant....

so is there a way, when i use a module from another file, to tell it to
floor it on (0,0,0)?
or is there a way to tell exactly what the gap is, to be able to make a
translation?

thanks in advance

Bruno

--
Sent from: http://forum.openscad.org/

Hello, somehow, didn't find anything in the docu, so i must be looking at the wrong places.... i am still dabbling with my spoolholder, and made one openscad file where i assembled the 2 pieces (ok, i could print the separately, but since i am still learning....) somehow, i managed to put a gap around 1.5mm into my drawings.... so when i try to print them, one is fine, and the other is printed into thin air..... now i could tell the slicer to put in some raft, but thats unelegant.... so is there a way, when i use a module from another file, to tell it to floor it on (0,0,0)? or is there a way to tell exactly what the gap is, to be able to make a translation? thanks in advance Bruno -- Sent from: http://forum.openscad.org/
AC
A. Craig West
Thu, Jul 11, 2019 3:34 PM

With imported objects, I spend a lot of time displaying various cubes with
% to find the exact position of various planes in the objects, so I can
offset them properly. Unfortunately, there seems to be no way to ask the
system for this information.

On Thu, 11 Jul 2019, 11:31 bboett, bboett@gmail.com wrote:

Hello,
somehow, didn't find anything in the docu, so i must be looking at the
wrong
places....

i am still dabbling with my spoolholder, and made one openscad file where i
assembled the 2 pieces (ok, i could print the separately, but since i am
still learning....)

somehow, i managed to put a gap around 1.5mm into my drawings....
so when i try to print them, one is fine, and the other is printed into
thin
air.....

now i could tell  the slicer to put in some raft, but thats unelegant....

so is there a way, when i use a module from another file, to tell it to
floor it on (0,0,0)?
or is there a way to tell exactly what the gap is, to be able to make a
translation?

thanks in advance

Bruno

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

With imported objects, I spend a lot of time displaying various cubes with % to find the exact position of various planes in the objects, so I can offset them properly. Unfortunately, there seems to be no way to ask the system for this information. On Thu, 11 Jul 2019, 11:31 bboett, <bboett@gmail.com> wrote: > Hello, > somehow, didn't find anything in the docu, so i must be looking at the > wrong > places.... > > i am still dabbling with my spoolholder, and made one openscad file where i > assembled the 2 pieces (ok, i could print the separately, but since i am > still learning....) > > somehow, i managed to put a gap around 1.5mm into my drawings.... > so when i try to print them, one is fine, and the other is printed into > thin > air..... > > now i could tell the slicer to put in some raft, but thats unelegant.... > > so is there a way, when i use a module from another file, to tell it to > floor it on (0,0,0)? > or is there a way to tell exactly what the gap is, to be able to make a > translation? > > thanks in advance > > Bruno > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JF
Joe Francis
Thu, Jul 11, 2019 3:39 PM

Right - OpenSCAD can't do this for you.

The "trick", really, is to design all your parts around a convenient
origin and then translate them to the assembled position.  It seems most
people's intuition is to model the part in the assembled position and
then try to move it back to a convenient origin for printing (or
whatever else).

I'm sure some will debate this being a better way, but it's much more
obviously the best way if you get to a point where you're reusing models
that you created.  Having a convenient origin makes this much more
practical, for a lot of reasons.

Joe

On 7/11/19 10:34 AM, A. Craig West wrote:

With imported objects, I spend a lot of time displaying various cubes
with % to find the exact position of various planes in the objects, so
I can offset them properly. Unfortunately, there seems to be no way to
ask the system for this information.

On Thu, 11 Jul 2019, 11:31 bboett, <bboett@gmail.com
mailto:bboett@gmail.com> wrote:

 Hello,
 somehow, didn't find anything in the docu, so i must be looking at
 the wrong
 places....

 i am still dabbling with my spoolholder, and made one openscad
 file where i
 assembled the 2 pieces (ok, i could print the separately, but
 since i am
 still learning....)

 somehow, i managed to put a gap around 1.5mm into my drawings....
 so when i try to print them, one is fine, and the other is printed
 into thin
 air.....

 now i could tell  the slicer to put in some raft, but thats
 unelegant....

 so is there a way, when i use a module from another file, to tell
 it to
 floor it on (0,0,0)?
 or is there a way to tell exactly what the gap is, to be able to
 make a
 translation?

 thanks in advance

 Bruno



 --
 Sent from: http://forum.openscad.org/

 _______________________________________________
 OpenSCAD mailing list
 Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
 http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Right - OpenSCAD can't do this for you. The "trick", really, is to design all your parts around a convenient origin and then translate them to the assembled position.  It seems most people's intuition is to model the part in the assembled position and then try to move it back to a convenient origin for printing (or whatever else). I'm sure some will debate this being a better way, but it's much more obviously the best way if you get to a point where you're reusing models that you created.  Having a convenient origin makes this *much* more practical, for a lot of reasons. Joe On 7/11/19 10:34 AM, A. Craig West wrote: > With imported objects, I spend a lot of time displaying various cubes > with % to find the exact position of various planes in the objects, so > I can offset them properly. Unfortunately, there seems to be no way to > ask the system for this information. > > On Thu, 11 Jul 2019, 11:31 bboett, <bboett@gmail.com > <mailto:bboett@gmail.com>> wrote: > > Hello, > somehow, didn't find anything in the docu, so i must be looking at > the wrong > places.... > > i am still dabbling with my spoolholder, and made one openscad > file where i > assembled the 2 pieces (ok, i could print the separately, but > since i am > still learning....) > > somehow, i managed to put a gap around 1.5mm into my drawings.... > so when i try to print them, one is fine, and the other is printed > into thin > air..... > > now i could tell  the slicer to put in some raft, but thats > unelegant.... > > so is there a way, when i use a module from another file, to tell > it to > floor it on (0,0,0)? > or is there a way to tell exactly what the gap is, to be able to > make a > translation? > > thanks in advance > > Bruno > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
AC
A. Craig West
Thu, Jul 11, 2019 3:44 PM

Generally I do the import with offsets to zero it to origin in a module,
then use offsets to position the module appropriately

On Thu, 11 Jul 2019, 11:40 Joe Francis, joe@lostapathy.com wrote:

Right - OpenSCAD can't do this for you.

The "trick", really, is to design all your parts around a convenient
origin and then translate them to the assembled position.  It seems most
people's intuition is to model the part in the assembled position and then
try to move it back to a convenient origin for printing (or whatever else).

I'm sure some will debate this being a better way, but it's much more
obviously the best way if you get to a point where you're reusing models
that you created.  Having a convenient origin makes this much more
practical, for a lot of reasons.

Joe

On 7/11/19 10:34 AM, A. Craig West wrote:

With imported objects, I spend a lot of time displaying various cubes with
% to find the exact position of various planes in the objects, so I can
offset them properly. Unfortunately, there seems to be no way to ask the
system for this information.

On Thu, 11 Jul 2019, 11:31 bboett, bboett@gmail.com wrote:

Hello,
somehow, didn't find anything in the docu, so i must be looking at the
wrong
places....

i am still dabbling with my spoolholder, and made one openscad file where
i
assembled the 2 pieces (ok, i could print the separately, but since i am
still learning....)

somehow, i managed to put a gap around 1.5mm into my drawings....
so when i try to print them, one is fine, and the other is printed into
thin
air.....

now i could tell  the slicer to put in some raft, but thats unelegant....

so is there a way, when i use a module from another file, to tell it to
floor it on (0,0,0)?
or is there a way to tell exactly what the gap is, to be able to make a
translation?

thanks in advance

Bruno

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing listDiscuss@lists.openscad.orghttp://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Generally I do the import with offsets to zero it to origin in a module, then use offsets to position the module appropriately On Thu, 11 Jul 2019, 11:40 Joe Francis, <joe@lostapathy.com> wrote: > Right - OpenSCAD can't do this for you. > > The "trick", really, is to design all your parts around a convenient > origin and then translate them to the assembled position. It seems most > people's intuition is to model the part in the assembled position and then > try to move it back to a convenient origin for printing (or whatever else). > > I'm sure some will debate this being a better way, but it's much more > obviously the best way if you get to a point where you're reusing models > that you created. Having a convenient origin makes this *much* more > practical, for a lot of reasons. > > Joe > > > > > On 7/11/19 10:34 AM, A. Craig West wrote: > > With imported objects, I spend a lot of time displaying various cubes with > % to find the exact position of various planes in the objects, so I can > offset them properly. Unfortunately, there seems to be no way to ask the > system for this information. > > On Thu, 11 Jul 2019, 11:31 bboett, <bboett@gmail.com> wrote: > >> Hello, >> somehow, didn't find anything in the docu, so i must be looking at the >> wrong >> places.... >> >> i am still dabbling with my spoolholder, and made one openscad file where >> i >> assembled the 2 pieces (ok, i could print the separately, but since i am >> still learning....) >> >> somehow, i managed to put a gap around 1.5mm into my drawings.... >> so when i try to print them, one is fine, and the other is printed into >> thin >> air..... >> >> now i could tell the slicer to put in some raft, but thats unelegant.... >> >> so is there a way, when i use a module from another file, to tell it to >> floor it on (0,0,0)? >> or is there a way to tell exactly what the gap is, to be able to make a >> translation? >> >> thanks in advance >> >> Bruno >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing listDiscuss@lists.openscad.orghttp://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
L
lar3ry
Thu, Jul 11, 2019 6:00 PM

bboett wrote

somehow, i managed to put a gap around 1.5mm into my drawings....
so when i try to print them, one is fine, and the other is printed into
thin
air.....

now i could tell  the slicer to put in some raft, but thats unelegant....

so is there a way, when i use a module from another file, to tell it to
floor it on (0,0,0)?
or is there a way to tell exactly what the gap is, to be able to make a
translation?

Repetier Host will lay it flat for you. Earier versions required the use of
the "Lay Flat" icon in the Object Placement tab, but in trying it just now,
a test cube, translated to 10,10,10 actually does drop to the bed when
loaded. Then, you can move it to the origin (0,0) of your bed, and export it
(Export icon, box with exiting arrow).  My Repetier Host is V2.1.3

But a better way to import STL files and position them is to use a rather
nifty little python script written by Jamie Bainbridge, called stldim.py,
modified by me.. His original script can be found at:

https://www.reddit.com/r/3Dprinting/comments/7ehlfc/python_script_to_find_stl_dimensions/

I have modified it to produce a OpenSCAD translate() statements to position
any imported STL (or any other object, for that matter) in any one of the
four quadrants, or the center of X,Y, and Z.

See
http://forum.openscad.org/Getting-dimensions-of-imported-shape-tt24237.html#a26496
for my modified script and instructions for use.

I see that many folks have asked for a way to find and use a bounding box in
OpenSCAD, and I wonder if it will ever be implemented. It would be very
handy, and its use could be implemented as just information in the console,
or used directly in something that might be called "absolute_translate().

--
Sent from: http://forum.openscad.org/

bboett wrote > somehow, i managed to put a gap around 1.5mm into my drawings.... > so when i try to print them, one is fine, and the other is printed into > thin > air..... > > now i could tell the slicer to put in some raft, but thats unelegant.... > > so is there a way, when i use a module from another file, to tell it to > floor it on (0,0,0)? > or is there a way to tell exactly what the gap is, to be able to make a > translation? Repetier Host will lay it flat for you. Earier versions required the use of the "Lay Flat" icon in the Object Placement tab, but in trying it just now, a test cube, translated to 10,10,10 actually does drop to the bed when loaded. Then, you can move it to the origin (0,0) of your bed, and export it (Export icon, box with exiting arrow). My Repetier Host is V2.1.3 But a better way to import STL files and position them is to use a rather nifty little python script written by Jamie Bainbridge, called stldim.py, modified by me.. His original script can be found at: https://www.reddit.com/r/3Dprinting/comments/7ehlfc/python_script_to_find_stl_dimensions/ I have modified it to produce a OpenSCAD translate() statements to position any imported STL (or any other object, for that matter) in any one of the four quadrants, or the center of X,Y, and Z. See http://forum.openscad.org/Getting-dimensions-of-imported-shape-tt24237.html#a26496 for my modified script and instructions for use. I see that many folks have asked for a way to find and use a bounding box in OpenSCAD, and I wonder if it will ever be implemented. It would be very handy, and its use could be implemented as just information in the console, or used directly in something that might be called "absolute_translate(). -- Sent from: http://forum.openscad.org/
L
lar3ry
Thu, Jul 11, 2019 6:08 PM

oops... just realized that I made some more modifications to that script and
put it on github.

https://github.com/lar3ry/OpenSCAD---Move-STL-to-origin

--
Sent from: http://forum.openscad.org/

oops... just realized that I made some more modifications to that script and put it on github. https://github.com/lar3ry/OpenSCAD---Move-STL-to-origin -- Sent from: http://forum.openscad.org/
JB
Jordan Brown
Thu, Jul 11, 2019 6:21 PM

On 7/11/2019 11:00 AM, lar3ry wrote:

I see that many folks have asked for a way to find and use a bounding
box in OpenSCAD, and I wonder if it will ever be implemented.

Perversely, I don't think OpenSCAD itself knows the bounding box,
because it doesn't do the geometry work.  The output from OpenSCAD
execution is a list of objects, transformations, and boolean operations,
and OpenCSG and CGAL are the ones that do the geometry work.

If you look at Design > Display CSG Tree, I think that's the output from
the execution phase.

Maybe, after rendering, there could be a view of that tree that includes
bounding box information.  You couldn't use it as part of the execution
of the program, but you could copy and paste it.

On 7/11/2019 11:00 AM, lar3ry wrote: > I see that many folks have asked for a way to find and use a bounding > box in OpenSCAD, and I wonder if it will ever be implemented. Perversely, I don't think OpenSCAD itself *knows* the bounding box, because it doesn't do the geometry work.  The output from OpenSCAD execution is a list of objects, transformations, and boolean operations, and OpenCSG and CGAL are the ones that do the geometry work. If you look at Design > Display CSG Tree, I think that's the output from the execution phase. Maybe, after rendering, there could be a view of that tree that includes bounding box information.  You couldn't use it as part of the execution of the program, but you could copy and paste it.
JB
Jordan Brown
Thu, Jul 11, 2019 6:30 PM

I should note that I have no actual knowledge of the internals.  If my
mental model is wrong, I'd appreciate it if somebody who knows more were
to correct me.

I should note that I have no actual knowledge of the internals.  If my mental model is wrong, I'd appreciate it if somebody who knows more were to correct me.
G
GZ
Thu, Jul 11, 2019 9:01 PM

relativity.scad library does alignments

On 7/11/19, Jordan Brown openscad@jordan.maileater.net wrote:

I should note that I have no actual knowledge of the internals.  If my
mental model is wrong, I'd appreciate it if somebody who knows more were
to correct me.

relativity.scad library does alignments On 7/11/19, Jordan Brown <openscad@jordan.maileater.net> wrote: > I should note that I have no actual knowledge of the internals.  If my > mental model is wrong, I'd appreciate it if somebody who knows more were > to correct me. > >
JB
Jordan Brown
Thu, Jul 11, 2019 9:55 PM

On 7/11/2019 2:01 PM, GZ wrote:

relativity.scad library does alignments

Aligning objects a priori is not hard.  What's not possible is taking
some arbitrary object and determining its geometry after it's been
constructed.

That is:

cylinder(h=10, d=2);
translate([-1,-1,10]) cube(2);

will more or less reliably give you a cube atop a cylinder.  However, if
you then

module foo() {
	rotate([45,0,0]) {
		cylinder(h=10, d=2);
		translate([-1,-1,10]) cube(2);
	}
}

there's no way to perch something on top of the resulting foo() without
doing math.

I'm too lazy right now to do the math, but experimentation says it's at
about [ 0, -7.8, 9.2 ].  There's no way to get that value out of
OpenSCAD, or to get the foo's bounding box.

Relativity helps you to construct a model with specified alignment, but
does it at the front of the pipeline.  You can't give it an arbitrary
existing object like foo() above and expect it to be able to align
additional objects relative to it.  Relativity can only work because it
knows the geometry of the objects it's putting together.

On 7/11/2019 2:01 PM, GZ wrote: > relativity.scad library does alignments Aligning objects a priori is not hard.  What's not possible is taking some arbitrary object and determining its geometry after it's been constructed. That is: cylinder(h=10, d=2); translate([-1,-1,10]) cube(2); will more or less reliably give you a cube atop a cylinder.  However, if you then module foo() { rotate([45,0,0]) { cylinder(h=10, d=2); translate([-1,-1,10]) cube(2); } } there's no way to perch something on top of the resulting foo() without doing math. I'm too lazy right now to do the math, but experimentation says it's at about [ 0, -7.8, 9.2 ].  There's no way to get that value out of OpenSCAD, or to get the foo's bounding box. Relativity helps you to construct a model with specified alignment, but does it at the front of the pipeline.  You can't give it an arbitrary existing object like foo() above and expect it to be able to align additional objects relative to it.  Relativity can only work because it _knows_ the geometry of the objects it's putting together.