In ecma Scripting How do I check if the layer is empty

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
kinoy
Junior Member
Posts: 11
Joined: Mon Mar 20, 2017 11:21 am

In ecma Scripting How do I check if the layer is empty

Post by kinoy » Wed Mar 29, 2017 8:13 am

Is there any method to check if the layer contents are empty through ecma script when the layer is present.

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

Re: In ecma Scripting How do I check if the layer is empty

Post by andrew » Wed Mar 29, 2017 10:36 am

Code: Select all

var ids = doc.queryLayerEntities(layerId, true);
if (ids.length===0) {
    // there are no entities in any blocks on this layer
}

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”