aligning/flooring all objects

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

aligning/flooring all objects

bboett
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

acwest
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, <[hidden email]> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

lostapathy
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, <[hidden email]> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

acwest
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, <[hidden email]> 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, <[hidden email]> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

lar3ry
In reply to this post by bboett
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

lar3ry
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

JordanBrown
In reply to this post by lar3ry
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.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

JordanBrown
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.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

tobject
relativity.scad library does alignments

On 7/11/19, Jordan Brown <[hidden email]> 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.
>
>

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

JordanBrown
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.



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

Troberg
In reply to this post by lostapathy
lostapathy wrote
> 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).

This also has the added benefit of being more modular. It's easier to reuse
components if they have a sensible origin. Say, for example, that I model a
bolt. I then put it at the origin, wigh the XY plane just below the head,
oriented along the Z. This makes a lot more sense when I want to use that
bolt in some other design.



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

nophead
Yes make the origin the most useful point but if there are other points of interest, for example screw holes, than I make a module that moves its children there and use it to make the holes both in the object, and what it mounts to and place the screws. So I never need to calculate positions. It is simply a combination of modules. E.g.

motor_position() {
   motor();
   motor_screw_positions()
     screw(motor_screw(), 10);
}

Similarly I have functions to get the important dimensions of each object, so I know its bounding box allowing me to place it in an assembly and design other things round it.

The rule is never specify anything twice. Always factor it into a function, module, or variable and define it once and re-use it.

On Fri, 12 Jul 2019 at 07:45, Troberg <[hidden email]> wrote:
lostapathy wrote
> 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).

This also has the added benefit of being more modular. It's easier to reuse
components if they have a sensible origin. Say, for example, that I model a
bolt. I then put it at the origin, wigh the XY plane just below the head,
oriented along the Z. This makes a lot more sense when I want to use that
bolt in some other design.



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

cacb
In reply to this post by lar3ry
On 2019-07-11 20:00, 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. 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().

It is a handy feature, standard in AngelCAD, where any shape can return
a bounding box
https://arnholm.github.io/angelcad-docs/docs/classshape.html#a9511e310496d8d70c26cf0c4b59b0200
https://arnholm.github.io/angelcad-docs/docs/classboundingbox.html

Carsten Arnholm


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: aligning/flooring all objects

nophead
Bounding box isn't implemented in OpenSCAD because geometry is not calculated for the preview, so it isn't available until you do F6. Not only that but all expressions are evaluated before the geometry is created. That is why you can never query the geometry, you can only specify it.

On Fri, 12 Jul 2019 at 09:47, <[hidden email]> wrote:
On 2019-07-11 20:00, 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. 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().

It is a handy feature, standard in AngelCAD, where any shape can return
a bounding box
https://arnholm.github.io/angelcad-docs/docs/classshape.html#a9511e310496d8d70c26cf0c4b59b0200
https://arnholm.github.io/angelcad-docs/docs/classboundingbox.html

Carsten Arnholm


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org