sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Reload component script - anyone have one

    Scheduled Pinned Locked Moved Developers' Forum
    21 Posts 13 Posters 3.1k Views 13 Watching
    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

      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
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement