Removing an image entity

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
s4eed
Junior Member
Posts: 18
Joined: Fri Sep 27, 2013 3:23 pm

Removing an image entity

Post by s4eed » Tue May 13, 2014 8:51 am

Hello dear friends.
I add an image entity to my map using this code :

Code: Select all

	var i = new RImageEntity(
		document,
			 new RImageData("scripts/MyScripts/tick.png",
							new RVector(0,0),
							new RVector(1,0),
							new RVector(0,1),
							50, 50, 0)
	);
	documentInterface.setRelativeZero(point);
	i.setWidth(2);
	i.setHeight(2);

	i.setInsertionPoint(point);
	TickImageEntites[entId] = i;
Suppose that entId is a unique key associated to each ImageEntity and TickImageEntites is something like this :

Code: Select all

var TickImageEntites = {};
Then I want to remove all of this image entities inside TickImageEntites using this code :

Code: Select all

		for (var k in TickImageEntites) {
			QMessageBox.information(0,"msg", "id:"+k);
			var op = new RDeleteObjectOperation(TickImageEntites[k], false);
                        di.applyOperation(op);
		}

But my code doesn't work at all! What the problem. thanks.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Removing an image entity

Post by andrew » Tue May 13, 2014 11:18 pm

You might want to print TickImageEntites[k] in your for loop, to check if these are valid entities with a valid ID, etc.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”