Hi,
My first post, so before anything else, hello
A bit of background on my component issue...
I have a model that I have 'inherited' (approximately 130 buildings) that need to be cleaned up - basically lots of unconnected entities, and components with materials applied to the back face etc. I have thrown together a quick and dirty script to fix these issues (I was a little surprised at how easy it was to fix all that; ruby is very nice to use)
Where things have gone a little screwy, is when I try to re-create the individual components.
All my searching keeps pointing me back to the API documentation, which is fine, but I must not be interpreting it correctly, and am now just going round in circles?..
The basic process I am trying to do is:
temp_group = exploded_entities.add_group
adjusted_component = temp_group.to_component
The API docs state that calling the explode method on a ComponentInstancewill return an Entitiesobject. I read this as an Entities container (array?) filled with the individual Entityobjects that make up the building - the Entities container class is the only one with the add_group method!?
Functionally I am able to access the exploded building as expected, as I said above the clean up steps work no worries, what I am finding is that the exploded_entities object is of type Array and as such throws a no method error when calling add_group?
Here is the code in question:
# output working component
puts e.typename + "; " + compname
if exploded_component = e.explode
puts "Exploded into; " + exploded_component.class.to_s
# parse component entities
exploded_component.each do |ce|
...fixing stuff here
end #end do
#re-create component
temp_group = exploded_component.add_group
adj_component = temp_group.to_component
puts "Recreated; " + adj_component.name
puts "Total Faces; " + totalfaces.to_s + ";;Adjusted; " + adjusted.to_s
Here is the console output:
I know it'll be something really simple - it usually is
Thanks in advance