Check if a dc is a child component?

I’m trying to abuse dynamic components in order to create parametric parts. I have modeled a fully parametric bookcase which works acceptably by placing the parameters in the parent and then calculating child positions and sizes based on the parent. However I would like to possibly create a number of components that can work together. For example to create a parametric bookcase span component that uses the parametric bookcase I’ve already created.

It would be useful if there was a way for me to check if my bookcase was a child of another component and change its behavior accordingly. If it is a child component use a calculated Z,Y,Z,lenX,lenY,lenZ otherwise use the data supplied by the user in the component options. Is something like this possible?

yes this is possible
with the contained object, first use parent! instead of the component name and second, double wrap the component so as to protect the x,y,z,lenx,leny,lenz for the insert or swap procedure (as the first level x,y,z…otherwise they are overwritten). Then, third pass the data though a common attribute that references the container group to the object(s) concerned Then use outliner to open the container access and edit or place the components with ease

consider the example container, after saving the triangle and cubic components in a folder of choice. you swap and place and they over ride the normal one shell component placement and lack of size changes

cubic.skp (24.9 KB)
triangle.skp (20.6 KB)
container.skp (32.9 KB)

I don’t think this solves my problem? I want to for example be able to use your triangle or cube component alone, or as part of a larger construction. So if I just place triangle into the model the thick paramater would be an editable attribute and the user could place it wherever they like. Otherwise if I put it inside another component I want it to compute the thick, x_pos and y_pos based on parameters in the parent component.

For instance in my parametric bookcase I have a parametric shelf. When the size of the bookcase changes the size or the thickness of the material it will be constructed with changes, the size and position of the shelf change to compensate. However a shelf that goes into a bookcase and a shelf you would hang on the wall or a shelf in a cabinet are essentially the same part. If I just needed to put a shelf on a wall I don’t want to have to create a dummy component just to pass through a few options, when I could just do something like:


This is an important distinction because I will have potentially a large number of parts like this, if I need to wrap 300 parts in dummy dc wrappers I’m going to be spending weeks just doing that.

Currently, there is no way of trapping and dealing with errors just using DCs, so, as you know, if an attribute fails the DC freezes. One would need to create a ruby script to insert a modified version of your DC to suit its environment, or as mentioned create the environment to suit the component.

so if(exist,Parent!datafield,datafield) would fail because Parent!datafield returns an error if there is no parent, regardless of the boolean " exist".

I basically knew this response was coming, but I had really hoped someone would know a crazy trick that could help. I had briefly considered writing a true parametric extension but quickly dismissed the idea as being unrealistic.

It sure would be great though…