Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Finding the point of contact between parts

Status
Not open for further replies.

nevj

Mechanical
Mar 26, 2015
9
0
0
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

It would appear that it is only possible to make a reference to something in a part, with the reference being in the context of the part. Is that so?
If so, does anyone know how to get around this??
 
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)
 
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.
Back
Top