entity color to lineweight
Posted: Sun Apr 12, 2020 6:01 pm
Hello all,
I'm writing a script in order to set lineweight of all entities that have specific color. I started with "Dark Green" entities; they should be converted to 0.13mm weight:
Something is not working in QCAD interface, even in Shell entity lineweight is changed. I tested with
Any help will be appreciated. Regards,
David
I'm writing a script in order to set lineweight of all entities that have specific color. I started with "Dark Green" entities; they should be converted to 0.13mm weight:
Code: Select all
var document = EAction.getDocument();
var di = EAction.getDocumentInterface();
var entities = document.queryAllEntities();
var op = new RModifyObjectsOperation();
for (i=0; i<entities.lentgh; i++) {
var entityId = entities[i];
var entity = document.queryEntity(entityId);
var entityColor = entity.getColor();
var entityColorName = entityColor.getName(); // OK til here
if (entityColorName === "Dark Green") {
// set lineweight to 0.13 mm.
entity.setLineweight(-1);
di.applyOperation(op); } } // NOT WORKING.
Code: Select all
entity.getLineweight()
David