Dynamically Changing Display Rules In Dynamic Componetnts Options Window

Is there a way to change the Display Rule of one field in the Dynamic Components Options Window depending on which option is selected in another field? Example, I have a drawer cabinet face frame that I want to give the user the option of making it a three drawer or a four drawer cabinet. If the user selects 4 drawer, I want to give them the option of changing the height of the first three drawers and the fourth gets calculated from what’s left and is displayed in a read only field. If the user selects 3 drawer, I want to change the display rule of drawer 3 from a editable field to a read only field like drawer 4. Is this possible or am I going to have to live with a less than perfect interface?

Sorry but can not.
This among others would be an ideal improvement. It would be great if they improved and used the native code for use in pro.(some 8 years without any but minor fixes)
The emphasis is becoming apparent that LCs will have priority.

You could use one input with commas or some other delimiter between sizes where the last is calculated

125,125,250 would be four with last being 750-500 = 250

if you upload your DC can show other wise (pm if sensitive)
use pos1=find(",“draw & “,0,0,0,”, 1),pos2=find(”,"draw & “,0,0,0,”, pos1+1) to get each position then use mid(draw, pos1,pos2-1) etc
the extra “,0,0,0,” is stop the error if input is just one item, will need a bit to filter the extra unknown user input

LC’s? what are they ? :slight_smile:

Live Components

Latest SketchUp Labs/Live Components Discussion topics - SketchUp Community

they are still in the process of building the authorising tools

ohh I remember them… introduced 3 years ago I think ? intended to replace Dynamic Components if I recall…

1 Like

Dynamic Drawer Face Frame.skp (40.8 KB)
Here’s the file. I’m not sure I follow your explanation about input with commas, etc.

this is the code to cover 10 drawer sizes. the actual main working is a hidden element that can be use as a swatch or if placed deeper a descale.

Dynamic Drawer Face Frame.skp (57.7 KB)

used a - minus sign as text in stead of a comma, but the delimiter can be changed to another, a letter, something convenient near the number pad
(edit spell check)

So can saveas and place in another, just make sure there is a drawer attribute before referencing another attribute with a simple value, otherwise it slows things down as the errors are processed

Your code seems to work for what I need but its syntax and logic flow are beyond me. I haven’t been able to find any comprehensive training on DC coding. The Sketchup website offerings barely scratch the surface.

It would be good if DCs had an overhaul, extra or amended formula
like for Find(), had an option to return a value instead of an error on fail. Or in this case a new one: Get() would be Get(from_string, delimiter, position, option on fail)
Or better still, improvements including as you suggested, dynamic forms.
However…
I assume you have checked

and the warehouse examples

So find() currently returns -1, an error if it fails to find, so by adding some extras can stop the error, but then you may need to compare string lengths to determine if its in the range. In this case we do not need to, by adding 0 as well, we get a range that suits our purpose.

Mid() as its name implies gets the range between two points in a text. find() gets those points for the delimiter in question.

By placing this repetitive code in a useable component then it can be reused (check unique?) just make sure the reference exists in the new parent

Some short cuts in the formula
if(x>0,then,or this) is same as if(x,then,or this) as true is >0, false<=0
choose(copy+1,V0,V1,V2,Vn) same as current(“V” & copy) however for copy=0, it does not work, so used if(copy,current(“V” & copy),V0), perhaps a bug???

On DC design, I suggest you create DCs that employ the instance method and then can use one DC to cover any Square cut, design with length up, rotate for rails, this assures that the grain follows the same way, The instance name can be changed at any time, the report, headers all up date, provided you do not use Name or change the attribute header.

Dynamic Drawer Face Frame.skp (113.3 KB)

Attached is the stile and rail frame with just one DC as the principle element.