Thu Oct 3 05:50:00 EDT 2019

```For a complex assembly like a robot arm I would have modules to position
each segment onto the last one. So there would be say
shoulder_upper_arm_position(), upper_arm_forearm_position() and
forearm_wrist_position().

In the arm assembly the hand would be a child of the forearm, placed with
forearm_wrist_position() and the forearm would be a child of the upper arm,
positioned with  upper_arm_forearm_position (), etc.

If I want to say put a ring on a finger it would simply be a matter of
calling the right sequence of positioning modules, no extra maths at all.
something like:

left_shoulder_position()  shoulder_upper_arm_position ()
upper_arm_forearm_position() forearm_wrist_position()
wrist_ring_finger_position()  ...  ring();

The joint positions might be parameters to each positioning module, or
perhaps \$variables.

The position of the ring would be a long chain of transformations but that
is hidden. If I wanted it in X,Y,Z coordinates I would put the maths from
the positioning modules into into functions with the same name. Then the
module version would simply be

module  shoulder_upper_arm_position ()
multmatrix(shoulder_upper_arm_position() ) children();

Then I could call the function versions and multiply the matrices together
to get a transformation matrix the goes from the origin of the robot to the
ring. Mulitpling that by [0, 0, 0, 1] gives the coordinate of the ring.

For stacking washer, my washer and nut modules position their children on
top of themselves. So nut(..) washer(..) nut(..) washer(..)  screw(..)
would build a washer kebab.

On Thu, 3 Oct 2019 at 07:34, Troberg <troberg.anders at gmail.com> wrote:

> > I am of the opinion that if one creates OpenSCAD code in a parametric
> > manner, it is not necessary to query an object. By creating the object in
> > this way, you've "told" OpenSCAD everything that you'd need to know
> later.
>
> Well, it's not strictly necessary, true, but in some cases, it would be
> very
> handy.
>
> Examples:
>
> When things move around a lot. Think of a robot arm, with several bend
> points. Sure, build it part by part and be careful, and you can do it, but
> occasionally (for example if you do an anim), you might want to know where
> the claw is without having to to do all the math.
>
> Say that you are doing a an axle, with bunches of nuts and washers, passing
> through several  other bits. Sure, the math is easy, but if components are
> designed as modules, I need to check out how thick a nut or a washer is,
> instead of just "stack them".
>
> Making rounded/chamfered corners on parts. If you could just query the
> item,
> it would be pretty simple to just get the needed dimensions and
> procedurally
>
>
>
> --