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

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

Moderator: andrew

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: 5604
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 Developers and Contributors”