How to get currently editing block name in Script Shell

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

Post Reply
User avatar
dfriasb
Senior Member
Posts: 102
Joined: Thu Mar 10, 2016 1:08 pm
Location: Calafell, Tarragona, Spain

How to get currently editing block name in Script Shell

Post by dfriasb » Sat Dec 07, 2019 3:59 pm

Dear all,

I can't find the way to get the Id of the block that I am editing right now. I have all the block Ids with these line:

Code: Select all

var blockIds = document.queryAllBlocks();
Then I should find "currently editing" block somehow...
And then apply:

Code: Select all

var block = document.queryBlock(blockId);
var blockName = block.getName();
where block is the blockId that I'm looking for.

I'm also asking myself if document variable definition line should be diferent. I'm writing this one:

Code: Select all

var document = this.getDocument();
or

Code: Select all

var document = this.getDocumentInterface();
Does exist any getBlockDocument like? I mean get document entities only inside some block...

Any help will be very welcomed!
David Frías Barranco | architect
[email protected] | davidfriasarquitecto.es

User avatar
andrew
Site Admin
Posts: 6660
Joined: Fri Mar 30, 2007 6:07 am

Re: How to get currently editing block name in Script Shell

Post by andrew » Tue Dec 10, 2019 2:25 pm

dfriasb wrote:
Sat Dec 07, 2019 3:59 pm
I can't find the way to get the Id of the block that I am editing right now.

Code: Select all

var blockId = doc.getCurrentBlockId();
dfriasb wrote:
Sat Dec 07, 2019 3:59 pm
I mean get document entities only inside some block...

Code: Select all

doc.queryBlockEntities(blockId);

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”