Page 1 of 1

Detect layer changes

Posted: Tue Jun 26, 2018 1:27 pm
by sarlaa
Hi,

Please, how can I detect layer changes information of a transaction ? (new layer added, removed, or setted as current)

Thanks

Re: Detect layer changes

Posted: Tue Jun 26, 2018 3:03 pm
by andrew
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:

Code: Select all

var adapter = new RLayerListenerAdapter();
appWin.addLayerListener(adapter);
adapter.currentLayerSet.connect(this, "myFunction");

Re: Detect layer changes

Posted: Tue Jun 26, 2018 3:22 pm
by sarlaa
Thanks for your examples.

Re: Detect layer changes

Posted: Wed Jun 27, 2018 11:38 am
by sarlaa
What's the property's constant of : RPropertyTypeId(18, "", "", "", "Current Layer ID") ?
(as RTextEntity.PropertyPositionX for RPropertyTypeId(53, "", "", "Text Position", "X") )

Re: Detect layer changes

Posted: Wed Jun 27, 2018 1:11 pm
by andrew

Code: Select all

REntity.PropertyLayer
These constants are defined in the respective object or entity classes:
https://github.com/qcad/qcad/blob/maste ... /REntity.h
https://github.com/qcad/qcad/blob/maste ... xtEntity.h
etc.

Re: Detect layer changes

Posted: Thu Jun 28, 2018 10:33 am
by sarlaa
Thanks

Re: Detect layer changes

Posted: Fri Jul 06, 2018 3:03 pm
by sarlaa
REntity.PropertyLayer is constant for : RPropertyTypeId(5, "", "", "", "Layer")
when I need constant of : RPropertyTypeId(18, "", "", "", "Current Layer ID")

Thanks.

Re: Detect layer changes

Posted: Fri Jul 06, 2018 3:08 pm
by sarlaa
I found it RDocumentVariables.PropertyCurrentLayerId.

Thanks.

Re: Detect layer changes

Posted: Fri Jul 06, 2018 3:22 pm
by andrew
RDocumentVariables.PropertyCurrentLayerId

See https://github.com/qcad/qcad/blob/maste ... ariables.h