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
It used to be "bentley.microstation.printorganizer.dll" but I changed it into "bentley.printorganizer.dll" since I read somewhere in this forum that it had changed.
Anyway, I tried to change it back to what you suggested but unfortunately, I get the same result.
Robert Kock said:I changed it into "bentley.printorganizer.dll"
You're right and I'm wrong...
Directory of C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\Assemblies
02/12/2021 14:18 1,898,896 Bentley.PrintOrganizer.dll
Maybe MS doesn't find the dll when I type "mdl load bentley.printorganizer.dll".
Should I tell MS to search within the Assemblies directory? If so, how?
In MicroStation CONNECT:
I tried to load the printorganizer (both with and without the dll suffix). Unfortunately, the successive keyin command ("printorganizer new") tells me "Unkonwn key-in or command"
I am using an internal pre-release MSCE U16.3 build (to release soon) and although I do not use printorganizer much; the Print Organizer Key-ins; like ones you provide in your script above; appear to be working for me.
mdl load Bentley.PrintOrganizer;PrintOrganizer New;printorganizer printerdriver pdf.pltcfg
If I send the (asynchronous) keyin above then manually keyin "printorganizer dialog" and try to close the dialog - it does have the pdf- pltcfg drive loaded and prompts me to Save the Untitled printset.
I guess I found the problem (though I haven't solved it yet):
We apply some filters on keyin commands and for some reason the first one (load dll) was rejected.
I'm working on it and I'll be back.
Thanks so far
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.