How to implement entity selection "wizard"

How to implement entity selection "wizard"

Postby ittayd » Wed Apr 19, 2017 7:37 pm

In Sketchup most of the tools contain a sort of "wizard" where the status line tells you what to pick and then when you pick it, what to pick next, etc. How can I do this in an extension?
0

ittayd 
 

Re: How to implement entity selection "wizard"

Postby sdmitch » Wed Apr 19, 2017 8:50 pm

ittayd wrote:In Sketchup most of the tools contain a sort of "wizard" where the status line tells you what to pick and then when you pick it, what to pick next, etc. How can I do this in an extension?


The set_status_text method is used to set the text appearing on the status bar within the drawing window.

If no arguments are passed, the status bar content is cleared. Valid positions are:

SB_PROMPT - the text will appear at the left-side of the status bar
SB_VCB_LABEL - the text will appear in place of the VCB label
SB_VCB_VALUE - the text will appear in the VCB
Code: Select all
Sketchup.set_status_text "This is a Test", SB_VCB_VALUE
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: How to implement entity selection "wizard"

Postby ittayd » Thu Apr 20, 2017 8:50 am

Thanks. And how do I pick elements one by one? Do I need to listen to mouse clicks or is there something that takes care of the flow for me?
0

ittayd 
 

Re: How to implement entity selection "wizard"

Postby TIG » Thu Apr 20, 2017 12:17 pm

You need to set up your Extensions as a 'Tool'.
http://ruby.sketchup.com/Sketchup/Tool.html
Clear the selection as you initialize.
On a mouse-click you use a pick-helper.
That filters what you have clicked on - so you can have various results.
You then filter that further by limiting what chosen by some other factor[s] like: context, already-selected, material, layer, name, attribute etc.
If you have a valid object add it to the selection.
Repeat until the user exits - e.g. double-click or <enter> press - then go onto the next step in your tool...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: How to implement entity selection "wizard"

Postby Dan Rathbun » Fri Apr 21, 2017 3:15 am

... and new for SketchUp vers 2016 and higher is a rectangular window picking method:
http://ruby.sketchup.com/Sketchup/PickHelper.html#window_pick-instance_method

You should download the SketchUp Team's Examples extension to see how Tools are written.
http://extensions.sketchup.com/en/content/example-ruby-scripts
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago



    Ad Machine 
    Robot
     



     

    Return to Developers' Forum

    Who is online

    Users browsing this forum: DotSketch and 4 guests

    Visit our sponsors: