# Using either scale function or user input to set LenXYZ

**URL:** <https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167>\
**Category:** Dynamic Components\
**Created:** [June 15, 2015, 6:27pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167 "2015-06-15T18:27:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 15, 2015, 6:27pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/1 "2015-06-15T18:27:50Z")

</div>

Is there a way to use either an input value or the scale tool to set the Len value of a DC?

So the problem is that if you are needing to set values for attributes XYZ or LenXYZ and particularly if you need to use a formula to do that but you do not want them to be fixed.

For example: sometimes the X position needs to be defined based on user input but you still want the user to be able to move the object without it snapping back to the defined X position.

… Or be able to scale it without snapping back to the defined LenX

The answer as best as I was able to determine is that any components that need those attributes fixed should be placed as a sub component where the parent has floating values

It is also possible to make the XYZ or LenXYZ user editable by using the visible option window but you can not make it equal some other variable -for example var =5 LenX =var+2 would lock LenX to 7

But if LenX was user editable it would work as the primary parent

---

<div class="post-metadata">

**Author:** ![quantj](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/quantj/32/3693_2.png) [@quantj](https://forums.sketchup.com/u/quantj)\
**Post date:** [June 15, 2015, 6:51pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/2 "2015-06-15T18:51:31Z")

</div>

So for example, you want to scale a table, and after everything inside will move/scale automatically?  
-You can have all your nest components to related to the Parent!LenX, no?

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 15, 2015, 7:45pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/3 "2015-06-15T19:45:45Z")

</div>

For example:  
If I have a table that has a lenX scale handle  
and also has a variable length which can be set by user  
the legs are a separate component and move in relation to LenX either way

If LenX=userinputvalue  
then LenX seems to be locked to that value and the scale tool will not function.

It seems like somehow lenX needs to be a floating value.

Here is the DC:  
[2x4 Interior Wall Group.skp](https://forums.sketchup.com/uploads/short-url/4JyOeZckvFDRk2RL3rPPNCA2SjX.skp) (28.9 KB)

I tried here to use Current() but have not got it too work.

It looks like if the userinput value is set to blank then the scale tool will work.  
This would require the user to delete the userinputvalue before scaling though.

---

<div class="post-metadata">

**Author:** ![quantj](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/quantj/32/3693_2.png) [@quantj](https://forums.sketchup.com/u/quantj)\
**Post date:** [June 15, 2015, 8:01pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/4 "2015-06-15T20:01:26Z")

</div>

Hmm, I’ve never tried Current() with scaling.  
I have this: [DC-Curtain.skp](https://forums.sketchup.com/uploads/short-url/7UpmCXULMo778TJLDF1YVbCbcfR.skp) (1.7 MB)  
it’s not exactly the same as your issue, but maybe bits of it will help. I used Current () to lock Z, and have options to LenX and Scaling will modify LenX as well.  
i remember current being an issue for me well, I think making a new attribute for Current and another attribute to link to it worked.

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 15, 2015, 8:09pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/5 "2015-06-15T20:09:07Z")

</div>

Excellent thank you very much,

Yes the curtain height has an input value and can also be scaled  
-it looks like I just need to move the input box to the LenX attribute.

…yes that worked.

thanks

Here is the corrected DC:  
[2x4 Interior Wall Group.skp](https://forums.sketchup.com/uploads/short-url/aW4889CLfNwf7ouVWc3HUqX2bA6.skp) (30.7 KB)

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 16, 2015, 9:02pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/6 "2015-06-16T21:02:59Z")

</div>

I have a similar problem with my Interior Door DC.

I added the ability to flip the door side but did not realize that it locks the axis and position.

The problem here is that in order to flip the door I have to determine the current rotz and add 180 to it  
Then I tried to reverse that by taking the current rotz and subtracting 180

So I made a list box that has two selections:  
Flip Door?  
Yes =current(“RotZ”)+180  
No =current(“RotZ”)-180

But this crashes SU  
if I just make RotZ =current(“RotZ”)+180 though it works

so it seems like SU does not like the formula in a list box.

The other problem with using the list box is that in order to flip in place -I need to change the X and Y positions also.

So three attributes need to be changed with one list selection.  
I could for example let the user enter the rotZ value but I see no way I could flag that and make X or Y change

I do not see a way of doing that.

[DoorSet1.skp](https://forums.sketchup.com/uploads/short-url/yGB2TLswiXe3mi8SyKTqL0ZvvPd.skp) (515.3 KB)

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 16, 2015, 11:39pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/7 "2015-06-16T23:39:46Z")

</div>

Oh, I see what I am doing wrong.  
-using the equal sign locks the value

so LenX =somevariable

locks LenX

vs

LenX somevariable

leaves it unlocked

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [June 16, 2015, 11:46pm UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/8 "2015-06-16T23:46:17Z")

</div>

> [@ChrisStewart](#):
>
> So I made a list box that has two selections:
> 
> Flip Door?
> 
> - Yes =current(“RotZ”)+180
> - No =current(“RotZ”)-180
> 
> **But this crashes SU**

Crashes ? Do you get a BugSplat! window ? Or the Windows Error Reporter ?

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 17, 2015, 12:01am UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/9 "2015-06-17T00:01:37Z")

</div>

Hmmm, I was wrong about removing the equal sign.

Hi DanRathbun,  
Well SU just hangs as if it is stuck in a loop -I can hit X in the top right corner and force it to stop.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [June 17, 2015, 2:26am UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/10 "2015-06-17T02:26:55Z")

</div>

Well then I’d consider this a DC bug if it hangs.

ping @tt_su

---

<div class="post-metadata">

**Author:** ![ChrisStewart](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/chrisstewart/32/5995_2.png) [@ChrisStewart](https://forums.sketchup.com/u/ChrisStewart)\
**Post date:** [June 17, 2015, 3:41am UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/11 "2015-06-17T03:41:40Z")

</div>

Seems like a reasonable assessment.

Anyway, I might have found the answer.

the top level Parent component can not have fixed values (=) or formulas for XYZ if it is to be moved  
or for LenXYZ if it is to be scaled

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [June 17, 2015, 3:52am UTC](https://forums.sketchup.com/t/using-either-scale-function-or-user-input-to-set-lenxyz/12167/12 "2015-06-17T03:52:07Z")

</div>

Well this scenario needs to be accounted for in the DC code, so no “hang” occurs.
