Selection script

Next
 From:  Paul (AIRGLASS)
1078.1 
Hi all,
The selection thread a day or two ago gave me an idea for another utility script,
sort of like using Tab, Shift-Tab to switch the focus in an application, only switching the selection between objects in a model.

Add the script to the moi/commands directory, hook up some hotkeys in MoI/options/Shortcut Keys :

A CycleSelect
Alt+A CycleSelect Back

Object selection will switch forward or back once with each key press.

Paul
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.2 In reply to 1078.1 
Cool Paul!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
1078.3 In reply to 1078.1 
Thanks for the handy script Paul!

Works great in many situations, for example while selecting small object without zooming, or selecting obscured objects without changing the point of view.

It seems "Tab" cannot be assigned as a hotkey.
Maybe the script could work in a similar way with selected point in a curve. (cycle to the next).

I wish I had the time to learn Moi's scripting in and come off with these kinds of cool tools.

Regards,

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.4 In reply to 1078.3 
Thanks guys,
Yea, come to think of it, it will be useful for selecting objects that are hidden a bit in a model - good point!
Marc : if you open up the script, there's a section in there with a listing of possible object options that can be selected. Comment out the one that's currently being used and uncomment the one you want - there's one for .getPoints that might work for you. Unfortunately there's no way to add in a quick switching of options without adding in a lot of command line parameters, which would get to be a real mess as far as assigning hotkeys :) .
Anyway, hope it's useful for you!

Paul
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  tyglik
1078.5 In reply to 1078.1 
Hi Paul,

I use a custom command for selecting objects by type. I think, it would be useful if it also worked with object subtype like edges, faces, closed/open curves and open/closed polysurfaces (solid). Unfortunately, I am busy now... Maybe, you can try enhancing that command instead of me :) It is a good idea to ask Michael to send you a "moi.idl" file. Scripting is easier when you have this file at your disposal...

Petr
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.6 In reply to 1078.5 
Hi Petr,
Thanks for the script - I'll take a look at it this evening, maybe I can figure a way to get it put together with this other script. Thanks for the help!

Paul
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.7 In reply to 1078.4 
> Comment out the one that's currently being used and uncomment the one you
> want - there's one for .getPoints that might work for you.

That one will only grab the standalone "point objects", like the kind that you create under Draw curve / More / Point.

Currently there isn't any way to target "edit points" like the points that show up on a curve when you use Show pts on it. Right now an edit point just isn't set up as an individually targetable object type. Eventually I'll figure out some way to expose these to scripts.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.8 In reply to 1078.7 
Ah, thanks, Michael. So the objects that are targetable for individual selection by a script would be Brep, Face, Curve and PointObject, I take it? ( the objects listed in enum GeomObject_Type in moi.idl ).

Paul
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.9 In reply to 1078.8 
Hi Paul, yes that is correct. But for example curves can be either a stand-alone individual curve object, or a brep also has edge curves that are sub-objects that belong to the brep.

It might be possible to make point objects work in a similar way, with edit points as sub-objects of a curve or brep. I didn't try that so far because it can possibly mean adding a lot of additional data to save since each point would then have more attributes on it like an ID, etc...., and sometimes there are a lot of points, so I'm a bit worried about kind of bloating things up.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.10 In reply to 1078.9 
Got it -- thanks for the info, Michael --

Paul
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.11 In reply to 1078.10 
No problem Paul, thanks for sharing your scripts here!

I'm glad that you guys are able to get stuff done with it despite the lack of documentation.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.12 
Here's a variation on the CycleSelect script mixing it in with Petr's SelectByType script.
To use:
Select an object in a viewport (a brep, curve or point object), hit the hotkey you've assigned
and that type of object will be selected in sequence (once per keypress). If no object is selected first, or more than one is selected, a reminder will pop up; press Done; do a selection and rerun the script.

hotkey CycleSelectByType
Alt+hotkey CycleSelectByType Back

Petr, I tried to work in subobject selection, but apparently it's not currently possible, unless I've misunderstood, anyway nothing I tried worked -

Paul
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.13 In reply to 1078.12 
Hi Paul, back a little bit ago I added a couple of script methods for getting sub objects. It should work if you have the latest patch.

