Page 1 of 1

RAddObjectsOperation

Posted: Fri Sep 28, 2018 11:12 am
by pmbrull
Hello and thank you for your time,

When using RAddObjectOperation, is it possible to also change the REntity properties?

What I am trying to achieve is:

Code: Select all

var hatch = new RHatchEntity(document, hatchData);
hatch.setColor(new RColor(0, 0, 255, 1));
hatch.setLayerId(MyLayerId);

var op = new RAddObjectOperation(hatch, true, true);
di.applyOperation(op);
However, the object that gets added still keeps the default properties of belonging to layer 0 and being colored by layer.

Thank you,
Pere

Re: RAddObjectsOperation

Posted: Fri Sep 28, 2018 11:22 am
by andrew
pmbrull wrote:
Fri Sep 28, 2018 11:12 am

Code: Select all

var op = new RAddObjectOperation(hatch, true, true);
The second argument of the constructor means "useCurrentAttributes", i.e. ignore the attributes assigned to the entity and use the current attributes. This is also the default, so you need to change this to false to keep the attributes assigned to your entity:

Code: Select all

var op = new RAddObjectOperation(hatch, false);

Re: RAddObjectsOperation

Posted: Fri Sep 28, 2018 11:38 am
by pmbrull
Works like a charm,
Thanks :)