Groups and components

I appreciate the input as I am sure other people will as well. I am finding the people in the Sketchup community very helpful. Thanks again.

Hi Dave. I watch a bit of a video and it explains exactly some of the problems I am having. It is very helpful thanks again.

1 Like

Do you know a programmatic way to create a Group, assign glue-to to its ComponentDefinitionā€™s Behavior and then place an instance in the model such that the glue-to takes effect? I canā€™t make this work, so Iā€™d be interested in seeing how. Using Ruby I created a Group, set the glue-to Behavior on its CD, then added an instance to the modelā€™s Entities with a Transformation that placed it on an existing rectangle. It placed at the desired location, but was not glued.

In the GUI, behaviors take effect only as you place new instances of the CD, either by pulling them from the Components window or copying an existing glued instance, but you canā€™t do either of those for a Group. If you canā€™t do it using Ruby either, then setting the values on the Groupā€™s CDā€™s Behavior is of purely academic interest!

Note that a Groupā€™s ComponentDefinition has a flag set, queried via the group? method, that indicates this CD is for a Group. As a result it isnā€™t necessary that the CDā€™s for Groups behave the same way as those for ComponentInstances. The GUI already uses this flag to ignore Groups in the Components window.

This also works in a purely programming sense, but since as you note it shows nowhere in the GUI it is of value only within your own coding context.

Iā€™m not really all that familiar with DCā€™s in general. It seems that I was a bit too tired last night/this morning, and confused the definition and instance documentation. Gluing is only in the ComponentInstance classā€¦ I donā€™t know where I saw it in the Behavior or Group classā€¦ obviously Iā€™m insane, or I am currently blind. Either way, I havenā€™t had a need to do any of this, I just always assumed it was possible based on what I had casually seen while flipping through the docs in search of unrelated information.

I tried to get cuts_opening to work, but I couldnā€™t get it to work for the ComponentInstance eitherā€¦ Didnā€™t try to hard, but I might give it a try later on when I have some free time. I had recently been playing around with the topic, but Iā€™m not really familiar with utilizing any of the extra features that are available with DCā€™s or just regular olā€™ component instances. I havenā€™t had many requests to programmatically create/modify geometry in the scene. Iā€™m typically just analyzing the existing scene as it is.

My apologizes for posting incorrect and confusing statements in the middle of the night! :grimacing:

Not a problem, I was just seeking edification if there is a way. I like to learn :grinning:

Incidentally, I was using ā€œCDā€ as an abbreviation for ā€œComponentDefinitionā€. Since you wrote ā€œDCā€, which is commonly used as an abbreviation for ā€œDynamic Componentā€ I hope you didnā€™t think that was what I meant!

I confuse myself, no assistance necessary :wink:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.