Page 1 of 1

How do I select all entities inside a box from script

Posted: Wed Oct 23, 2019 1:27 pm
by machinekoder
I want to select all entities inside a box using the cross selection option.

I tried:

Code: Select all


   var d = new RDocument(new RMemoryStorage(), new RSpatialIndexNavel());
    var di = new RDocumentInterface(d);
    if (di.importFile(inFile) != RDocumentInterface.IoErrorNoError) {
        print("Cannot import file:", inFile);
        return 1;
    var ev = new SelectRectangle();
    ev.crossSelection = true;
    ev.point1 = new RVector(0, 0);
    ev.point2 = new RVector(3000, 200);
Which works great in the script console. But once I run it via the CLI I get:
"TypeError: Result of expression 'doc' [undefined] is not an object."
at the selectEntities() line.

What is the correct way to achieve the selection with cross selection enabled?