Using INQ_ENV
The following macro demonstrates the use of INQ_ENV and INQ:
DEFINE Env_check
LINE HORIZONTAL 0,0 300
INQ_ENV 3 {load information in system array}
LET Col (INQ 201) {save color information}
LET Ltype (INQ 301) {save linetype information}
INQ_ENV 2 {load window position in system array}
LET Lower_left (INQ 101) {save lower left point of}
{current window}
LET Upper_right (INQ 102) {upper right point}
YELLOW {new color}
DOT_CENTER {new linetype}
LINE HORIZONTAL 0,50 300
COLOR Col {reset to original color}
LINETYPE Ltype {reset to original linetype}
LINE HORIZONTAL 0,100 300 END
DISPLAY_NO_WAIT ("Look at the OLD window")
WAIT 5
WINDOW -10,-10 350,150 {create a new window}
DISPLAY_NO_WAIT ("Now look at the NEW window")
WAIT 5
WINDOW Lower_left Upper_right
DISPLAY_NO_WAIT ("Back to the OLD window")
WAIT 5
END_DEFINE
The second line of the macro draws a line using the current color and linetype. The remaining lines of the macro are discussed in the following paragraphs.
INQ_ENV 3
If you study the INQ_ENV function in the online help, you see that INQ_ENV inserts data into a section of the system array. The section of the array is specified by the number that follows INQ_ENV. For example, section 0 contains information of the software version number and version string. Section 1 contains information on the current viewport, and so on.
We are interested in section 3, which contains information on catch range, geometry, construction data, text data, and so on.
Each time you use INQ_ENV you overwrite the previous data in that section of the system array.
LET Col (INQ 201)
INQ interrogates the section of the system array that was last written to using INQ_ENV. In our example, the last INQ_ENV wrote to section 3, so INQ interrogates section 3. The specific information depends on the number following INQ.
Look again at the INQ_ENV function in online help, and you see that INQ 201 returns the current geometry color. This value is assigned to the variable Col.
LET Ltype (INQ 301)
The current geometry linetype is assigned to the variable Ltype.
INQ_ENV 2
Information about the current window is inserted in section 2 of the system array.
LET Lower_left (INQ 101)
LET Upper_right (INQ 102)
The lower left point and the upper right point of the current window are assigned to variables.
The next three lines of the macro change the color and linetype, and then draw a line to show the effects of the changes.
COLOR Col
LINETYPE Ltype
The original values for color and linetype are restored. The macro draws another line to show the effects of the changes.
The last few lines of the macro change the coordinates of the current window, and displays this window for approximately five seconds to allow you to see the change. The original coordinates are then restored.
È stato utile?