Constraining a components range of motion

Hi!

I’m relatively proficient with SU and am now dipping into dynamic components. I’ve had some success with constricting (sub-)components to certain axes of motion and I’ve done some basic onclick actions similar to opening and closing a door.

I’m really stuck with this: I’d like to contrain a subcomponent’s motion to a certain range. Like a drawer that should be able to be opened or closed but never ‘fall’ out of the cabinet or close farther than the ‘closed’ position.

I did find this in the Help section:


Snapping to a smallest or largest size

Place the following formula in the LenX field for a component to snap the component’s LenX to 20 inches wide when a scale operation scales the component beyond 20 inches:

LenX =SMALLEST(CURRENT(“LenX”),20)

Place the following formula in the LenX field for a component to snap the component’s LenX to 10 inches wide when a scale operation scales the component below 10 inches:

LenX =LARGEST(CURRENT(“LenX”),10)

These formulas are useful for components that represent items that must not be smaller than or larger than a specific size.

… but I feel I need a combination of both LARGEST and SMALLEST…

Can anybody shed some light on this?

Thanks!
Andrew

LenX”, “LenY” and “LenZ” are the attributes that represent the scaling part of a component’s transformation.

RotX”, “RotY” and “RotZ” are the attributes that represent the rotaional part of a component’s transformation.

X”, “Y” and “Z” are the attributes that represent the tranistional part of a component’s transformation.

For a sub-component the transformation is relative to it’s parent’s origin.

So for a horizontal positional constraint, I’d think, you’d be restricting the “X” or “Y” attribute values.

You can use hidden range type of attributes if it makes your “OnClick” formulas more readable.

Hi Dan,

Thank you for your response. I do understand the Len Rot and other designators.

I’ve managed to constrain X and Z so that the component can only be moved along the Y axis. Now, I want to constrain the component’s motion within a given range along the Y axis … so allow it to be moved from it’s origin +12 mm and -4 mm … no further.

Is that possible?

Best regards,
Andrew