Doing layer changes in one operation

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
sarlaa
Active Member
Posts: 47
Joined: Mon Aug 28, 2017 4:39 pm

Doing layer changes in one operation

Post by sarlaa » Wed Jun 27, 2018 11:09 am

Hi,

How can I remove a layer, and set an other one as current layer in the same operation.

Thanks

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

Re: Doing layer changes in one operation

Post by andrew » Wed Jun 27, 2018 1:11 pm

Delete layer "layer 1" and make layer "layer 3" the current layer:

Code: Select all

var document=getDocument();
var documentInterface=getDocumentInterface();
var op = new RAddObjectsOperation();
op.deleteObject(document.queryLayer("layer 1"));
var docVars = document.queryDocumentVariables();
docVars.setCurrentLayerId(document.getLayerId("layer 3"));
op.addObject(docVars);
documentInterface.applyOperation(op);

sarlaa
Active Member
Posts: 47
Joined: Mon Aug 28, 2017 4:39 pm

Re: Doing layer changes in one operation

Post by sarlaa » Thu Jun 28, 2018 10:34 am

Thanks

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”