I am building out a new dynamic component in SketchUp. This is the first time I’ve really jumped into DCs, but I have a use case for which I hope there is a solution:
In my component, I have to generate a basic shape with variable dimensions. The dimensions correspond with a given selection from a drop-down list of product names.
What I hope to accomplish is this:
User selects item from drop down
SketchUp looks at the item and finds the corresponding dimensions in a table or list
SketchUp then sets the LenX, LenY, and LenZ dimensions for the sub-component (or any other attributes)
The table or list is easily editable to add in new products as they are added to our catalog.
Perhaps? Any chance you have a reference model for this that I could look at? Not being familiar with the extension described in that post, nor all too familiar with dynamic components, I am struggling to see how to make it work.
The formula for the subcomponent’s LenX would use a DC CHOOSE function that references the choice made in the select list.
Let us say that the attribute for the choice is named “product”.
The attribute “product” is chosen by the user.
The OPTIONINDEX function converts that choice into an integer index to be used by other attribute formulae.
The LenX attributes formula might be: =CHOOSE(OPTIONINDEX("product"), 36, 30, 24)
The other dimensional attributes can follow the same pattern.
Now if you are in a child component and the “product” attribute is in the parent, then:
The LenX attributes formula might be: =CHOOSE(OPTIONINDEX("parent!product"), 36, 30, 24)
I would suggest you download and examine any of the Marvin Window DCs from the warehouse.
Also install an Attribute Inspector plugin like the one by Aerilius.
I think this is exactly what I was looking for! My next question is: any guess why =optionindex("Parent!Selection") would return -1? Trying the formula you described above yielded a response of [-1 is out of range] from SketchUp.