Hi,
I have a bitmap image impoted on my panel in qcad and i have lines and other figures too. There is any way to select only my bitmap? I would like that to select and delete only the image automatically by script.
Many thanks.
[SOLVED] Select only bitmap image
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
[SOLVED] Select only bitmap image
Last edited by sinase on Tue Mar 23, 2021 10:06 am, edited 1 time in total.
- ryancousins
- Premier Member
- Posts: 367
- Joined: Thu Mar 19, 2020 3:47 am
- Location: Michigan, USA
Re: Select only bitmap image
It sounds like maybe you're trying to do this via script? If so I don't know how to do that. But otherwise, you can bring up the selection filter View>Selection Filter and filter by entity type of "Image". Then you would click on one of the selection options, such as "replace current selection".
You could also put the image on it's own layer by itself and limit your selection that way.
Sorry if I wasted your time with the non-script way.
You could also put the image on it's own layer by itself and limit your selection that way.
Sorry if I wasted your time with the non-script way.
- Attachments
-
- selections.png (4.93 KiB) Viewed 7468 times
Re: Select only bitmap image
Thank you for your help ryancousins.
I didn't know about the selection filter option. I would like to work with this option by script way, i don't know if is that possible (in qcad documentation i have not found nothing about this).
I anybody have an idea, thank you.
Regards.
I didn't know about the selection filter option. I would like to work with this option by script way, i don't know if is that possible (in qcad documentation i have not found nothing about this).
I anybody have an idea, thank you.
Regards.
Re: Select only bitmap image
You gave me an idea, when i import the image, i could insert this image with a new layer and by this way i can to hide this image or not if i need it.
Thank you.
Regards.
Thank you.
Regards.
Re: Select only bitmap image
Given an array of entity IDs, you can easily filter out those of a given entity type:
Code: Select all
var ids = doc.queryAllEntities();
for (var i=0; i<ids.length; i++) {
var e = doc.queryObject(ids[i]);
if (e.getType()===RS.EntityImage) {
// entity is an image
}
else {
// entity is not an image
}
}
Re: Select only bitmap image
Hi... In the same line ...
But too slow ...
Regards,
CVH
Code: Select all
var di = this.getDocumentInterface();
var doc = di.getDocument();
var ids = queryAllEntities(false, true , RS.EntityImage) // NOTundone, DOallBlocks, Filter on type
// The amount of images found:
var imgCount = ids.length;
// The first or only image id found:
var imgID = ids[0];
// The image itself:
var imageEntity = doc.queryEntity(imgID);
// Only valid is it exists:
if (isNull(imageEntity)){
return undefined; // Failed: Not a valid entity
}
// An easy way to delete ojects is using simple_create.js
// Include simple.js for that at the top include("scripts/simple.js");
deleteObject(imageEntity);
Regards,
CVH
Re: Select only bitmap image
Hi, finally i took the option to create a new layer and to insert the image in that layer. In this way, i can hide and show the image when i want.
Thank you.
Regards.
Thank you.
Regards.