Author Topic: Simulate click on toolbar  (Read 11267 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Simulate click on toolbar
« Reply #15 on: November 11, 2016, 05:59:45 AM »
@lamarn:
Not exactly what you want but here is a MODEMACRO solution that will display the osnaps in the status bar:
Code: [Select]
(setvar "MODEMACRO"
  (strcat
    "$(if,$(=,$(getvar,OSMODE),0),** OSNAPS OFF ** ,)"
    "$(if,$(=,$(and,$(getvar,OSMODE),    1),0),,END )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    2),0),,MID )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    4),0),,CEN )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    8),0),,NOD )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   16),0),,QUA )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   32),0),,INT )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   64),0),,INS )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  128),0),,PER )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  256),0),,TAN )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  512),0),,NEA )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 1024),0),,GCE )" ; Geometric center (BricsCAD).
    "$(if,$(=,$(and,$(getvar,OSMODE), 2048),0),,APP )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 4096),0),,EXT )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 8192),0),,PAR )"
    "$(if,$(=,$(and,$(getvar,OSMODE),16384),0),,** OSNAPS OFF ** )"
  )
)

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Simulate click on toolbar
« Reply #16 on: November 11, 2016, 08:24:02 AM »
Assuming I've understood the request, this thread may be of interest.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Simulate click on toolbar
« Reply #17 on: November 11, 2016, 08:37:11 AM »
I am still trying to understand this. Is the object for the user to hoover there mouse over the icon and the command in the icon activates?
Civil3D 2020

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Simulate click on toolbar
« Reply #18 on: November 11, 2016, 08:58:59 AM »
@lamarn:
Not exactly what you want but here is a MODEMACRO solution that will display the osnaps in the status bar:
Code: [Select]
(setvar "MODEMACRO"
  (strcat
    "$(if,$(=,$(getvar,OSMODE),0),** OSNAPS OFF ** ,)"
    "$(if,$(=,$(and,$(getvar,OSMODE),    1),0),,END )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    2),0),,MID )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    4),0),,CEN )"
    "$(if,$(=,$(and,$(getvar,OSMODE),    8),0),,NOD )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   16),0),,QUA )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   32),0),,INT )"
    "$(if,$(=,$(and,$(getvar,OSMODE),   64),0),,INS )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  128),0),,PER )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  256),0),,TAN )"
    "$(if,$(=,$(and,$(getvar,OSMODE),  512),0),,NEA )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 1024),0),,GCE )" ; Geometric center (BricsCAD).
    "$(if,$(=,$(and,$(getvar,OSMODE), 2048),0),,APP )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 4096),0),,EXT )"
    "$(if,$(=,$(and,$(getvar,OSMODE), 8192),0),,PAR )"
    "$(if,$(=,$(and,$(getvar,OSMODE),16384),0),,** OSNAPS OFF ** )"
  )
)
Maybe this is simple:
Code: [Select]
(defun sample ( / CurStr)
  (setq CurStr "")
  (mapcar
           '(lambda (x s)
              (if (= (logand x (getvar "OSMODE")) x) (setq CurStr (strcat CurStr s)))
            )
           '(1 2 4 8 16 32 64 128 256 512 2048)
           '("_Endpoint," "_Midpoint," "_Center," "_Node," "_Quadrant," "_Intersec," "_Insert,"
             "_Perpend,"  "_Tangent,"  "_Nearest,""_Appint,"
  ) )
  (setvar "USERS5" (strcat " " (substr CurStr 2 (- (strlen CurStr) 2)) "."))
  (setvar "MODEMACRO" "[$(getvar,users5)]")
)

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Simulate click on toolbar
« Reply #19 on: November 11, 2016, 09:59:57 AM »
Maybe this is simple:
Your suggestion only displays the current settings in the statusbar. My suggestion will update automatically whenever the osmode changes.

lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #20 on: November 11, 2016, 10:32:03 AM »
I was thinking more about a OpenDCL approach. Found a a modeless form has what i am looking for..
http://www.opendcl.com/forum/index.php?topic=2446.msg12208#msg12208
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Simulate click on toolbar
« Reply #21 on: November 11, 2016, 11:04:53 AM »
Maybe this is simple:
Your suggestion only displays the current settings in the statusbar. My suggestion will update automatically whenever the osmode changes.
You're right, I apologize. I change the osnaps only with a specific function...

