Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Inventor CommandManager.pick to Point3D

FINET_Laurent
Advisor

Inventor CommandManager.pick to Point3D

FINET_Laurent
Advisor
Advisor

Hi folks,

 

Here in the folowing example, I'm using the command manager to pick a surface (pipe) to add a component. 

I'm creating the component, adding to assembly, placing the constraints around the pipe, etc.

 

The last constraint that I didn't add is in the axis of the pipe. The component can move left & right according to the axis. As for now it is landing randomly along the axis. Whould there be somehow a way to get the 3D point where I clicked using the commandManager.Pick method ? 

 

FINET_Laurent_0-1701176993763.png

 

Thank you & kind regards,

FINET L. 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Reply
Accepted solutions (1)
126 Views
1 Reply
Reply (1)

FINET_Laurent
Advisor
Advisor
Accepted solution

..Dug in the documentation & found out what I was looking for.

Here is the code I ended up with :

Private Class Testing
	Private Selecting As Boolean
	
	Sub Main()
		
		Dim i  As InteractionEvents  = ThisApplication.CommandManager.CreateInteractionEvents
	 	i.InteractionDisabled = False
		
		Dim selectEvents As Inventor.SelectEvents = i.SelectEvents()
		AddHandler selectEvents.OnSelect, AddressOf oSelectEvents_OnSelect
		i.Start
		Selecting = True
		
		While Selecting = True		
			ThisApplication.UserInterfaceManager.DoEvents()
			
		End While
		 
		i.Stop
	 
	End Sub

	Private Sub oSelectEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View)
		MsgBox("X :" & Round(ModelPosition.X, 2) & "   Y :" &Round(ModelPosition.Y, 2) & "   Z :" & Round(ModelPosition.Z, 2))
    	Selecting = False
	
	End Sub
	
End Class

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes