I'm working on a huge project porting 100+ MDL applications from V8i (*.mc) to Connect Edition (*.cpp).
When printing (to a single PDF), we design everything with a dedicated level on a single view where each page is delimited by means of a rectangle whose cell name indicates the page format and orientation (see example images below)
Previously, we executed a macro that magically printed everything.
This macro includes commands like:
CadInputQueue.SendKeyin "mdl load bentley.printorganizer.dll"
CadInputQueue.SendKeyin "printorganizer new"
CadInputQueue.SendKeyin "printorganizer printerdriver pdf.pltcfg"
CadInputQueue.SendKeyin "printorganizer add file ...."
CadInputQueue.SendKeyin "printorganizer printdestination ..."
CadInputQueue.SendKeyin "printorganizer submitas single"
CadInputQueue.SendKeyin "printorganizer print all"
This macro doesn't seem to work anymore. Entering the command manually from the Key-in dialog, I get "Unknown key-in or command"
I read about the PrintManager and PrintSet classes but they seem to be .NET specific.
Is there a way to do this directly in C++?
We use MicroStation Connect Edition version 10.16.01.56 and corresponding SDK 10.16.00.084
Robert Kock said:CadInputQueue.SendKeyin "mdl load bentley.printorganizer.dll"
I think the name of the assembly has changed. Try this...
CadInputQueue.SendKeyin "mdl load bentley.microstation.printorganizer.dll"
More about VBA and printing.
Regards, Jon Summers LA Solutions
As promised, I'm back.
I managed to make the macro work except for 2 things.
The macro is composed as follows:
' Save DGNActiveDesignFile.Save
' Initialize PrintOrganizerCadInputQueue.SendKeyin "mdl load bentley.printorganizer.dll"CadInputQueue.SendKeyin "PRINTORGANIZER OPENREADONLY " & "myPrintSet.pset"CadInputQueue.SendKeyin "PRINTORGANIZER PRINTERDRIVER pdf.pltcfg"
' Add current DGN with requested stileCadInputQueue.SendKeyin "PRINTORGANIZER ADD ACTIVEFILE " & myStyle
' Create PDFCadInputQueue.SendKeyin "PRINTORGANIZER SUBMITAS SINGLE"CadInputQueue.SendKeyin "PRINTORGANIZER PRINTDESTINATION " & "test.pdf"CadInputQueue.SendKeyin "PRINTORGANIZER PRINT ALL"
' Clean upCadInputQueue.SendKeyin "PRINTORGANIZER DELETE ALL"CadInputQueue.SendKeyin "PRINTORGANIZER SAVEAS " & ActiveWorkspace.ConfigurationVariableValue("TMP", True) & "\dummyPrintSet.pset"CadInputQueue.SendKeyin "PRINTORGANIZER EXIT"
The first problem regards the fact that the active DGN is not added: MicroStation reports some error indicating the file could not be loaded.
When I execute the statement "... ADD ACTIVEFILE..." twice, things work fine.
The very same problem occurs when I try to add the active file from within the PrintOrganizer Dialog.
The second problem is not really urgent and I implemented some workaround within the macro:
I would like to make the macro finish in a clean way but when I EXIT the PrintOrganizer it asks me whether I want to save the changes.
For now, I save the printset in a dummy tempfile but I would like to exit simply discarding the changes in my (read-only) printset.
By the way, myStyle simply sets the page format and orientation and creates a separate page for every encountered cell with a specific name.