CamBam
Resources => Scripts and Plugins => Topic started by: dh42 on August 09, 2013, 23:29:22 pm
-
Hello,
Here is a script to invert the selected shapes.
++
David
'invert selection - dh42 2013
sub main
dim ent as Entity
dim ID as integer
dim rep as boolean = false
CamBamConfig.Defaults.ReloadTreeAfterScript = false
' store data for actual selection
dim oldselection as ArrayList = new ArrayList()
for each ent in view.SelectedEntities
oldselection.Add(ent)
next ent
'select all
view.SelectAllVisibleGeometry()
dim invertselect as ArrayList = new ArrayList()
'scan all the objects
for each ent in view.SelectedEntities
rep = scanID(ent.ID, oldselection) ' test if ID exist in old selection
if rep = false then 'not found
invertselect.Add(ent) ' add the object to the new list
end if
next ent
view.Select(invertselect)
end sub
'--------------------------------------------------------------------
function scanID( ID as integer, oldsel as ArrayList ) as boolean
'scan the old selection, if ID match, return true, else false
dim ent as Entity
for each ent in oldsel
if ID = ent.ID then 'match found
return true
exit function
end if
next ent
return false 'no match found
end function
-
Hello,
A little correction to the script, because the objects are selected in the view but not in the tree.
(4 th line in the main sub)
CamBamConfig.Defaults.ReloadTreeAfterScript = false
++
David
-
Um... wouldn't you want to make that '=true', so the tree selection occurs after the script?
Or does that refresh the whole tree to the unselected state?
Lloyd
-
Um... wouldn't you want to make that '=true', so the tree selection occurs after the script?
Or does that refresh the whole tree to the unselected state?
Lloyd
Hello,
Explanation from our Jedi master here ;)
http://www.cambam.co.uk/forum/index.php?topic=1972.msg11881#msg11881
Note that without this line of code, the objects are selected, we can move it, but if you try to delete or cut it, nothing happens.
++
David
-
Ah! So glad I asked!
Lloyd
-
Hello,
And the new version as plugin.
The new item is located in the Edit menu and has a shortcut -> Ctrl I
Enjoy
++
David
-
Hello,
A little change, I just see that the Ctrl + I is already used for 'convert to region' :-[
The new version use now Shift+Ctrl+I
++
David