LISP - 2D Draw toggle

Discussion of MicroSurvey CAD related issues and questions.

Moderators: Brian Sloman, Jason Poitras, James Johnston

Post Reply
Posts: 1
Joined: Wed Oct 07, 2015 9:16 am

LISP - 2D Draw toggle

Post by Jchilds » Tue Mar 20, 2018 8:23 am


I'm curious if there is a toggle to control 2D Draw Mode via LISP. Also, is there a way to get alpha-numberic points using the get_coordinate LISP command?


User avatar
Brian Sloman
Product Manager
Posts: 407
Joined: Fri Jan 07, 2005 4:42 pm
Location: Westbank, BC, Canada

Re: LISP - 2D Draw toggle

Post by Brian Sloman » Tue Jun 05, 2018 1:57 pm


The (get_coordinate) function is currently only compatible with numeric point IDs.

The 2D Draw Mode state can be accessed through a sysvar called MSI_SYSTEMTOGGLES which is a bit-coded value containing this and various other toggle settings. This sysvar is fairly new and doesn't exist in older versions.
1 = IPN On
2 = IPD On
4 = IPE On
8 = (reserved?)
16 = 2D Draw Mode On
32 = Point Protection On
64 = Point Cloud Visibility On
128 = Point Cloud Snapping On

If you're not familiar with bit-coded variables or how they work, the value is the sum of all the individual toggle settings. So for example if it is 16 then 2D Draw Mode is on and everything else is off, or if it is 19 (1+2+16) then IPN and IPD and 2D Draw Mode are On. So you can get the sysvar value with (getvar "MSI_SYSTEMTOGGLES") and you can check if the appropriate bit is Off or On with (logand), something like:
(if (= 0 (logand 16 (getvar "MSI_SYSTEMTOGGLES"))) (princ "2D Draw Mode is Off") (princ "2D Draw Mode is On"))

It's not the most user-friendly way of accessing a setting, but it will work great within a Lisp routine. It was really intended for internal use to display the state of these settings on their ribbon/toolbar toggle buttons.
Brian Sloman
Development Manager
MicroSurvey Software Inc.

Post Reply