how do make a script to import a bitmap

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
widow9098
Newbie Member
Posts: 4
Joined: Thu Apr 02, 2020 4:04 pm

how do make a script to import a bitmap

Post by widow9098 » Sun Apr 12, 2020 10:10 am

hi i am trying to import a bitmap image using the script shell so i a can make a script to import bitmaps automatically

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do make a script to import a bitmap

Post by CVH » Sun Apr 12, 2020 2:47 pm

Widow,
That would be in about the same way as with your other topic.
How did that work out?

See: Image.js
The operation is casted in line 210
The operation is constructed in Image.prototype.getOperation line 215-229
The object 'this.image' is declared in Image.prototype.beginEvent line 67-74
And also destroyed in line 92

Regards,
CVH

widow9098
Newbie Member
Posts: 4
Joined: Thu Apr 02, 2020 4:04 pm

Re: how do make a script to import a bitmap

Post by widow9098 » Sun Apr 12, 2020 5:46 pm

CVH wrote:
Sun Apr 12, 2020 2:47 pm
See: Image.js
where can i find it?

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do make a script to import a bitmap

Post by CVH » Sun Apr 12, 2020 6:08 pm

All the actual open resources you can be found on Github.
https://github.com/qcad/qcad/tree/maste ... Draw/Image

CVH wrote:
Sun Apr 12, 2020 2:47 pm
The other, how did that work out?
Last edited by CVH on Tue Apr 14, 2020 9:24 am, edited 1 time in total.

widow9098
Newbie Member
Posts: 4
Joined: Thu Apr 02, 2020 4:04 pm

Re: how do make a script to import a bitmap

Post by widow9098 » Mon Apr 13, 2020 12:06 pm

CVH wrote:
Sun Apr 12, 2020 2:47 pm
The other, how did that work out?
i couldn't get it working

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

Re: how do make a script to import a bitmap

Post by andrew » Tue Apr 14, 2020 8:49 am

Try this self contained example (adjust path to desired absolute path):

Code: Select all

var document=getDocument();
var e = new RImageEntity(document, new RImageData("/path/to/image.png", new RVector(0,0), new RVector(1,0), new RVector(0,1), 50, 50, 0));
addEntity(e);

Post Reply

Return to “QCAD 'How Do I' Questions”