[OpenSCAD] Is it possible to obtain the current transformation?

Hans L thehans at gmail.com
Mon Sep 24 23:31:04 EDT 2018


It don't think it really makes sense with the way that OpenSCAD works
to need or even be able to use this information.  If you assigned the
current transformation in some code block to a variable, that variable
is scoped to that block, so what are you going to do with it that you
couldn't do by just inserting some geometry directly into that block
to give it the same transformation?

Also keep in mind you can always add a call to children(); from within
a user-defined module to apply some transformation to "TBD"
later-inserted geometries.

Here is a basic example:

```
$fs = 0.5;
$fa = 0.2;
pole_d = 2;
pole_h = 100;

module pole(d,h) {
  cylinder(d=d,h=h);

  translate([0,0,h]) // put children at top
    children();
}

module flagpole_tip(d) {
  sphere(d=d);
}


// pole module can automatically position children
pole(pole_d, pole_h) {
  flagpole_tip(pole_d*2);
}

// translate the pole along X and children follow
translate([0,50,0]) pole(pole_d, pole_h)
  flagpole_tip(pole_d*2);

```

lobrien, Do you have an example of a script where you think having
this data would help?  There's probably an alternate way of looking at
it that doesn't require "knowing" the transformation like that.
On Mon, Sep 24, 2018 at 4:09 PM lobrien <lobrien at knowing.net> wrote:
>
> bump
>
> It would help when refactoring complex objects.
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



More information about the Discuss mailing list