Catia Macro: Measure Minimum Distance Between Two Parts in a Product
Catia Macro: Measure Minimum Distance Between Two Parts in a Product
(OP)
Hello
I want to measure minimum distance between two parts in a product. But I am not able to get it work. Below is my code.
Please help me
I want to measure minimum distance between two parts in a product. But I am not able to get it work. Below is my code.
CODE --> VBA
Sub CATMain()
Dim MyDoc As Document
Set MyDoc = CATIA.ActiveDocument
Dim MainProduct As Product
Set MainProduct = MyDoc.Product
Dim product1 As Product
Dim product2 As Product
Set product1 = MainProduct.Products.Item("Housing.1")
Set product2 = MainProduct.Products.Item("Part1.2_Manual")
Dim SPAWorkbench1 As SPAWorkbench
Set SPAWorkbench1 = MyDoc.GetWorkbench("SPAWorkbench")
Dim reference1 As Reference
Dim reference2 As Reference
Set reference1 = MainProduct.CreateReferenceFromName("Product1/Housing.1/")
Set reference2 = MainProduct.CreateReferenceFromName("Product1/Part1.2_Manual/")
Dim measurable1 As Measurable
Set measurable1 = SPAWorkbench1.GetMeasurable(reference1)
MsgBox measurable1.GetMinimumDistance(reference2)
End Sub Please help me





RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product
RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product
RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product
To get minimum distance between two parts you need to select PartBody (MainBody) of each of them and measure between (Any Geometry, Infinite). I'm supposing you don't have multiple bodies...
Why do you need a macro for this, is it really necessary ?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product
Yes it is necessary to get it as I am working on something really complex where clearance calculation takes around 30 sec per iteration and I have to do it around 1500 times.
Right now I am using Distance and Clash Object to calculate clearance and interference but its very time consuming. Want to test the same with measurable if I get some speed advantage.