Possibilities for menu, dynamic buttons

Started by hanslammerts, November 09, 2016, 02:39:39 PM

Previous topic - Next topic

roy_043

@Hans:
Although the code does contain a portion to hide the GCE button and reduce the width of the dialog, your last post surprises me for two reasons:
1.
The code should only hide the GCE button if it is visible and therefore should execute only once per CAD-session.
2.
The code should not run on AC 2016 and 2017.

To find the cause of the problem change line 48-61 to:
Code (autolisp) Select
  (if
    (and
      (print Osnaps/Main)
      (print Osnaps/Main/btnGce)
      Osnaps/Main/btnGce ; To be absolutely safe.
      (print (dcl-Control-GetVisible Osnaps/Main/btnGce))
      (if (= "BRICSCAD" (strcase (getvar 'product)))
        (> 16 (atoi (getvar '_vernum)))
        (> 2016 (atoi (substr (print (ver)) 13))) ; https://www.theswamp.org/index.php?topic=36606.msg416136#msg416136
      )
    )
    (progn
      (dcl-Control-SetVisible Osnaps/Main/btnGce nil)
      (dcl-Control-SetWidth Osnaps/Main (- (dcl-Control-GetWidth Osnaps/Main) 32)) ; 32 is the button distance.
    )
  )

And report what you see in the Command Bar when the dialog is first displayed and then closed and reopened.

Peter2

Can you provide a screencast to show what is happening?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

hanslammerts

#17
Turns out i did something to the that did it.  :-\
I have one thing that would be benificial, a Z/Z button for OSNAPZ like ON/OFF for osnap.

;;  (setq osmz (getvar 'osnapz))  ;; etc... etc..
inspiration: https://apps.autodesk.com/ACD/en/Detail/Index?id=9014648650809523218&appLang=en&os=Win32_64

roy_043

@Hans:
For me the main goal of this little project was managing a modeless form across drawings, including drawings where the Lisp code is not loaded (two of the three reactors are there for this purpose). It was never my intention to create the 'perfect' Osnap toolbar. You are right: OSNAPZ plays a role, but so do OSOPTIONS and 3DOSMODE. Feel free to add buttons for any or all of these variables. I won't. ;D

hanslammerts

Ok. respect that, really like to thank you for your time & effort. I like it allready as it is,  but there is allways something to wish for ;-)
While i'm using it i noticed i keep using the F3 key a Z osnap would therfore be more welcome, ..to me..

scott_cd

Thanks for sharing this - What a fabulous function.

I have taken the liberty of adding a couple of buttons and changing the colours of the buttons.

I have added the following buttons: m2p .xy and OsnapZ

I am afraid that I wasn't able to update the reactors as it is beyond my skill level.

Thanks again

Scott CD


roy_043

#21
Since, apparently, the code is hard to understand for the average Lisper, I have changed my mind and have added an OZ (OSNAPZ) button. By using three separate update functions I hope that others will find the code easier to modify and extend.
See reply #3 for the updated version.

hanslammerts

#22
Fantastic you made osnapz running so good Roy_043!!
What i did to it, is turning line 258 into this .. little tweak that i find usefull as graphical feedback by showing grid indicating Z is locked.
Will work great in 3D i know! Looks like the Revit 'show plane' & 'pick plane' option. However, with AutoCAD you still have a lot more freedom in 3D imo..

(defun c:Osnaps/Main/btnOsnapz#OnClicked () (progn ((setvar 'osnapz (boole 6 (getvar 'osnapz) 1)) (setvar 'gridmode (boole 6 (getvar 'gridmode) 1)) (princ))))

roy_043

Showing the grid if OSNAPZ is On can be useful. But your code simply toggles the GRIDMODE independently from the OSNAPZ. So if the user has OSNAPZ=0 and GRIDMODE=1, clicking the OZ button will result in OSNAPZ=1 and GRIDMODE=0.
A better solution would be:
Code (autolisp) Select
(defun c:Osnaps/Main/btnOsnapz#OnClicked () (setvar 'gridmode (setvar 'osnapz (boole 6 (getvar 'osnapz) 1))) (princ))

hanslammerts

#24
Even better! Hold that thought for updating the code ( #3 ) :)
I set GRIDDISPLAY = 15 (adoptive and beyond limits) by default

(dcl-Form-Show Osnaps/Main 750 0)
To start at top bottom

roy_043


hanslammerts

#26
Allright..!  like it Roy !)




roy_043


hanslammerts

#28
I decided to use it as F3. But you can set it F4 as well as this is by default the 3D objectsnap function..

hanslammerts

Hi Roy
It needs a .._reset function for its location.
I noticed that it can stay on the disconected monitor..