discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Alignment mystery?

S
Serge
Fri, Jun 14, 2019 1:18 AM

Hey folks. Having some alignment issue. AlignRight2() suppose to
produce same result as AlignRight but it does not. Any suggestions?

Thanks in advance

//====
include <relativity/relativity.scad>;

module AlignRight2() {
rod(d=10,h=2, anchor=[-1,0,0])

align([[1,0,0],[1,0,0],[1,0,0]])
rod(d=10,h=2, anchor=[-1,0,0]);

}

module AlignRight() {
rod(d=10,h=2, anchor=[-1,0,0])
align([1,0,0])
rod(d=10,h=2, anchor=[-1,0,0])
align([1,0,0])
rod(d=10,h=2, anchor=[-1,0,0])
align([1,0,0])
rod(d=10,h=2, anchor=[-1,0,0]);

}

AlignRight();

Hey folks. Having some alignment issue. AlignRight2() suppose to produce same result as AlignRight but it does not. Any suggestions? Thanks in advance //==== include <relativity/relativity.scad>; module AlignRight2() { rod(d=10,h=2, anchor=[-1,0,0]) align([[1,0,0],[1,0,0],[1,0,0]]) rod(d=10,h=2, anchor=[-1,0,0]); } module AlignRight() { rod(d=10,h=2, anchor=[-1,0,0]) align([1,0,0]) rod(d=10,h=2, anchor=[-1,0,0]) align([1,0,0]) rod(d=10,h=2, anchor=[-1,0,0]) align([1,0,0]) rod(d=10,h=2, anchor=[-1,0,0]); } AlignRight();
G
grit
Fri, Jun 14, 2019 9:53 PM

Hi tobject!

I think the result is not the same for the two modules due to AlignRight2
manipulates the same object. Try to change AlignRight2 to:

module AlignRight2() {
rod(d=10,h=2, anchor=[-1,0,0])

align([[1,0,0],[4,0,0],[8,0,0]])
rod(d=10,h=2, anchor=[-1,0,0]);

}

and you will see the other rods in a row.

//BR Henrik

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

Hi tobject! I think the result is not the same for the two modules due to AlignRight2 manipulates the same object. Try to change AlignRight2 to: module AlignRight2() { rod(d=10,h=2, anchor=[-1,0,0]) align([[1,0,0],[4,0,0],[8,0,0]]) rod(d=10,h=2, anchor=[-1,0,0]); } and you will see the other rods in a row. //BR Henrik -- Sent from: http://forum.openscad.org/
S
Serge
Sun, Jun 16, 2019 10:19 PM

You are right! I was treating these guys as siblings, in fact they are
generations instead. But your solution uses undocumented feature of
the library (which maybe a bug). Instead, recursion solves the
problem.

module AlignRight3(n) {

if (n>0) {

    rod(d=10,h=2, anchor=[-1,0,0])
    align([1,0,0])
    AlignRight3(n-1);

}
else
{

    rod(d=10,h=2, anchor=[-1,0,0]);

}

}

AlignRight3(3);

On 6/14/19, grit henwist@gmail.com wrote:

Hi tobject!

I think the result is not the same for the two modules due to AlignRight2
manipulates the same object. Try to change AlignRight2 to:

module AlignRight2() {
rod(d=10,h=2, anchor=[-1,0,0])

 align([[1,0,0],[4,0,0],[8,0,0]])
 rod(d=10,h=2, anchor=[-1,0,0]);

}

and you will see the other rods in a row.

//BR Henrik

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


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

You are right! I was treating these guys as siblings, in fact they are generations instead. But your solution uses undocumented feature of the library (which maybe a bug). Instead, recursion solves the problem. module AlignRight3(n) { if (n>0) { rod(d=10,h=2, anchor=[-1,0,0]) align([1,0,0]) AlignRight3(n-1); } else { rod(d=10,h=2, anchor=[-1,0,0]); } } AlignRight3(3); On 6/14/19, grit <henwist@gmail.com> wrote: > Hi tobject! > > I think the result is not the same for the two modules due to AlignRight2 > manipulates the same object. Try to change AlignRight2 to: > > module AlignRight2() { > rod(d=10,h=2, anchor=[-1,0,0]) > > > > align([[1,0,0],[4,0,0],[8,0,0]]) > rod(d=10,h=2, anchor=[-1,0,0]); > > } > > and you will see the other rods in a row. > > //BR Henrik > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >