Gilgamesh99
Automotive
Hi:
I'be trying to develop a macro to remove duplicated points. So far I can manage to extract the coordinates of all points in the whole part or geometrical set. Can someone give a hand, at this point I feel that Im stuck. Here is one portion of the code (don't mind if something is weird/wrong, i've been experimenting a lot but essentially the code is for coordinates extraction)
I'be trying to develop a macro to remove duplicated points. So far I can manage to extract the coordinates of all points in the whole part or geometrical set. Can someone give a hand, at this point I feel that Im stuck. Here is one portion of the code (don't mind if something is weird/wrong, i've been experimenting a lot but essentially the code is for coordinates extraction)
Code:
Sub catmain()
Dim oPart As PartDocument
Set oPart = CATIA.ActiveDocument
'=====================================================
'Declare variables
Dim objPart As Part
Dim objHSF As HybridShapeFactory
Dim objRef As Reference
'Get at the part and its HybridShapeFactory object
Set objPart = CATIA.ActiveDocument.Part
Set objHSF = objPart.HybridShapeFactory
'=====================================================
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
oSel.Search ("Type=Point,all")
Dim counter As Integer
counter = oSel.Count
MsgBox counter
Dim i As Integer
Dim acoord(2)
Dim acoord2(2)
For i = 1 To oSel.Count
Dim dummy
Set dummy = oSel.Item(i).Value
dummy.GetCoordinates acoord
acoord2(i) = acoord(i)
'MsgBox "X coordinate: " & acoord(0) & vbCrLf & "Y coordinate: " & acoord(1) & vbCrLf & "Z coordinate: " & acoord(2)
Next i
MsgBox acoord2(1) & vbCrLf & acoord2(2)
If acoord2(1) >= acoord(1) And acoord2(2) >= acoord(2) Then
'oSel.delete
Set objRef = objPart.CreateReferenceFromObject(objPart.FindObjectByName("asd"))
End If
End Sub
'Dim oPart As PartDocument
'Set oPart = CATIA.ActiveDocument
'Dim oSel As Selection
'Set oSel = CATIA.ActiveDocument.Selection
'oSel.Search ("Type=Edge,all")
'Dim counter As Integer
'counter = oSel.Count
'MsgBox counter