Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA CATIA : Finding the point of contact between parts

Status
Not open for further replies.

nevj

Mechanical
Mar 26, 2015
9
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.
 
Replies continue below

Recommended for you

Well I finally worked it out using the Distance objects:

Code:
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)
 
Why the hell is the CATIA forum always flooded with topics about scripting and macros?
Sick. Just sick.
 
Perhaps it is as a result of their link to........ Catia.
At all events, I'm sorry it has ruined your day to such a point.
 
Hello Again,
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top