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.
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.