I attached an updated moi.idl here.

There are 2 ways that will work - for any object you can now call the new getSubObjects() method on the object which returns an object list of all sub-objects underneath the object. But one tricky thing is this includes curve segments which are sub-objects of a curve as well, you should probably skip the segments since most things don't currently expect a segment sub-object to be selected, things expect just the parent curve (edge curve or standalone curve) to have the selection instead.

Another thing you can use is on a brep object, there are getEdges() and getFaces() methods that will let you get those as object lists. This one may be easier since it won't include segments.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
1078.14 
This scripts looks great Paul!

Maybe it is a known issue but just for the record I found out that you cannot assign the equal ( = ) and bracket keys ( [ ] ) to a shortcut as they seem to interfere with the scripting language. (They work with modifiers though.)

-"Currently there isn't any way to target "edit points"

I would thought it possible since selections of multiple points can be manipulated with many of the transform tools and also align.

Regards,

Marc

EDITED: 2 Nov 2007 by TELLIER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.15 In reply to 1078.13 
Hi Michael,
Thanks for newer .idl. I'll take a look at it this weekend and see if I can rework the script. I'll get it right sooner or later! :)

Paul

Ps
Marc, yes, there are a few keys that won't work as hotkeys,
like Tab, semicolon and apostrophe that I know about, not sure about the others--

EDITED: 2 Nov 2007 by AIRGLASS

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
1078.16 In reply to 1078.14 
Hi Marc & Paul,

Marc wrote:
> Maybe it is a known issue but just for the record I found out that you cannot
> assign the equal ( = ) and bracket keys ( [ ] ) to a shortcut as they seem to
> interfere with the scripting language.

Actually I didn't know about this, thanks for reporting it!

What is happening here is the = and bracket keys interfere with the structure of the moi.ini file where the shortcut keys are saved, since [] is used for a [section name] in the ini file, and the = is used for an entry like name=value.

Definitely avoid using these for now, they can trigger some bugs that may kind of mess up your moi.ini file.

Also semi-colon is used as a comment in the .ini file, so that's why that one doesn't work as well.

I've fixed these up for the next release, these characters will be escaped when written to the moi.ini file to fix these problems.

I've also added in the Tab key as something you can assign shortcuts to.

Thanks!
- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Paul (AIRGLASS)
1078.17 
Finally got around to finishing the cycle select script with subobject selections. Cycling the selection thru all objects (depending on what's selected) should work now. Useage (with command line parameters) :

hotkey CycleSelectByType

Alt+hotkey CycleSelectByType Back

hotkey CycleSelectByType TopLevel

hotkey CycleSelectByType AllOfType

The TopLevel parameter will cycle selection thru all objects except faces and edges --

The AllOfType parameter will cycle thru points, breps, faces, and curves (except edges), depending on the type of object initially selected --

The Back parameter can be used with the other two parameters, as in:
CycleSelectByType TopLevel Back

If no object is selected before the script is run, a notice will pop up, click Done, make a selection, rerun the script.

One problem with this script is that on larger models with alot of objects, the edge and face cycle selection can be very sluggish, due to the way I've got the script designed.
Thanks to Michael and Petr for their help!


Paul

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  tyglik
1078.18 In reply to 1078.12 
Hi Paul,

I put an idea how command should work on the paper last week when I was going a long way by train and managed to spare time to rewrite it today. The custom command just mixes all known macro scripts together, so the code isn't very clear... if else if else... I am still genuinely surprised it works :)
I am posting it in a separate thread... and trying your piece of work... fine. Moi's cryptic scripting is funny, isn't it :) But pretty time-consuming - making a model is much better.

Petr
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Paul (AIRGLASS)
1078.19 In reply to 1078.18 
Hi, Petr,
>The custom command just mixes all known macro scripts together <
Now you've got me curious! Petr's All_In_One_Super_Duper script !
If else, if else, if else --- Yup, I hear ya on that, like figuring out a big puzzle :)
But, I've learned alot in the process, it's kind of handy to be able to make a custom command once in awhile,
time to get back to doing some actual modeling for a change --)

Paul
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All