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

I logic to Select vertex on part and create WorPoint

I am trying to create either an iLogic Rule or a VBA Macro that when the Macro/Rule is run the user needs to select a vertex on the part and the iLogic code will take the X, Y and Z coordinates from that vertex selection and create a WorkPoint at that location. I am using the CommandManager.Pick to have the user select the vertex but when I try to add a WorkPoint using the Measure.MinimumDistance I get an error that there is an Object required. I am not a programmer so I am trying to fumble my way thru to get this to work. Is there anyone that would be able to look at the code I have and tell me what I have done wrong. Any help would be greatly appreciated.

 

Sub Single_Bend_Door_Add_WorkPoints()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition

Dim oPoint As Vertex
Set oPoint = ThisApplication.CommandManager.Pick(kPartVertexFilter, "Right Side")
Dim wp1 As WorkPoint
Set wp1 = oDef.WorkPoints.AddByPoint(Measure.MinimumDistance(oPoint.Point.X, oPoint.Point.Y, oPoint.Point.Z))


End Sub