I had a look around on Google and Sketchup Community first but I couldn’t find any informations regarding my issue, so I’m posting here hoping that someone will have a kind of clue for me
For production pipeline reasons I need to freeze the model groups transformations but, because of multiple copy/paste tasked performed by the design engineers, I’m having multiples groups that are depending on the same definition which gets everything upside down when freezing the transforms.
That leads me to make groups uniques before moving on to transformations freeze which works pretty well BUT unfortunatly dirty things occurs. After making groups uniques, if I run a validity check I get some errors that weren’t there before. Here is an exemple :
Point reference 2 for CDimensionLinear (820208) is not valid
Entity CDimensionLinear (820208) should be erased - done
Point reference 2 for CDimensionLinear (820209) is not valid
Entity CDimensionLinear (820209) should be erased - done
Point reference 2 for CDimensionLinear (820222) is not valid
Entity CDimensionLinear (820222) should be erased - done
Point reference 2 for CDimensionLinear (820228) is not valid
Entity CDimensionLinear (820228) should be erased - done
Sor here are my questions :
Can some tells me what are CDimensionLinear and CText items ?
Why do they have a non persistant entityID (each time I’m reopening the file the ID is different) ?
How can I have a validity check performed without fixing problems to get the entityID and investigate what is going wrong before it would be deleted ?
I found a way to track down the modifications made by the validity check tool and I’m now sure that some Sketchup::DimensionLinear or Sketchup::Text are affected and been deleted.
Does anyone know why making some groups unique may end with corrupted Sketchup::DimensionLinear or Sketchup::Text ? Is there a workaround here ?
Are the dimension and text objects wholly inside (ie, a member of) the group entities before making them unique ?
… or are they part of the group’s parent’s entities collection, and only the text’s arrow point, or one end of the dimension line, is referencing a vertex inside the group before the unique operation ?
Thanks for your feedback,
All the concerned entities are hold by the model entities collection : [341268, 341270, 341271, 341272, 341278].each{|current_id| puts Sketchup.active_model.find_entity_by_id(current_id).parent} Sketchup::Model:0x000000528ee368 Sketchup::Model:0x000000528ee368 Sketchup::Model:0x000000528ee368 Sketchup::Model:0x000000528ee368 Sketchup::Model:0x000000528ee368
All these dimensions and texts are bounds at least on one side to an entity that isn’t unique.
So your comment and my thought are converging toward on the fact (as SU is able to dynamically resize the dimension when you move an entity) that a dmiension/text is linked by some way to the entities/groups it’s bound to.
Do you have some informations regarding that ? I couldn’t find anything in the API to be able to track down a link between a dimension and an entity.
Here are 2 example files that highlight this problem :
1 | One with the groups duplicated using Copy/Past (named CP) or Dragged (named DRAG) sharing definitions. example_non_unique.skp (855.7 KB)
2 | One with the same content but with each group unique implying broken links between groups and dimentions (run the validity check to see it). example_unique.skp (859.0 KB)
The conclusion is that dimensions get dirty when making groups uniques when they are bound to entities that share the same definition. The only thing I’m thinking of right now is detecting an rebuilding the dimensions.
random_classes.each do |e|
single_class_objects = a.grep(e)
if single_class_objects[0].respond_to?(:bounds)
then ents_to_regroup << single_class_objects
end
end
ents_to_regroup.flatten!
Sketchup.active_model.entities.add_group(ents_to_regroup)
end
groups = Sketchup.active_model.entities.grep(Sketchup::Group)
Thanks for the tip, this is a nice approche but unfortunatelly a destructive one. That well works on a simple model like the one I posted as an exemple, but this is more tricky with real models and a global production pipeline behind it.
I’m always unsure of pipeline sides effects when using destructive solutions because everything setted up need to be restore exactly the same (parent, name, attributes dictionaries, materials and so on). So I’ll keep your solution as a backup solution it if I can’t find an another way to makes unique my groups.
But again thanks for this really efficient proposal