hmspe

  • Bull Frog
  • Posts: 362
Re: Simulate click on toolbar
« Reply #22 on: November 11, 2016, 11:28:43 AM »
AcadStatButton available from manusoft.com in the Freebies/Miscellaneous tab will let you add buttons to the status bar which will toggle.  I have attached the lisp file I used with AcadStatButton before I switched to Bricscad. 
"Science is the belief in the ignorance of experts." - Richard Feynman

lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #23 on: November 11, 2016, 12:37:10 PM »
Thanks so much Richard and all of you guys!
This is looking promising.. To me the great value of the forum community to share and combine ideas is a real fact!!
Design is something you should do with both hands. My 2d hand , my 3d hand ..

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Simulate click on toolbar
« Reply #24 on: November 12, 2016, 03:49:54 PM »
FWIW: I have posted an ODCL-based solution here.

lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #25 on: November 13, 2016, 05:14:55 PM »
Lets discuss this Opendcl sollution furhter on there.
But here is a screenshot i am happy to share ..! nice job, all credits to you mr. Roy_043
I am very thankful for your help getting this on track..!  :-D

*EDIT* updated a gif
« Last Edit: November 16, 2016, 04:13:50 PM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #26 on: November 16, 2016, 04:14:51 PM »
Credits to mr. Roy_04 for making this fine piece of machine buttons .. :wideeyed2:
Design is something you should do with both hands. My 2d hand , my 3d hand ..

lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #27 on: January 16, 2017, 05:01:11 PM »
Hi

I'm trying to come up with a toggle (refresh) button..
The main .lsp is OpenDcl and this if functions calls a subroutine, this seem to work

Any experience idea to make this more elegant or how this can work better much appriciated.
Even better would be is the toolbar was to come just by pressing F3, but that would need some kind of reactor..

** EDIT
By Using  (progn (load "Osnaps") (dcl-Form-Close Osnaps/Main) ())) it supresses the OpenDCL warning
**

; "Osnaps" by Roy_043
http://www.opendcl.com/forum/index.php?topic=2446.msg12212#msg12212


Code: [Select]

(defun c:Tbar_osnap ()
    (setvar "userr1"
        (abs   
            (1-
                (getvar "userr1")
            )
        )
    )

  (setq tbmode (rtos (getvar "userr1") 2 0))

  (if (= tbmode "1")
    (load "Osnaps") ())

  (if (= tbmode "0")
     (progn (load "Osnaps") (dcl-Form-Close Osnaps/Main) ())) ; ** EDIT **

    (princ)
)

« Last Edit: January 17, 2017, 02:45:52 AM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Simulate click on toolbar
« Reply #28 on: January 17, 2017, 01:41:36 PM »
I have updated the code. See here.
A keyboard shortcut (e.g. F3) can be created for the new c:Osnap-FormToggle function.


lamarn

  • Swamp Rat
  • Posts: 636
Re: Simulate click on toolbar
« Reply #29 on: January 17, 2017, 04:23:17 PM »
Super, thank Roy!!  :yay!:
Sorry for asking but how could c:Osnap-FormToggle than best be added to F3, ..knowing OpenDCL is running

acad says F3 does this
^P'_.osmode $M=$(if,$(and,$(getvar,osmode),16384),$(-,$(getvar,osmode),16384),$(+,$(getvar,osmode),16384))

tried these two mods but it doesn't work out.. :

^P'_.osmode $M=$(if,$(and,$(getvar,osmode),16384),$(-,$(getvar,osmode),16384),$(+,$(getvar,osmode),16384)),c:Osnap-FormToggle
^P'Osnap-FormToggle;_.osmode $M=$(if,$(and,$(getvar,osmode),16384),$(-,$(getvar,osmode),16384),$(+,$(getvar,osmode),16384))
Design is something you should do with both hands. My 2d hand , my 3d hand ..