- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Select centerpoint of slot like joint function
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!