How to make a model follow with movetool
-
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! -
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 perhapspath_to_skp="C:/users/alecchyi/desktop/MyComponent.skp"
This will ensure it's now loaded into the model.
Thenname=defn.name- just in case it's been given a different name from what you expected ?
Thenmodel.place_component(defn, repeat)
Ifrepeat=falsethen you get to add one instance of that component - just like the native tool, with 'move' built-in etc.
Ifrepeat=truethen you get to place multiple instances... one after the other...
If you want to place a component that's already loaded 'by name', then setname="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 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 perhapspath_to_skp="C:/users/alecchyi/desktop/MyComponent.skp"
This will ensure it's now loaded into the model.
Thenname=defn.name- just in case it's been given a different name from what you expected ?
Thenmodel.place_component(defn, repeat)
Ifrepeat=falsethen you get to add one instance of that component - just like the native tool, with 'move' built-in etc.
Ifrepeat=truethen you get to place multiple instances... one after the other...
If you want to place a component that's already loaded 'by name', then setname="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,谢谢
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement