@bagatelo said:
You could change the code to rename the definition name?
With the code below the definition name is created.
model = Sketchup.active_model ents = model.active_entities groups = ents.grep(Sketchup;;Group) components = ents.grep(Sketchup;;ComponentInstance) num = 0 groups.each do |group| group.name = nil.to_s end groups.each do |group| if group.name == nil.to_s num=0 end groups.each do |g| if group.layer.name == g.layer.name if g.name == nil.to_s num+=1 bytenum = num.to_s.length if bytenum == 1 zeros = "00" end if bytenum == 2 zeros = "0" end if bytenum >= 3 zeros = nil.to_s end g.name = group.layer.name.concat(" - #{zeros}#{num}") end end end end components.each do |component| component.name = nil.to_s end components.each do |component| if component.name == nil.to_s num=0 end components.each do |c| if component.layer.name == c.layer.name if c.name == nil.to_s num+=1 bytenum = num.to_s.length if bytenum == 1 zeros = "00" end if bytenum == 2 zeros = "0" end if bytenum >= 3 zeros = nil.to_s end #c.name = component.layer.name.concat(" - #{zeros}#{num}") c.definition.name = component.layer.name.concat(" - #{zeros}#{num}") end end end end@bagatelo said:
The reason I asked this plugin is because I'm trying to use the plugin "Solid Quantify by TAK2HATA". It's a wonderful plugin, and I need something to easily modify the names of components. Note the attachment files.
Will check it out indeed.