I need to define a mate constraint with a workplane as EntityOne and a midpoint from an Edge as EntityTwo.
API-Help tells me valid objects are planar faces, linear edges, vertices, cylindrical faces, conical faces, spherical faces, revolved faces, work planes, work axes, and work points.
The Edge object gives me StartVertex and StopVertex, but what about the midpoint?
Solved! Go to Solution.
One way to investigate things like this is to create the object through the user interface and then check the properties of the created object through the API.
Once you do that you can see that EntityTwo will be an EdgeProxy and EntityTwoInferredType will be kInferredPoint.
If you create your mate constraint through the API similar to the above then that succeeds:
Sub test() Dim asm As AssemblyDocument Set asm = ThisApplication.ActiveDocument ' Workplane from 1st occurrence Dim wp As WorkPlaneProxy Set wp = asm.SelectSet(1) ' Edge from second occurrence Dim e As EdgeProxy Set e = asm.SelectSet(2) Dim mate As MateConstraint Set mate = asm.ComponentDefinition.Constraints.AddMateConstra
int(wp, e, 0, kNoInference, kInferredPoint) End Sub
The solution is already posted above. When you say you use the MidPoint as Point are you trying to pass in as Point (the transient geometry object inside the Inventor API)? That won't work.
You actually have to pass in the Edge object whose midpoint you want to use and set its inference to kInferredPoint
I hope this explains.
Yes I realised that after I had replyed and therefore deleted my reply.
It's working now.
But thanks anyway for your reply!
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.