• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

How to make a model follow with movetool

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 293 Views 2 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.
  • A Offline
    alecchyi
    last edited by 18 Sept 2012, 01:10

    I could add a model in ,and send_action moveTool ,i am a newer in ruby plguin develop about sketchup.
    how to make a model follew with the movetool? thanks very much!

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 18 Sept 2012, 14:10

      Let's assume model=Sketchup.active_model
      If you simply want to add an external SKP as a component use:
      defn = model.definitions.load(path_to_skp)
      where perhaps path_to_skp="C:/users/alecchyi/desktop/MyComponent.skp"
      This will ensure it's now loaded into the model.
      Then name=defn.name - just in case it's been given a different name from what you expected ?
      Then model.place_component(defn, repeat)
      If repeat=false then you get to add one instance of that component - just like the native tool, with 'move' built-in etc.
      If repeat=true then you get to place multiple instances... one after the other...
      If you want to place a component that's already loaded 'by name', then set name="MyComponentsName", then
      defn=model.definitions[name]
      before running the 'place_component' code...
      You can select an instance in code then run the Move tool on it, but that isn't what you asked??

      TIG

      1 Reply Last reply Reply Quote 0
      • A Offline
        alecchyi
        last edited by 23 Sept 2012, 09:13

        @tig said:

        Let's assume model=Sketchup.active_model
        If you simply want to add an external SKP as a component use:
        defn = model.definitions.load(path_to_skp)
        where perhaps path_to_skp="C:/users/alecchyi/desktop/MyComponent.skp"
        This will ensure it's now loaded into the model.
        Then name=defn.name - just in case it's been given a different name from what you expected ?
        Then model.place_component(defn, repeat)
        If repeat=false then you get to add one instance of that component - just like the native tool, with 'move' built-in etc.
        If repeat=true then you get to place multiple instances... one after the other...
        If you want to place a component that's already loaded 'by name', then set name="MyComponentsName", then
        defn=model.definitions[name]
        before running the 'place_component' code...
        You can select an instance in code then run the Move tool on it, but that isn't what you asked??

        😄 i got it,谢谢

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

        Advertisement