Export to BMP from script file

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
levinsy
Newbie Member
Posts: 6
Joined: Wed Jun 12, 2019 4:38 pm

Export to BMP from script file

Post by levinsy » Thu Jun 13, 2019 4:24 pm

Hi,

I'd like to be able to export a DWG through my custom script file (-autostart). I'm trying to use the BitmapExport.prototype.exportBitmap method but I'm getting the following error:

Warning: RScriptHandlerEcma::eval: script engine exception: "TypeError: Result of expression 'view' [null] is not an object."

I assume it's because I'm instantiating a document and documentInterface as follows:

var doc = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
var di = new RDocumentInterface(doc);

and I assume that that's why there's no view instantiated.

Can you please share the code inside Dwg2Bmp.js so I can see how to do it properly? or rather can you advise on how to resolve this error?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Export to BMP from script file

Post by andrew » Fri Jun 14, 2019 8:53 am

To attach a view (off screen):

Code: Select all

var scene = new RGraphicsSceneQt(di);
var view = new RGraphicsViewImage();
view.setScene(scene, false);

levinsy
Newbie Member
Posts: 6
Joined: Wed Jun 12, 2019 4:38 pm

Re: Export to BMP from script file

Post by levinsy » Fri Jun 14, 2019 11:20 am

Worked. Thanks.

Post Reply

Return to “QCAD 'How Do I' Questions”