How do I select all entities inside a box from script

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
Post Reply
Newbie Member
Posts: 4
Joined: Tue Oct 15, 2019 1:55 pm

How do I select all entities inside a box from script

Post by machinekoder » Wed Oct 23, 2019 1:27 pm

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?

Post Reply

Return to “QCAD 'How Do I' Questions”