Hope you missed me (though I doubt it).
After testing the SetRelativeZero, I though that maybe this method wasn't suited for my needs, so I went testing alternatives to see if I come around something preferable, so I tried adding a circle through code. after studying a bit of the Three Points example on the scripting tutorials page, I came up with the following functioning code:
var teste = new RAddObjectsOperation(); //How to add circles. For dummies. I could do it, so can you! vl_Xf = 10; vl_Yf = 10; var point = new RCircleEntity(doc, new RCircleData(new RVector(vl_Xf, vl_Yf), 2)); teste.addObject(point); docInterface.applyOperation(teste);Fantastic.
So my question is: Is there a way to create this object with a specific ID?
I saw in the QCad documentation this contructor. Is this RObject::Id what I'm looking for?
Under the assumption that it was, I searched the RObject Constructor and attempted to create one without much success:
var teste = new RAddObjectsOperation(); vl_Xf = 10; vl_Yf = 10; var ObjCircl = RObject(doc, 999999); var point = new RCircleEntity(doc, new RCircleData(new RVector(vl_Xf, vl_Yf), 2), ObjCircl); teste.addObject(point); docInterface.applyOperation(teste);Not surprisingly, Qcad went Postal on me.
I can do without this function. However that would demand that I create for() instructions that would cycle through the entire entity list just for the sake of deleting the circle, and when dealing with large quantities of entities, this would prove inefficient.Uncaught exception at scripts/IuSYS/FirstWidget/FirstWidget.js:387: Error: -1: Abstract class RObject: Cannot be constructed.
<native>(RDocument(0x74ba308), 999999) at -1
<anonymous>(false) at scripts/IuSYS/FirstWidget/FirstWidget.js:387
<global>() at -1
If this is possible (and the hopeful me is still assuming it is) I may need an example on how to declare and build RObject variables (I believe this is the main focus of my troubles), if no other reason than because the deleteObject also seems to work with it and I'll need it soo, as well, and under the same set of requirements. Provide examples, if possible.
Thank you very much.