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!

Switch off the Sketcher grid

Status
Not open for further replies.
Replies continue below

Recommended for you

Hi Ferdo,
For Clash Analysis,
This code is working perfectly :
Sub Main()

Dim CATIA As INFITF.Application
CATIA = GetObject(, "CATIA.Application")
If CATIA Is Nothing Then
CATIA = CreateObject("CATIA.Application")
End If

Dim cClashes As Clashes
Dim oSelection As Selection
oSelection = CATIA.ActiveDocument.Selection
Dim oProduct As AnyObject
oProduct = oSelection.FindObject("CATIAProduct")
cClashes = oProduct.GetTechnologicalObject("Clashes")
Dim oClash As Clash
oClash = cClashes.AddFromSel()
oClash.ComputationType = CatClashComputationType.catClashComputationTypeBetweenAll
oClash.InterferenceType = CatClashInterferenceType.catClashInterferenceTypeContact
oClash.Compute()
Dim cConflicts As Conflicts
cConflicts = oClash.Conflicts
Dim count As Integer
count = cConflicts.Count
Dim oConflict As Conflict
Dim Produs1 As Product
Dim oNume1 As String
Dim prod1run As Integer
Dim i As Integer
For i = 1 To count
oConflict = cConflicts.Item(i)
Produs1 = oConflict.FirstProduct
oNume1 = Produs1.PartNumber
If (UCase(Left(oNume1, 3)) = "RUN") Then
prod1run = prod1run + 1
End If

If (oConflict.Type = CatConflictType.catConflictTypeClash) Then
If (oConflict.Value <> 0) Then
oConflict.Status = CatConflictStatus.catConflictStatusRelevant
oConflict.Comment = "Automatic filter : penetration less than "
End If
ElseIf (oConflict.Type = CatConflictType.catConflictTypeContact) Then
oConflict.Status = CatConflictStatus.catConflictStatusIrrelevant
oConflict.Comment = "lalalalalala"
End If
Next
Dim iType As CatClashExportType = CatClashExportType.CatClashExportTypeXMLResultOnly
oClash.Export(iType, "c:\\Temp\ClashReport")
End Sub

End Module



I have 3 Queries:
1)For getting Clashes object,I am using oProduct.GetTechnologicalObject("Clashes")..I know that the method GetTechnologicalObject("Clashes") can be used only on the Root Product,Please help me to find the root Product from the Active Document because I dont want to manually select the root product everytime.
2)What if I have a root product consisting of 13-14 parts and I want to know clash report of each Part with other Parts? Then how should I modify my code
3)Once Interference feature is created in the model tree,If you click on that another window gets popup showing the exact Clash analysis of 2 parts..Will it be possible to export this particular window to "3DXML file"?..I Actually want to export each and every parts Clash analysis window to "3DXML files"

Waiting for your reply

Thank you
 
Status
Not open for further replies.
Back
Top