Closed MrPiccad closed 3 years ago
Could you provide some examples? I'm not familiar with most of the stuff you mentioned :)
Hi, here is a heavily reduced Sample. You could not run it even if it was complete. It can only be run a a Macro inside Dassault Catia. I put in some extra empty Lines. Hope it helps. The Code starts at ->Sub CATMain
All the Functions ans Subs start here -> Functions and Subs And I would like to open my F + S in a separate Editor.
Thanks and Cheers
------------------- Code below
Option Explicit
Dim Language
Language="VBScript"
'Konstantendeklaration
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim i,j,k ' globale Zaehler
Dim intLevelOfRoutine : intLevelOfRoutine = 1 ' Markierungshilfe fuer RHeader
Dim boolExitFlag : boolExitFlag = False ' BeendenFlag fuer alle Routinen
Dim boolESCSel : boolESCSel = False ' ESC-Flag fuer erweiterte AuswahlRoutinen
Dim intTotalNoOfErrs : intTotalNoOfErrs = 0 ' Fehlerzaehler fuer EvalX-Datei
Dim txtUserName ' Anmeldename
Dim intScrTimer ' Zeitnehmer fuer die Laufzeit, in debux
Dim txtScriptPath ' Hauptpfad der Scripte
Dim intCATIAMinRelease : intCATIAMinRelease = 19
Dim WshShell
Dim fso
Dim ArgList()
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
Sub CATMain()
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
debux 123, ""
'evalx 123, ""
txtScriptPath = getCatScriptPath
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Informationen ueber das aktuelle System zusammenstellen
Call subGetCatiaInformation(intCATIAMinRelease)
If boolExitFlag Then Exit Sub
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Vorauswahl sichern
Dim intSelected
intSelected = CATIA.ActiveDocument.Selection.Count
If intSelected > 0 Then
For i = 1 To intSelected
ReDim Preserve arrObjSelection(i-1)
Set arrObjSelection(i-1) = CATIA.ActiveDocument.Selection.Item(i).Value
debux 1, "Vorauswahl: " & arrObjSelection(i-1).Name
Next
Else
' keine Vorauswahl
ReDim arrObjSelection(-1)
' Elemente in einer Multiselektion auswaehlen
Call funcMultiSelectionMulti( Array("HybridShape", "HybridShapeAssemble"), "Bitte die Elemente waehlen . . .", arrObjSelection)
Call subPrintArrayOO(arrObjSelection, "Liste der gewaehlten Objecte . . .")
End If
CATIA.ActiveDocument.Selection.Clear
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' ein Part automatisch oder manuell waehlen X X X X Ersatz seit 2011-12-04
Set objAPart = funcTHE_BLUES_Part
If boolExitFlag Then Exit Sub
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Startachse auswaehlen
Dim myStartAxis
On Error Resume Next
Set myStartAxis = funcSelection("AxisSystem","Bitte Export-Achse waehlen . . . ESC = AXS1").Value
On Error Goto 0
Err.Clear
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Anweisung der Selection auswerten ' <<<<<<<<<<<ppp
If boolESCSel Then
' AXS1 gewaehlt merken
boolAxis1Selected = True
Else
Dim myTargetAxis
Set myTargetAxis = objAPart.AxisSystems.Add()
objExportLog.WriteLine " Achse " & myStartAxis.Name & " gewaehlt" & vbNewLine
boolAxis1Selected = False
End If
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Object fuer Set zuweisen - aufpassen das das aktive kein Body ist, weil hier
' die gemovete Geometrie zwischengelagert wird
Dim objTargetGeoSet
If TypeName(objTargetGeoSet) = "Body" Then
' Arbeitsset schaffen
Set objTargetGeoSet = objAPart.HybridBodies.Add()
objTargetGeoSet.Name = "TEMP-Set_sofort_Loeschen"
End If
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Hauptschleife zur Auswahl der Elemente nacheinander
For i = 0 To UBound(arrObjSelection)
debux 0, " === bearbeite: " & arrObjSelection(i).Name & " ===" & vbNewLine & vbNewLine
' Element aus dem Array der Vorauswahl zuweisen
Set myElement = arrObjSelection(i)
CATIA.ActiveDocument.Selection.Clear
On Error Resume Next
objMyTempDoc.ExportData CAADoc.Path & "\" & NameIGS, "igs"
intMyErr = Err.Number
On Error Goto 0
debux 0, "Fehlernummer beim Speichern: " & intMyErr
Next
' Ende Hauptschleife
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' Update versuchen
On Error Resume Next
'objAPart.Update
On Error Goto 0
' ab hier das Ende des Scripts einlaeuten --------------------------------------
debux 999, " Script ist ordentlich beendet worden"
End Sub
' ******************************************************************************
' Functions and Subs
' ******************************************************************************
Sub debux(modus, instring)
' an den Benutzer
' Eingabe : 1. Unterroutine
' 2. Meldungstext
' Ausgabe : Meldung in einer Textdatei, im stdout oder als MsgBox
' Bemerkung: Fehler zweiter Kategorie sammeln und ausgeben
' Datum : 2009-01-12
. . .
End Sub 'debux
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
Sub RHeader(modus, instring)
. . .
End Sub 'RHeader
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
Sub subGetCatiaInformation(iMinRelease)
. . .
End Sub 'subGetCatiaInformation
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*
If there was a LSP server for VBScript this would be difficult to implement, but as there dose not appear to be one - it is functionally impossible.
The closest you can get:
Hi, it was just a long shot. The name embedded Editor just sounded too good to be true. I know how to locally search and replace, but it is a delicate matter. If you do not stick to the rule you are lost and the modifications are all over the place. I usually copy the functions in a separate Window and make my modifications. That way it is secure and I can concentrate on the actual changes. It is not a pro tip but it works for me.
Thank you anyway Cheers
Btw. You want to do mass-replace in the embedded editor? But it won’t work because Replace dlg requires the normal Ui-tab. Sorry.
@MrPiccad since this seems important to you, and in case you discarded "Sync Editing" without trying - here is a demo of how it works... disregard if you are aware :)
Hi, I would very much like to configure the "embedded Editor" to edit Functions and Sub in quasi Zen-Mode. It is a feature I absolutely loved from the days of Quickbasic 4.5. You could ( and you could only ) edit your Functions in a separate Window. That included of course the ability to search and replace certain terms only in the scope of that Function. I know there ist that ability hidden somewhere in CudaText. But I do not trust that or rather me. Although I am working on Scripts (that should at least be short) I do have up to 4000 Lines of Code in one Script. If a search and replace operation goes wrong, I have a hard time to fix al the replaces entries.
The Structure of my Functions are those of VBScript, but are in fact .catvbs:
Function funcReadWritePersonalIniFile(tVarName, txtWert, iRWModus) ' Thema : Liesst oder aendert den Wert e i n e r bestimmten Variable ' der persoenlichen Einstellungen. ' Eingabe : 1. Name der Variablen als String . . . End Function
So, is there a way to do it? Thank you very much Cheers