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

Select centerpoint of slot like joint function

julian_sol
Contributor

Select centerpoint of slot like joint function

julian_sol
Contributor
Contributor

Hi! I would like the user to be able to select the centerpoint of a slot just like the joint function does. How do I achieve this by code? 

jointquestion.png

0 Likes
Reply
333 Views
4 Replies
Replies (4)

WCrihfield
Mentor
Mentor

Hi @julian_sol.  What do you intend to do with this point after you have selected it?  Do you need to create a WorkPoint or WorkAxis at that location?  Are you trying to constrain something to that point in the context of an assembly?  Do you just need the coordinates data?  A Point is a transient object (mathematical data only, no real visible geometry).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

abdullah_elq
Advocate
Advocate

Give this iLogic code a shot. It will place a workpoint at the center of your slot.

Dim oSlotEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select an edge on the slot") 
Dim oSlotEdgeCollection As EdgeCollection = oSlotEdge.TangentiallyConnectedEdges
Dim oComp As PartComponentDefinition = oSlotEdge.Parent.Parent
Dim SlotCentroid As WorkPoint = oComp.WorkPoints.AddAtCentroid(oSlotEdgeCollection)

 

0 Likes

julian_sol
Contributor
Contributor

Thanks for the replies. I should have elaborated more.

I'm indeed trying to joint constraint an object (bolt in example) to that point in an assembly. I have managed to do this on circular edges so far. 

I put these user selected edges in a list. After the selection is done the user can hit the place button. On all the selected positions/edges I will place a bolt and joint constrain them.

 

What I'm missing is an option to add this slot centerpoint to my list of objects. How can I let the user add this position/point to the list and preferably have this shown in the modelspace like how the joint function works mentioned in my previous post. 

 

Screencast:

https://knowledge.autodesk.com/community/screencast/832ff849-71e3-4504-a6ff-7cf177c2f613

0 Likes

julian_sol
Contributor
Contributor

If I'm not able to select the point itself I might use your option to get the whole slot (all tangent edges), highlight this for the user and get the point from the edgecollection to place my bolt on. That would probably work too.

Thanks for your reply!