Code: Select all
var textID = doc.queryAllEntities(false,false,RS.EntityText);
for(var i = 0;i<textID.length;i++){
// print(ID[i]);
var op = new RMixedOperation();
entity = doc.queryEntity(textID[i]);
op.deleteObject(entity);
di.applyOperation(op);
}
var textBasedID = doc.queryAllEntities(false,false,RS.EntityTextBased);
for(var i = 0;i<textBasedID.length;i++){
// print(ID[i]);
var op = new RMixedOperation();
entity = doc.queryEntity(textBasedID[i]);
op.deleteObject(entity);
di.applyOperation(op);
}
Warning: RDocumentInterface::applyOperation: transaction failed
Warning: RTransaction::deleteObject: entity not editable (locked or hidden layer)
And none of the TextBased or Text entities are removed.
Just for testing I unlocked all the layers in the DWG, and made all the layers visible, but I'm still getting this error. Any ideas?
I found the problem. It was very specific to the .DWG I was using. The problem is fixed now.
Thanks in advance