一、使用Design Review 2008的批打印
May 10, 2007
Automating batch printing of DWF files using Design Review 2008
We sometimes receive questions on how best to automate the printing of DWF files. Autodesk Design Review 2008 now has a new Batch Print Plug-in enabling just this.
Once you've installed the plug-in, you'll be able to use the Batch Print Wizard in Design Review (on the file menu, once a DWF has been loaded). This Wizard allows you to configure a batch job for Design Review to process and save it to a BPJ (Batch Print Job) file. This BPJ (which is basically a very simple XML file) can then be used to drive the batch print process automatically.
The next logical step is clearly to create the BPJ programmatically, which can be done using a number of XML libraries (MS XML etc.) or simply by writing out a text file using your favourite string output routines.
So let's look at creating the BPJ file "manually" using the Batch Print Wizard.
Here's the second screen you'll see, once you've skipped the welcome:
rf0vwp3firu.png
When you've selected the files you wish to print and added them to the right-hand side using the ">" button, you can move on to the next page:
l4oi5lyxr1o.png
This is where you modify the print setup for each of your DWFs, by clicking on the item and hitting "rint Setup", or just double-clicking the item.
4ohs0a2yuzx.png
And then you're ready to save the BPJ file (or just "rint" directly).
I saved mine as "c:\My Documents\MyFiles.bpj", and here are its contents, with additional whitespace added for readability:复制代码This is clearly straightforward to create programmatically from your application. The next question is how best to automate the print process, now we have our BPJ.
The simplest way is to call the Design Review executable with the BPJ file as a command-line argument:
i0nyawrmnh0.png
The executable returns straight away, and you'll see a log file created in the same location as the BPJ (in my case "c:\My Documents\MyFiles.log"), detailing the results of the print job:复制代码This log file can be parsed programmatically if it's important for your application to know whether any pages had difficulty printing.
二、使用NetApi实现简单的打印任务
September 25, 2007
Driving a basic AutoCAD plot using .NET
I just missed my connecting flight in Chicago, so have 3 hours to pass until the next, and decided to post some code I finally got around to writing on the plane from Zurich.
I've had a few requests for code showing how to plot using the .NET API in AutoCAD. There's an existing ObjectARX (C++) sample on the SDK, under samples/editor/AsdkPlotAPI, but there isn't a publicly posted .NET version right now.
Here's the C# code I put together. Please bear in mind that it was written during less than ideal coding conditions, and I haven't spent a substantial amount of time going through it... it seems to work fine for me, but do post a comment if you have trouble with it.