Reload component script - anyone have one
-
Thanks Dan,
I hadn't noticed that behaviour before. Initially being only interested in getting a couple of components into the model it wasn't an issue and I would always have the proxies in the model to check that the swap worked ok.
Looking at this again it looks like the components are all loaded into the file in turn. When I repeat ThomThom's text as below only Comp4 gets deleted if not required to replace comp3 (being the last to be loaded). Comp2 get left behind.newDef = model.definitions.load("J:/Comp2.skp")
oldDef = model.definitions['Comp1']
oldDef.instances.each{|old_inst|old_inst.definition=newDef
t = old_inst.transformation
ents = old_inst.parent.entities
ents.add_instance(newDef, t)
old_inst.erase!
}
newDef = model.definitions.load("J:/Comp4.skp")
oldDef = model.definitions['Comp3']
oldDef.instances.each{|old_inst|old_inst.definition=newDef
t = old_inst.transformation
ents = old_inst.parent.entities
ents.add_instance(newDef, t)
old_inst.erase!
}
Advertisement