Eventually I need a script that opens multiple .DWG files, makes some changes to all of them and then exports them to .PDF.
Using some of the examples and the documentation I’ve gotten pretty far except there is one problem I keep running into to which is that I don’t seem to be importing the .DWG correctly. When I use the Print class to print to a PDF it does print out the correct dimensions of the paper as I set it up. It just doesn’t show the .DWG I imported.
To import the DWG I just use:
var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
var di = new RDocumentInterface(doc);
di.importFile(“fileToImport.dwg”);
var scene = new RGraphicsSceneQt(di);
var view = new RGraphicsViewImage();
view.setScene(scene,false);
doc.setUnit(RS.Millimeter);
scene.regenerate();
Any pointers to what the correct way for importing is?
Almost 2k views and no one able to give me any hints? I’m wondering if it is needed, just like with the merge.js, to copy and paste every element one by one into a new seperate RDocument or if there is a way to skip all that and just import the .DWG file into the view or scene directly.
Again, if someone can give me any pointers in the right direction that would be awesome. We are using the PRO version.
Your code looks fine. You can verify some things though:
// verify import:
if (di.importFile("fileToImport.dwg") != RDocumentInterface.IoErrorNoError) {
// there was an error while importing the file..
}
// dump imported document to stdout:
doc.dump();