Get Minimun Distance
Get Minimun Distance
(OP)
hi everybody
i have an issue, hope you can help me with this
well i have a product with abot 130 parts, and i need to know the distance between each part,
doing it manually is terrible, hope you can help me with this,
thank you
i have an issue, hope you can help me with this
well i have a product with abot 130 parts, and i need to know the distance between each part,
doing it manually is terrible, hope you can help me with this,
thank you





RE: Get Minimun Distance
As you are not looking off clash but distance, select the option with clearance and put the parameter to a large number. Also select option Between all components so it will check each part against all.
indocti discant et ament meminisse periti
RE: Get Minimun Distance
thank you so much for your answer
is there any way to do it in a macro?
RE: Get Minimun Distance
CODE --> VBA
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 FunctionRE: Get Minimun Distance
thank you so much for this code, it really help me a lot
i wonder if, this code just work for products? or it can be used also to mesure between partbodies within a part?
RE: Get Minimun Distance
This is a shame on Dessault's Part.
RE: Get Minimun Distance
RE: Get Minimun Distance
i will try different ways to find a solution for this.
thank you