I'm working on a script in which I use some lines as a reference, and then I'd like to remove them when I don't need them anymore, but deleting causes QCad to crash... Here's some stripped-down code:
Code: Select all
MyEx.prototype.coordinateEvent = function(event) {
p1 = event.getModelPosition();
var docI = this.getDocumentInterface();
docI.setRelativeZero(p1);
//Line
p2 = p1.operator_add(RVector.createPolar(+1.0, RMath.deg2rad(90)));
line = Line.createLineEntity(this.getDocument(), p1, p2, Line.LineType.Ray);
//Add line
var addOp = new RAddObjectsOperation();
addOp.addObject(line, false);
docI.applyOperation(addOp);
//Delete line
var delOp = new RDeleteObjectsOperation();
delOp.deleteObject(line);
docI.applyOperation(delOp);
}
I don't get if I'm doing something wrong, or you simply can't delete entities via a script...Contents$ MacOS/QCAD -enable-script-debugger
QCAD version 3.19.1
20:57:21: Debug: RDxfPlugin::init
Warning: RScriptHandlerEcma::RScriptHandlerEcma: script debugger enabled! Not recommended.
Warning: RScriptHandlerEcma::RScriptHandlerEcma: script debugger enabled! Not recommended.
Segmentation fault: 11
Anyone can help?
Thank You!