Multiple Mouse Select

Multiple Mouse Select

ch_giacomo
Enthusiast Enthusiast
784 Views
4 Replies
Message 1 of 5

Multiple Mouse Select

ch_giacomo
Enthusiast
Enthusiast
Hi all, I've created this little rule that hide the lines or circles I want in a view with mouse selection.
But I can't set the selection to be multiple.
After the first selection the rule ends instead it should continue until the ESC key is pressed

Sorry but I'm new to ilogic

Here is the code:
Sub Main ()

	Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    Dim obj As DrawingCurveSegment
    obj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select")

    obj.Visible = False

End Sub
 
0 Likes
Accepted solutions (2)
785 Views
4 Replies
Replies (4)
Message 2 of 5

A.Acheson
Mentor
Mentor
Accepted solution

Here is an article on how to integrate a while loop to achieve your goal.

 

From the article, adjust the pick SelectionFilterEnum as needed. Esc is used to exit the while loop

 

Dim comps As ObjectCollection
Dim comp As Object

comps = ThisApplication.TransientObjects.CreateObjectCollection

While True
	comp = ThisApplication.CommandManager.Pick(
		SelectionFilterEnum.kAssemblyOccurrenceFilter, 
		"Select a component") 
		
	' If nothing gets selected then we're done	
	If IsNothing(comp) Then Exit While
	
	comps.Add(comp) 
End While

' If there are selected components we can do something
For Each comp In comps
	comp.Delete()
Next

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 5

WCrihfield
Mentor
Mentor

Just another variation of the same using a Do...Loop.  There are several ways you could set this up.  You could use GoTo at the end to, then use Exit Sub when the DCS Is Nothing to escape the loop.

Sub Main ()
	Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim DCS As DrawingCurveSegment
	Do
	    DCS = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select")
		If IsNothing(DCS) Then Exit Do 'or Exit Sub
	    DCS.Visible = False
	Loop Until DCS Is Nothing
End Sub

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 5

ch_giacomo
Enthusiast
Enthusiast
Accepted solution

Thanks a lot for the help..

I'm at the basic level..

 

Here is the result:

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
	
While True
    Dim obj As DrawingCurveSegment
    obj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select")


' If nothing gets selected then we're done	
	If IsNothing(obj) Then Exit While	
obj.Visible = False
	
End While

 

0 Likes
Message 5 of 5

ch_giacomo
Enthusiast
Enthusiast

Grazie

Funziona alla grande @WCrihfield 

0 Likes