How to open a new drawing in 3Dexperience VBA
In CATIA V5, if you want to open a new drawing with a macro, you would use code like this:
Dim oProduct As Object
Set oProduct = CATIA.Documents.Add(“Drawing”)
To do the same thing in CATIA V6, use this macro:
Dim sWorkBenchID As String
sWorkBenchID = CATIA.GetWorkbenchID
Debug.Print “sWorkbenchID=” & sWorkbenchID
Dim oNewService As PLMNewService
Set oNewService = CATIA.GetSessionService(“PLMNewService”)
Dim oEditor As Editor
oNewService.PLMCreate “Drawing”, oEditor
You can also use the StartCommand in CATIA V6 to create a new drawing:
Dim oProduct As Object
CATIA.StartCommand “Drawing”
On Error Resume Next
Set oProduct = CATIA.ActiveEditor.ActiveObject
That’s all there is to it! Would you like to see more V6 macros? Let us know in the comments below!