VBA CATIA : Finding the point of contact between parts
VBA CATIA : Finding the point of contact between parts
(OP)
Hello,
I am trying to find the point of contact between parts using VBA. I am using the interference module of CATIA and I can find the closest points in the case of a clash or clearance but it doesn't give the point of contact in that case. GetFirstPointCoordinates and GetSecondPointCoordinates return nothing in the case of a contact and it can't be found in the XML file exports either.
However using the Measure tool between two objects, even in the case of planar contact, gives a point of contact. So I have been trying to use the SPAWorkbench with GetMinimumDistancePoints to find the point that way. The problem is that I need to reference the products or parts themselves and not specific surfaces or vertices, just as it is possible to do using the Measure tool in CATIA. Does anyone know how to do this or has anyone successfully attacked this problem some other way??
Thanks in advance for your help.
I am trying to find the point of contact between parts using VBA. I am using the interference module of CATIA and I can find the closest points in the case of a clash or clearance but it doesn't give the point of contact in that case. GetFirstPointCoordinates and GetSecondPointCoordinates return nothing in the case of a contact and it can't be found in the XML file exports either.
However using the Measure tool between two objects, even in the case of planar contact, gives a point of contact. So I have been trying to use the SPAWorkbench with GetMinimumDistancePoints to find the point that way. The problem is that I need to reference the products or parts themselves and not specific surfaces or vertices, just as it is possible to do using the Measure tool in CATIA. Does anyone know how to do this or has anyone successfully attacked this problem some other way??
Thanks in advance for your help.





RE: VBA CATIA : Finding the point of contact between parts
CODE --> VBA
Dim cGroups Set cGroups = CATIA.ActiveDocument.Product.GetTechnologicalObject("Groups") Dim oGroup1 Set oGroup1 = cGroups.Add Set truc = oconflict.FirstProduct oGroup1.AddExplicit truc Set truc = oconflict.SecondProduct oGroup1.AddExplicit truc Dim cDistances Set cDistances = CATIA.ActiveDocument.Product.GetTechnologicalObject("Distances") Dim odistance Set odistance = cDistances.Add odistance.FirstGroup = oGroup1 odistance.Compute Call odistance.GetFirstPointCoordinates(pts1) Call odistance.GetSecondPointCoordinates(pts2)RE: VBA CATIA : Finding the point of contact between parts
Sick. Just sick.
RE: VBA CATIA : Finding the point of contact between parts
At all events, I'm sorry it has ruined your day to such a point.
RE: VBA CATIA : Finding the point of contact between parts
So now I am presented with another similar problem. Distance objects only work to find the distance between parts or products. To find the distance between for example a line and a plane, has to be done using the SPAworkbench. That, however, seems to work only inside of a part. If you try to do the same thing between two different parts the distance is calculated using the subtraction of the coordinates of each element with respect to their respective origins and not the global origin.
Does Anyone know how to get around that???
Thanks for you help.
RE: VBA CATIA : Finding the point of contact between parts