I'm trying to make a point measuring tool, but whenever my loop stumbles upon a non-updated point, it crashes my Measurable. How can I measure it?
How do I measure a non-updated point in CATIA VBA?
904 views Asked by Nicholas Pisca At
2
There are 2 answers
1
On
you can always isolate geometry, then you can measure and delete it if you dont need it anymore..
here is an example which creates isolated copy of first point in first geometrical set, updated or not, while original stands intact.
Sub makePointDatum()
Dim sPoint As HybridShapePointExplicit, oPart As Part, oHSF As HybridShapeFactory
Set oPart = CATIA.ActiveDocument.Part
Set oHSF = oPart.HybridShapeFactory
Set sPoint = oHSF.AddNewPointDatum(oPart.HybridBodies.Item(1).HybridShapes.Item(1))
oPart.UpdateObject sPoint
oPart.HybridBodies.Item(1).AppendHybridShape sPoint
End Sub
After searching around, it appears you can't measure any geometry that isn't updated.
You can update one object by using the UpdateObject method in the MecMod Part library. Then run the measurable methods now that you have an updated object.
Like this:
If the geometry cannot update, due to an issue with the geometry, you can always skip it with error checking (sloppy), or use the command "IsUpToDate" to check if the geometry is updated.
Like this:
Be sure to keep the object name in an array so you can prompt the user with a list of all objects that did NOT get measured.