Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove duplicate point macro 2

Status
Not open for further replies.

Gilgamesh99

Automotive
Jun 11, 2013
45
0
0
MX
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)

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
 
Replies continue below

Recommended for you

I know that Im abusing of your kindness, but can you help me with a little piece of code?. To be honest with you, I dont really know what are you exactly talking about.

Thank you in advance.
 
i did update my FAQ script. It might give you a clue on how to proceed check faq560-1377


Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.
Back
Top