Removing the group after group.to_component
-
The following:
my_def = definitions.add "My Selection" my_inst = @master_group.to_component new_inst = my_def.entities.add_instance(my_inst.definition,my_inst.transformation) my_inst.erase! repeat = false #make true for repeat insert model.place_component my_def, repeat
creates a component from a group. I was unable to find a method that would keep the component, without the group. Do I have to break up the group into its entities by
temp_entities = @master_group.explode
, then create a instance of them by looping through the array, bymy_inst.entities.add_...
for each entity? -
?
group.to_component
does not preserve the original group. -
It doesn't? hmmm.....OK, I'll take a better look at my code to see where I made the group.
-
I just converts the group.
-
Turns out that although my original code appeared to work, it did not properly create my_component. I have corrected the code as noted below:
` my_instance = @master_group.to_component
new_instance = entities.add_instance(my_instance.definition,my_instance.transformation)
my_definition = new_instance.definitionmy_definition.name = my_file_name
my_instance.erase! #although not part of problem,
new_instance.erase! #ended up with stray instances.
repeat = false
model.place_component my_definition, repeat`tt, thanks for helping to point me in the right direction.
-
Stray instance? From to_component?
This should not be - something else must be going on. -
Right again:
my_instance = @master_group.to_component my_definition = my_instance.definition my_definition.name = my_file_name my_instance.erase! repeat = false model.place_component my_definition, repeat
Can I just say that I must have been sleep deprived.
Advertisement