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:
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