Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Function MeasureClash(MaxClearance As Double) As Double
Dim MyDoc As Document
Set MyDoc = CATIA.ActiveDocument
Dim MyProduct As Product
Set MyProduct = MyDoc.Product
Dim Product1 As Product
Dim Product2 As Product
Set Product1 = MyProduct.Products.Item("Part1.1")
Set Product2 = MyProduct.Products.Item("Part2.1")
Dim MySelection As Selection
Set MySelection = MyDoc.Selection
MySelection.Clear
Call MySelection.Add(Product1)
Call MySelection.Add(Product2)
Dim cClashes As Clashes
Set cClashes = MyProduct.GetTechnologicalObject("Clashes")
Dim MyClash As Clash
Set MyClash = cClashes.AddFromSel
MyClash.ComputationType = catClashComputationTypeInsideOne
If MaxClearance > 0 Then
MyClash.InterferenceType = catClashInterferenceTypeClearance
MyClash.Clearance = MaxClearance
Else
MyClash.InterferenceType = catClashInterferenceTypeContact
End If
MyClash.Compute
MySelection.Clear
Dim i As Integer
If MyClash.Conflicts.Count <> 0 Then
For i = 1 To MyClash.Conflicts.Count
Dim MyConflict As Conflict
Set MyConflict = MyClash.Conflicts.Item(i)
If MyConflict.Type = catConflictTypeClash Then
MeasureClash = MyConflict.Value
End If
If MyConflict.Type = catConflictTypeClearance Then
MeasureClash = MyConflict.Value
End If
If MyConflict.Type = catConflictTypeContact Then
MeasureClash = MyConflict.Value
End If
Next
Else
MsgBox "Clearance Value > " + CStr(MaxClearance)
MeasureClash = 3333
End If
End Function
Private Function MeasureDistance() As Double
Dim MyDoc As Document
Set MyDoc = CATIA.ActiveDocument
Dim MyProduct As Product
Set MyProduct = MyDoc.Product
Dim Product1 As Product
Dim Product2 As Product
Set Product1 = MyProduct.Products.Item("Part1.1")
Set Product2 = MyProduct.Products.Item("Part2.1")
Dim MySelection As Selection
Set MySelection = MyDoc.Selection
MySelection.Clear
Call MySelection.Add(Product1)
Call MySelection.Add(Product2)
Dim cDistances As Distances
Set cDistances = MyProduct.GetTechnologicalObject("Distances")
Dim MyDistance As Distance
Set MyDistance = cDistances.AddFromSel
MyDistance.ComputationType = catDistanceComputationTypeInsideOne
MyDistance.MeasureType = catDistanceMeasureTypeMinimum
MeasureDistance = MyDistance.Value
MySelection.Clear
End Function
V5 Automation Documentation said:Measurable (Object)
System.IUnknown
System.IDispatch
System.CATBaseUnknown
System.CATBaseDispatch
System.AnyObject
Measurable
The interface to access a CATIAMeasurable Get measurements on the object.
Two types of measurement can be done:
itself : gives dimensions related to the object itself (ex the radius of a circle).
between : gives dimensions related to another object (ex the distance between two products). A restriction occurs for distance between: bodies (CATBody) cannot be measured.