Removing an image entity

Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Removing an image entity

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

Re: Removing an image entity

Postby 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.
User avatar
andrew
Site Admin
 
Posts: 2619
Joined: Fri Mar 30, 2007 6:07 am


Return to QCAD 3 Developers and Contributors

Who is online

Users browsing this forum: No registered users and 0 guests