Dynamic Component length is incorrect after scaling object

To learn about Dynamic Components, I built Yet Another Stair Calculator which is in my Component Playground model. It seems to work fine, but I would appreciate help understanding how scaling is handled.

A custom attribute records the scaled height using the formula =CURRENT(“LenZ”) so I can use it to calculate the number of stair treads. However, the value received is never what I expect after scaling.

For instance, in the model I have a wall with various heights. When I snap the scale tool to 45", I expect a result of 46" because it includes a 1" thick bottom tread located below the lower landing surface. Instead, the gHeightScaled attribute reports 46.366".

Similarly, when I use the scale tool and type the value 40" in the Measurements box, it gets reported as 40.319".

My workaround is direct entry via another attribute.

Can anyone tell me why the DC fails to receive the correct value from the scale tool, and possible a way to correct my component?

Thank you!

Dave

Can you upload the file?
the link opens a viewer, cannot access the DC attribute dialog

Sorry about a noobie mistake. I thought the link was to the file itself. Copy is attached.

I also added a very simple component called Cubes which exhibits the same behavior. Scale it along the X-axis to the right, and more copies of the interior yellow Cube component will be added. But, watch the values of LenX and SizeAsScaled on the outer Cubes component in Component Options. Note that they never match the size of the assembly as measured on-screen with the Tape Measure.

Thank you for your assistance!
Component playground to upload.skp (3.1 MB)

being in Tasmania, allow for sleeps between (time difference)

Cubes:
mainly formula, posts/spaces issue
Stairs:
added value to lenz, based on option chosen to use fix or current for scale

changed actual rise calculation

Component playground to upload.skp (3.2 MB)

2 Likes

Thank you, Philip!

You taught me something very interesting about using the CURRENT function within the formula for the dimension being scaled. I am sure I will find it helpful future projects as well.

Your help is very much appreciated. Thank you again!

Dave

Hi Philip,

I’m recording here some other things you taught me to help other people who might stumble on this issue.

Several things were necessary to make the component scale correctly:

  • You added a zero-thickness edge at the origin to maintain the bounding box.
  • You moved the first tread up one rise so its thickness doesn’t extend below the bounding box.
  • You used formulas that ensure the placed tread copies never extend outside of the bounding box. Appropriate rounding is necessary throughout.

Thank you for teaching me all this!

I’ve uploaded my revised version that cleans up the Component Options dialog, and makes all of the calculations explicit for others who might want to learn from this.

Best to you in all,

Dave
Component playground Philip response.skp (3.2 MB)

1 Like