Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Catia Clash Analyze - Problem when loading XML back to Catia

Status
Not open for further replies.

PhantomRo

Industrial
Oct 6, 2011
3
Hello

I am having problems loading back to Catia a xml containing clash results.

I use the following script to generate the xml:

Sub clashTOxml()
Dim cClashes As Clashes
Dim oClash As Clash
Dim dFilterValue As Double
Dim oConflict As Conflict
Dim Produs1 As Product
Dim oNume1 As String
Dim Produs2 As Product
Dim oNume2 As String
Dim prod1run As Integer
Dim prod2run As Integer

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

dFilterValue = 0

Set oClash = cClashes.AddFromSel
oClash.ComputationType = catClashComputationTypeInsideOne
oClash.InterferenceType = catClashInterferenceTypeContact
oClash.Compute

Dim cConflicts As Conflicts
Set cConflicts = oClash.Conflicts

Dim I As Integer
For I = 1 To cConflicts.Count

Set oConflict = cConflicts.Item(I)

Set Produs1 = oConflict.FirstProduct
oNume1 = Produs1.PartNumber
If (UCase(Left(oNume1, 3)) = "RUN") Then
prod1run = prod1run + 1
End If

Set Produs2 = oConflict.SecondProduct
oNume2 = Produs2.PartNumber
If (UCase(Left(oNume2, 3)) = "RUN") Then
prod2run = prod2run + 1
End If

If (oConflict.Type = catConflictTypeClash) Then
If (oConflict.Value <> 0) Then
oConflict.Status = catConflictStatusRelevant
oConflict.Comment = "Automatic filter : penetration less than " & dFilterValue
End If
ElseIf (oConflict.Type = catConflictTypeContact) Then
oConflict.Status = catConflictStatusIrrelevant
oConflict.Comment = "lalalalalala"
End If
Next

oClash.Export CatClashExportTypeXMLTypeStructureAndClash, "C:\Temp\rezultate_clash"
End Sub

For loading it back to Catia I use this script:

Sub Read()
Dim rClashes As ClashResults
Set rClashes = CATIA.ActiveDocument.Product.GetTechnologicalObject("ClashResults")
Dim rClash As ClashResult
Set rClash = rClashes.AddFromXML("C:\Temp\rezultate_clash.xml", CatClashImportTypeStructureAndClash)
MsgBox "Ok"
End Sub

After loading in the product tree under Applications->Interference I get a Interference Results.1 but it is empty. It does not contains the clashes from the xml file. I have generated a xml file manually from the clashes window but when I have tried to load it back to Catia using this script it was also empty.
 
Replies continue below

Recommended for you

I found a solution to the problem. Now I can load the XML back to Catia and see all the clashes in the tree. The problem has a simple solution: Tools->Options->Digital Mockup->DMU Space Analysis->DMU Clash - Process unmark the Federated XML output.
 
Hi,

Thanks for sharing the code (and your solution) with us.

I've tried the code in a CATScript and got no xml file (I don't have on all computers vba installed) but it works in catvba with a slide modification.

I got an error (entry point) so I modified your Sub clashTOxml with Sub CATMain . It works with that box marked also but after loading the xml file , I have to give few escapes keys to be able to do ssomething in CATIA (or run Fit All In command, with the same result).


Regards
Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor