Deleting/removing entities *updated & SOLVED*

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
GnrlSchnavy
Newbie Member
Posts: 8
Joined: Fri Aug 18, 2017 2:58 pm

Deleting/removing entities *updated & SOLVED*

Post by GnrlSchnavy » Thu Aug 31, 2017 3:42 pm

Alright, I sort of figured it out. But now, using this code:

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);
	}
I'm getting these errors:

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 :)

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”