discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] change global coordinate system

T
thehans
Wed, Dec 7, 2016 1:16 AM

I'm assuming you are talking about the common issue that for OpenSCAD "up" is
the Z-axis and in many other modeling programs "up" is Y-axis.

If you need to swap these axes, you can apply this matrix operation to your
model:

multmatrix(m=[[1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]]) {
// your model code here
}

You could also define a module like this as a shorthand:
module swapYZ() { multmatrix(m=[[1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]])
children(); }

swapYZ() {
cube([1,2,3]); // cube example, put your model here
}

--
View this message in context: http://forum.openscad.org/change-global-coordinate-system-tp19487p19498.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I'm assuming you are talking about the common issue that for OpenSCAD "up" is the Z-axis and in many other modeling programs "up" is Y-axis. If you need to swap these axes, you can apply this matrix operation to your model: multmatrix(m=[[1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]]) { // your model code here } You could also define a module like this as a shorthand: module swapYZ() { multmatrix(m=[[1,0,0,0],[0,0,1,0],[0,1,0,0],[0,0,0,1]]) children(); } swapYZ() { cube([1,2,3]); // cube example, put your model here } -- View this message in context: http://forum.openscad.org/change-global-coordinate-system-tp19487p19498.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Wed, Dec 7, 2016 2:47 PM

Um, if swapping the Z for the Y axis is indeed your issue, then I'd suggest a
rotate, not a mirror. Otherwise you will find yourself in the mirror
universe where you're model has a beard. 😜

--
View this message in context: http://forum.openscad.org/change-global-coordinate-system-tp19487p19499.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Um, if swapping the Z for the Y axis is indeed your issue, then I'd suggest a rotate, not a mirror. Otherwise you will find yourself in the mirror universe where you're model has a beard. 😜 -- View this message in context: http://forum.openscad.org/change-global-coordinate-system-tp19487p19499.html Sent from the OpenSCAD mailing list archive at Nabble.com.
HL
Hans L
Wed, Dec 7, 2016 4:58 PM

Ah, yeah you're right adrian.  Sorry for the confusion, I should have
tested that before suggesting it.  I had to go find a program that used
Y-up to convince myself, took me a while to remember but Wings3D is one of
those programs(and free), which I tested in.

If you rotate about X axis -90 degrees before exporting, then the model
should display in the desired orientation once imported into the other
program.

So my revised answer is this instead:

rotate([-90]) {
// your code here.
}

I guess the thing that tripped me up was that OpenSCAD's +Z axis maps to
other program's +Y axis, but OpenSCAD's +Y axis necessarily have to map to
the negative Z axis for it to work in the other coordinate system (both
of which are "right-handed").

On Wed, Dec 7, 2016 at 8:47 AM, adrian adrianh.bsc@gmail.com wrote:

Um, if swapping the Z for the Y axis is indeed your issue, then I'd
suggest a
rotate, not a mirror. Otherwise you will find yourself in the mirror
universe where you're model has a beard. 😜

--
View this message in context: http://forum.openscad.org/
change-global-coordinate-system-tp19487p19499.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

Ah, yeah you're right adrian. Sorry for the confusion, I should have tested that before suggesting it. I had to go find a program that used Y-up to convince myself, took me a while to remember but Wings3D is one of those programs(and free), which I tested in. If you rotate about X axis -90 degrees before exporting, then the model should display in the desired orientation once imported into the other program. So my revised answer is this instead: rotate([-90]) { // your code here. } I guess the thing that tripped me up was that OpenSCAD's +Z axis maps to other program's +Y axis, but OpenSCAD's +Y axis necessarily have to map to the *negative* Z axis for it to work in the other coordinate system (both of which are "right-handed"). On Wed, Dec 7, 2016 at 8:47 AM, adrian <adrianh.bsc@gmail.com> wrote: > Um, if swapping the Z for the Y axis is indeed your issue, then I'd > suggest a > rotate, not a mirror. Otherwise you will find yourself in the mirror > universe where you're model has a beard. 😜 > > > > -- > View this message in context: http://forum.openscad.org/ > change-global-coordinate-system-tp19487p19499.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 >