Continue to Site

Welcome to 3DCADForums

Join our CAD community forums where over 25,000 users interact to solve day to day problems and share ideas. We encourage you to visit, invite you to participate and look forward to your input and opinions. Acrobat 3D, AutoCAD, Catia, Inventor, IronCAD, Creo, Pro/ENGINEER, Solid Edge, SolidWorks, and others.

Clashes' searching Macro

alvinphan

New member
Hi everyone
I'm finding a way to get informations from Clashes. Actually, I only need to get Clash type and Clearance type. Here's my Module:

.............................................................................
Sub CATMain()

Dim ExApp As Object
Dim XlsSheet As Object
Set ExApp = CreateObject("Excel.Application")
ExApp.Visible = True
ExApp.UserControl = True
Call ExApp.Workbooks.Add
Set XlsSheet = ExApp.ActiveWorkbook.ActiveSheet

Dim cClashes As Clashes
Set cClashes = CATIA.ActiveDocument.Product.GetTechnologicalObject("Clashes")

Dim oClash As Clash
Set oClash = cClashes.AddFromSel

Dim cConflicts As Conflicts
Set cConflicts = oClash.Conflicts

With XlsSheet
.Cells(1, 1).Value = "Clash Contact Check"
.Cells(2, 1).Value = "First Part"
.Cells(2, 2).Value = "Second Part" '& now_Length

.Cells(1, 4).Value = "Clearance Contact Check"
.Cells(2, 4).Value = "First Part"
.Cells(2, 5).Value = "Second Part" '& now_Length
j = 3
k = 3
For i = 1 To cConflicts.Count
If cConflicts.Item(i).Type = catConflictTypeClash Then

.Cells(j, 1).Value = cConflicts.Item(i).FirstProduct.PartNumber
.Cells(j, 2).Value = cConflicts.Item(i).SecondProduct.PartNumber
.Cells(j, 3).Value = cConflicts.Item(i).value
j = j + 1
End If

Next

For m = 1 To cConflicts.Count
If cConflicts.Item(i).Type = catConflictTypeClearance Then

.Cells(k, 4).Value = cConflicts.Item(m).FirstProduct.PartNumber
.Cells(k, 5).Value = cConflicts.Item(m).SecondProduct.PartNumber
.Cells(j, 6).Value = cConflicts.Item(m).value
k = k + 1
End If

Next

End With

End Sub
..............................................................................

As you can see that I tried to find the Clearance Type but it was skipped.
Can anyone help me, please? thanx so much :confused:
 

Articles From 3DCAD World

Sponsor

Back
Top