i need help with exporting parameters from the specific geometrical called GENERAL NOTES set to txt file or excel.
googling seems not to be so helpful.see attached image
googling seems not to be so helpful.see attached image
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'##ALGORITMO CATScript
'Export parameters and values of Geometrical Set to txt File
Sub CATMain()
'Documento Activo
Dim oPartDoc As Part
On Error Resume Next
Set oPartDoc = CATIA.ActiveDocument.Part
If Err.Number <> 0 Then
Message = MsgBox("This script only works with a CATPart as active document", vbCritical, "Error")
Exit Sub
End If
' What do want to select
Dim EnableSelectionFor(0)
EnableSelectionFor(0) = "HybridBody"
' Reset the Selection
Set sSEL = CATIA.ActiveDocument.Selection
sSEL.Clear
' Define Selection
MsgBox "Select the 'Geometrical Set' where the parameters are"
UserSelection = sSEL.SelectElement2(EnableSelectionFor, "Seleccione otro Geometrical Set", False)
' Evaluation if the selectio is correct or not
If UserSelection <> "Normal" Then
MsgBox "Error con la seleccion"
Exit Sub
Else
Set oGeoSet = sSEL.Item(1).Value
REM MsgBox "The Geometrical Set select is : " & oGeoSet.Name
End If
Set ParametersList = CATIA.ActiveDocument.Part.Parameters
Set SubList = ParametersList.SubList(oGeoSet,FALSE)
'--------------------------------------------------------------------------------
' Location where the file will be saved
'--------------------------------------------------------------------------------
Dim filename As String
filename = CATIA.FileSelectionBox("Where to save the resulting file?", "*.txt", CatFileSelectionModeSave)
Set Datos = CATIA.FileSystem.CreateFile(filename & ".txt" , True)
Set oSTR = Datos.OpenAsTextStream("ForAppending")
oSTR.Write ("Parameters extract to: " & oPartDoc.Name & ".CATPart" & Chr(10))
oSTR.Write ("The Geometrical Set select is : " & oGeoSet.Name & Chr(10))
oSTR.Write (" "& Chr(10))
oSTR.Write ("Line as: 'Name of Parameter = Value' "& Chr(10))
oSTR.Write (" "& Chr(10))
For i = 1 to SubList.Count
Set Parameter = SubList.Item(i)
oSTR.Write (Parameter.Name & " = " & Parameter.ValueAsString & "." & Chr(10) )
REM MsgBox Parameter.Name & " = " & Parameter.ValueAsString
Next
oSTR.Close
MsgBox "Parameters export : " & (i-1) & "x" & Chr(10) & "The file was saved in : " & chr(10) & filename & ".txt"& chr(10)& chr(10) & "Process terminated :D"
End Sub