• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Reload component script - anyone have one

Scheduled Pinned Locked Moved Developers' Forum
21 Posts 13 Posters 3.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    BigAl
    last edited by 16 Aug 2013, 18:05

    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!
    }

    1 Reply Last reply Reply Quote 0
    • 1
    • 2
    • 2 / 2
    2 / 2
    • First post
      21/21
      Last post
    Buy SketchPlus
    Buy SUbD
    Buy WrapR
    Buy eBook
    Buy Modelur
    Buy Vertex Tools
    Buy SketchCuisine
    Buy FormFonts

    Advertisement