discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Centering for import

J
jpmendes
Sat, Apr 2, 2016 4:05 PM

I agree partially. KisSlicer for instance does it automatically. The pro
version allows to export the STLs centered and sometimes I use this feature.
However one can export the STLs having in mind, for future use, their
original locations. Imagine that you want to export some objects and then
import them for processing speed reasons. Maybe this is not a good practice
but is possible to occur. Backward compatibility is an issue. So my proposal
would be to create an import option like the one already available for cubes
an cylinders "center=true". Calculating calculating the center of an
irregular object may not be trivial, and probably in the end we will need to
perform some translations and rotations on it to fulfill our initial
conditions. Although handy,  I think this may be not a priority feature.

jpmendes

--
View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16906.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I agree partially. KisSlicer for instance does it automatically. The pro version allows to export the STLs centered and sometimes I use this feature. However one can export the STLs having in mind, for future use, their original locations. Imagine that you want to export some objects and then import them for processing speed reasons. Maybe this is not a good practice but is possible to occur. Backward compatibility is an issue. So my proposal would be to create an import option like the one already available for cubes an cylinders "center=true". Calculating calculating the center of an irregular object may not be trivial, and probably in the end we will need to perform some translations and rotations on it to fulfill our initial conditions. Although handy, I think this may be not a priority feature. jpmendes -- View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16906.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Sat, Apr 2, 2016 6:44 PM

There is an old feature request that discusses adding a centre= option to
import():
https://github.com/openscad/openscad/issues/586

There is a new feature request under construction for a more general
align() operator:
https://github.com/openscad/openscad/issues/1610

For example,
align("centre") import("foo.scad")
will centre the model on all axes, like a sphere.

align(x="centre", y="centre", z="above") import()

will centre on the X and Y axes, above Z=0, like a cylinder.

align("above") import()

will place the model in the +X,+Y,+Z octant, like a cube.

The centre is considered to be the centre of the bounding box: no fancy
heuristics.

Doug.

On Saturday, 2 April 2016, jpmendes jpmendes54@gmail.com wrote:

I agree partially. KisSlicer for instance does it automatically. The pro
version allows to export the STLs centered and sometimes I use this
feature.
However one can export the STLs having in mind, for future use, their
original locations. Imagine that you want to export some objects and then
import them for processing speed reasons. Maybe this is not a good practice
but is possible to occur. Backward compatibility is an issue. So my
proposal
would be to create an import option like the one already available for
cubes
an cylinders "center=true". Calculating calculating the center of an
irregular object may not be trivial, and probably in the end we will need
to
perform some translations and rotations on it to fulfill our initial
conditions. Although handy,  I think this may be not a priority feature.

jpmendes

--
View this message in context:
http://forum.openscad.org/Centering-for-import-tp16901p16906.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

There is an old feature request that discusses adding a centre= option to import(): https://github.com/openscad/openscad/issues/586 There is a new feature request under construction for a more general align() operator: https://github.com/openscad/openscad/issues/1610 For example, align("centre") import("foo.scad") will centre the model on all axes, like a sphere. align(x="centre", y="centre", z="above") import() will centre on the X and Y axes, above Z=0, like a cylinder. align("above") import() will place the model in the +X,+Y,+Z octant, like a cube. The centre is considered to be the centre of the bounding box: no fancy heuristics. Doug. On Saturday, 2 April 2016, jpmendes <jpmendes54@gmail.com> wrote: > I agree partially. KisSlicer for instance does it automatically. The pro > version allows to export the STLs centered and sometimes I use this > feature. > However one can export the STLs having in mind, for future use, their > original locations. Imagine that you want to export some objects and then > import them for processing speed reasons. Maybe this is not a good practice > but is possible to occur. Backward compatibility is an issue. So my > proposal > would be to create an import option like the one already available for > cubes > an cylinders "center=true". Calculating calculating the center of an > irregular object may not be trivial, and probably in the end we will need > to > perform some translations and rotations on it to fulfill our initial > conditions. Although handy, I think this may be not a priority feature. > > jpmendes > > > > > -- > View this message in context: > http://forum.openscad.org/Centering-for-import-tp16901p16906.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <javascript:;> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
P
Parkinbot
Sun, Apr 3, 2016 2:59 AM

It might be also a good idea to automatically fit it into a given
boundingbox. This would be as good as querying the size (which is currently
not possible for fomal reasons).

align(x=100, y=100, z=100, center = true) import();

--
View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16921.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

It might be also a good idea to automatically fit it into a given boundingbox. This would be as good as querying the size (which is currently not possible for fomal reasons). > align(x=100, y=100, z=100, center = true) import(); -- View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16921.html Sent from the OpenSCAD mailing list archive at Nabble.com.
AP
Andrew Plumb
Sun, Apr 3, 2016 3:37 AM

See the existing ‘resize()’ operator:

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize

Very handy for things like fitting a piece of text() to a given x-size, independent of ‘size=10’ parameter value, for example:

resize([20,0,0],auto=[true,true,false]) linear_extrude(height=1) text("Hello, World!",halign="center",valign="center");
#cube([20,4,1],center=true);

…which amusingly enough highlights a case where align() would be useful. The “centered” text appears to be shifted slightly to the left, as it doesn’t overlap the 20x4x1 cube exactly at the x=[-10,10] bounds.  (Mac OSX build version 2016.03.26 (git 8308bd7))

Andrew.

On Apr 2, 2016, at 10:59 PM, Parkinbot rudolf@parkinbot.com wrote:

It might be also a good idea to automatically fit it into a given
boundingbox. This would be as good as querying the size (which is currently
not possible for fomal reasons).

align(x=100, y=100, z=100, center = true) import();

--
View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16921.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/ http://clothbot.com/wiki/

See the existing ‘resize()’ operator: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize> Very handy for things like fitting a piece of text() to a given x-size, independent of ‘size=10’ parameter value, for example: resize([20,0,0],auto=[true,true,false]) linear_extrude(height=1) text("Hello, World!",halign="center",valign="center"); #cube([20,4,1],center=true); …which amusingly enough highlights a case where align() would be useful. The “centered” text appears to be shifted slightly to the left, as it doesn’t overlap the 20x4x1 cube exactly at the x=[-10,10] bounds. (Mac OSX build version 2016.03.26 (git 8308bd7)) Andrew. > On Apr 2, 2016, at 10:59 PM, Parkinbot <rudolf@parkinbot.com> wrote: > > It might be also a good idea to automatically fit it into a given > boundingbox. This would be as good as querying the size (which is currently > not possible for fomal reasons). > > >> align(x=100, y=100, z=100, center = true) import(); > > > > > > > -- > View this message in context: http://forum.openscad.org/Centering-for-import-tp16901p16921.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- "The future is already here. It's just not very evenly distributed" -- William Gibson Me: http://clothbot.com/wiki/ <http://clothbot.com/wiki/>