Detect layer changes
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.
Detect layer changes
Hi,
Please, how can I detect layer changes information of a transaction ? (new layer added, removed, or setted as current)
Thanks
Please, how can I detect layer changes information of a transaction ? (new layer added, removed, or setted as current)
Thanks
Re: Detect layer changes
I've updated the transaction listener example to show information about created / deleted objects:
https://github.com/qcad/qcad/blob/maste ... istener.js
You can check if an object is a layer using isLayer(obj).
For the current layer, you can look into the changed objects using a transaction listener, or install a separate layer listener:
https://github.com/qcad/qcad/blob/maste ... istener.js
You can check if an object is a layer using isLayer(obj).
For the current layer, you can look into the changed objects using a transaction listener, or install a separate layer listener:
Code: Select all
var adapter = new RLayerListenerAdapter();
appWin.addLayerListener(adapter);
adapter.currentLayerSet.connect(this, "myFunction");
Re: Detect layer changes
Thanks for your examples.
Re: Detect layer changes
What's the property's constant of : RPropertyTypeId(18, "", "", "", "Current Layer ID") ?
(as RTextEntity.PropertyPositionX for RPropertyTypeId(53, "", "", "Text Position", "X") )
(as RTextEntity.PropertyPositionX for RPropertyTypeId(53, "", "", "Text Position", "X") )
Re: Detect layer changes
Code: Select all
REntity.PropertyLayer
https://github.com/qcad/qcad/blob/maste ... /REntity.h
https://github.com/qcad/qcad/blob/maste ... xtEntity.h
etc.
Re: Detect layer changes
REntity.PropertyLayer is constant for : RPropertyTypeId(5, "", "", "", "Layer")
when I need constant of : RPropertyTypeId(18, "", "", "", "Current Layer ID")
Thanks.
when I need constant of : RPropertyTypeId(18, "", "", "", "Current Layer ID")
Thanks.
Re: Detect layer changes
I found it RDocumentVariables.PropertyCurrentLayerId.
Thanks.
Thanks.
Re: Detect layer changes
RDocumentVariables.PropertyCurrentLayerId
See https://github.com/qcad/qcad/blob/maste ... ariables.h
See https://github.com/qcad/qcad/blob/maste ... ariables.h