Option to select sub-component type
-
Sorry if this has been covered elsewhere, but does anyone know if it is possible to define a component which selects one of a number of sub-components, depending upon user input?
I have created a DC of a prefabricated floor slab unit (Bison floor beams), which creates a horizontal array when the DC is stretched.
I would like to be able to configure it so that either:-
a.) There is an input box to select the slab thickness, which in turn chooses which component to insert and array
b.) Takes the span, and based on a formula (derived from manufacturer's load/span tables) automatically chooses the sub-component which corresponds to the appropriate slab thickness, and arrays it
I would prefer the second, but first of all I need to be able to use input to select a particular component to use. I could of course scale the component in the z axis, but not all the components have the same profile, and I would like to be accurate if possible!
I'm sure I have seen something mentioned about selecting components somewhere, but can't find anything now. Anyone have any ideas, information or suggestions?
-
bigstick,
The technique that I've seen is to include all of your variations as subcomponents, and then use the "hidden" attribute to hide all but the one you want to show.
For example, if you have an attribute at the parent level called "panelType" that contains either a 1, 2, or 3, then your 3 subcomponents could have a formula to decide which is hidden.
Tile1:
hidden= parent!panelType<>1Tile2:
hidden= parent!panelType<>2Tile3:
hidden= parent!panelType<>3At any given time, only one of the 3 tiles will be shown.
Hope I understood the question! Let us know if you have more.
Cheers,
-
Yup, that is how I have approached that same scenario! Though Scott's is written much cleaner than mine ever ise
Chris
-
Cool - thanks guys! I'll try this, sounds easy enough to add an 'if..' statement to determine which flag to set for component selection. Would it be okay to upload the component here if I need a little help with the syntax?
-
Here is the component - kind of complete. I have a slight issue where I would like the user to be able to select between typical office loading and maximum loading. I have configured a dropdown list for this, but I would like to be able to activate it with the onclick function. I could add attributes for each loading and select between them with a combobox I guess, but I'm too lazy to do that.
The component uses an approximate calculation for the span. The load/span tables are here (http://www.bison.co.uk/products.aspx?ID=12).
I needed to select a particular beam depth based on the span, and didn't want to have too many complex nested if statements, so I calculated an approximate span to beam depth ratio and divided the overall span by it to give me an index for selecting the beam type. It seems to work pretty well so far.
Comments and observations gratefully accepted before I upload to 3DWH. I don't want to upload for general use unless I'm confident I have configured it as efficiently as possible. Feel free to modify the component if you wish.
-
Looks good so far. I did notice a few things though.
There are a few extra lines lying around. 2 inside the main component, then 1 inside the board component. Maybe more I didn't see, but those stuck out at me.
When I scale to me them longer, they jump and resize incorrectly. If its on typical span, then they shrink down to really small.
Good luck, they look great!
Chris
Advertisement