Using QCAD known variables in ECMAscript?

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
MikeMillerPE
Junior Member
Posts: 10
Joined: Sat Jun 02, 2018 7:59 pm
Location: Walnut Creek, CA

Using QCAD known variables in ECMAscript?

Post by MikeMillerPE » Sat Jun 02, 2018 8:46 pm

Hi,

From the QCAD docs, there's a class called RS Class Reference that defines LIMMIN and LIMMAX as KnownVariables. I am wondering is there is a way to access global variables like these from within the ECMAscript environment?

Thank you :D
Mike Miller, P.E.

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

Re: Using QCAD known variables in ECMAscript?

Post by andrew » Mon Jun 04, 2018 4:18 pm

Yes:
RS.LIMMIN
RS.LIMMAX

MikeMillerPE
Junior Member
Posts: 10
Joined: Sat Jun 02, 2018 7:59 pm
Location: Walnut Creek, CA

Re: Using QCAD known variables in ECMAscript?

Post by MikeMillerPE » Sun Jun 17, 2018 6:55 pm

Hi Andrew,

I tried:

Code: Select all

var min = RS.LIMMIN;
var max = RS.LIMMAX;
appWin.handleUserInfo("Min = " + min + " max = " + max);
The output is:
Min = 91 max = 90
but these always return 91, and 90, respectively.
Are these pointers to the actual values? I expect each to have a pair of coordinates, so I tried

Code: Select all

values = min.getData();
with no success. Please advise.
Mike Miller, P.E.

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

Re: Using QCAD known variables in ECMAscript?

Post by andrew » Wed Jun 20, 2018 1:50 pm

RS.LIMMIN, RS.LIMMAX are constants used to identify these header variables. These are not the actual values of these variables.

To query the value for a document, you can use:

Code: Select all

document.getKnownVariable(RS.LIMMIN);

Post Reply

Return to “QCAD 'How Do I' Questions”