Author Topic: seeing a variable..  (Read 3615 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
seeing a variable..
« on: January 09, 2006, 03:49:05 PM »
Hi all,

i'm trying to find a way to see a variable..

let me explain...
i have created a variable "SMODE" available for all user to set 1 or 0
if this variable is set to 1......some program running if some command are activated....otherwise not.

this variable work good, but the problem is: the users need to type "SMODE" to see if it set to 1 or 0.

So I need your experience to quickly view this variable.
I have tought of a menu swiching depending this variable...
or a permanant Icon....or any idea will be accepted.

(don't want to use "modemacro" other software conflict.)

thanks.

Keep smile...

Crank

  • Water Moccasin
  • Posts: 1503
Re: seeing a variable..
« Reply #1 on: January 09, 2006, 05:07:47 PM »
Code: [Select]
(defun c:foo ()
   (defun sbc (back cross snap / )
(vl-load-com)
(setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
(setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object))))
(vla-put-GraphicsWinModelBackgrndColor disp back)
(vla-put-GraphicsWinLayoutBackgrndColor disp back)
(vla-put-LayoutCrosshairColor disp cross)
(vla-put-ModelCrosshairColor disp cross)
(vla-put-AutoTrackingVecColor disp cross)
(vla-put-AutoSnapMarkerColor drafting snap)
(princ)
   )
   (if (eq SMODE 1)(sbc 0 16777215 2)(sbc 4987163 16777215 2))
   (princ)
)
:lol:
Vault Professional 2023     +     AEC Collection

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: seeing a variable..
« Reply #2 on: January 09, 2006, 05:23:59 PM »
yeah, that would let you "see" it :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Crank

  • Water Moccasin
  • Posts: 1503
Re: seeing a variable..
« Reply #3 on: January 09, 2006, 05:37:23 PM »
Here's another one, but it needs a reactor to stay visible after a zoom/pan:
Code: [Select]
;; =======================================
;;   Green border - J.J.Damstra 18-09-04
;; =======================================
(defun greenborder (/ CPx CPy ssize height width bwidth Xmin Ymin Xmax Ymax plist p1 p2 p3 p4)
;find screen position
(setq CPx (car (getvar "viewctr")) CPy (cadr (getvar "viewctr")))
(setq ssize  (getvar "screensize"))
(setq height (getvar "viewsize"))
(setq width  (* height (/ (car ssize)(cadr ssize))))
(setq bwidth (* -0.02 height)); offset
;find border corners
(setq Xmin (- CPx (/ width  2.0) bwidth) Ymin (- CPy (/ height 2.0) bwidth))
(setq Xmax (+ CPx (/ width  2.0) bwidth) Ymax (+ CPy (/ height 2.0) bwidth))

(setq bwidth (* 0.075 bwidth)); ctc borderlines
(setq plist '(-3)); default color = dashed green

(repeat 5
(setq Xmin (+ Xmin bwidth) Xmax (- Xmax bwidth))
(setq Ymin (+ Ymin bwidth) Ymax (- Ymax bwidth))

(setq p1 (list Xmin Ymin) p2 (list Xmax Ymin))
(setq p3 (list Xmax Ymax) p4 (list Xmin Ymax))

(setq plist (append plist (list p1 p2)))
(setq plist (append plist (list p2 p3)))
(setq plist (append plist (list p3 p4)))
(setq plist (append plist (list p4 p1)))
)
(grvecs plist); draw border
)
Vault Professional 2023     +     AEC Collection

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: seeing a variable..
« Reply #4 on: January 09, 2006, 05:54:43 PM »
or you could have a look for the AcadStatButton library

from Owen, here: http://www.manusoft.com/Software/Freebies/Index.stm

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: seeing a variable..
« Reply #5 on: January 09, 2006, 06:36:52 PM »
Also...

It can be done also using a toolbar button, to react according to the value of the variable as if where a toggle button... to place the appropriate icon image.

I have done it in ARX and with VisualLISP... some of these days I will make it available for the public.


Have fun.
Luis.

Crank

  • Water Moccasin
  • Posts: 1503
Re: seeing a variable..
« Reply #6 on: January 09, 2006, 06:45:12 PM »
Something like this (from acadx.com):
Code: [Select]
(defun ax:ChangeBitmap (mnuGroup tbrName btnName bitmap)
  (vl-load-com)
  (vla-setbitmaps
    (vla-item
      (vla-item
(vla-get-toolbars
  (vla-item (vla-get-menugroups (vlax-get-acad-object))
    mnuGroup
  )
)
tbrName
      )
      btnName
    )
    bitmap
    bitmap
  )
  (princ)
)

Purpose
Changes the button top for the specified toolbar button

Arguments
The name of the menu group, the name of the toolbar, the name of the toolbar button and the bitmap to use

Example
(ax:ChangeBitmap "acad" "dimension" "linear dimension" "test.bmp")

Notes
If the bitmap is not in the AutoCAD search path, you must specify the full path to file
Vault Professional 2023     +     AEC Collection

LE

  • Guest
Re: seeing a variable..
« Reply #7 on: January 09, 2006, 07:16:53 PM »
Good find... not the same approach... but does the job.

uncoolperson

  • Guest
Re: seeing a variable..
« Reply #8 on: January 09, 2006, 08:02:37 PM »
isn't there a way to fool with the application title bar?

if not that then make two menu files, when one is loaded the variable is 0 (we assume) the menu file includes only one pulldown menu (which states the variable is 0 and the only item in it is to reset the variable, which also unloads that menu file and loads another one that is the opposite...or something like that (whoo i confused myself)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: seeing a variable..
« Reply #9 on: January 09, 2006, 08:23:14 PM »
Yep, you could change the application title bar string .. but that would be a little pretentious perhaps.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

GDF

  • Water Moccasin
  • Posts: 2084
Re: seeing a variable..
« Reply #10 on: January 10, 2006, 08:51:44 AM »
Code: [Select]
Also...

It can be done also using a toolbar button, to react according to the value of the variable as if where a toggle button... to place the appropriate icon image.

I have done it in ARX and with VisualLISP... some of these days I will make it available for the public.


Have fun.
Luis.

Luis

I have seen your application of this. I hope you make it available soon.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2084
Re: seeing a variable..
« Reply #11 on: January 10, 2006, 09:04:41 AM »
Crank

Tested the code. Kool. Works up to 2005. I could not get it to work in 2006.

Code: [Select]
(defun ax:ChangeBitmap (mnuGroup tbrName btnName bitmap)
  (vl-load-com)
  (vla-setbitmaps
    (vla-item
      (vla-item
(vla-get-toolbars
  (vla-item (vla-get-menugroups (vlax-get-acad-object))
    mnuGroup
  )
)
tbrName
      )
      btnName
    )
    bitmap
    bitmap
  )
  (princ)
)

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Andrea

  • Water Moccasin
  • Posts: 2372
Re: seeing a variable..
« Reply #12 on: January 10, 2006, 10:49:17 AM »
wow !!

thanks for suggestions...

nice work..

the menu switching seem interesting..
but as tell...not working for 2006. :|
Keep smile...

GDF

  • Water Moccasin
  • Posts: 2084
Re: seeing a variable..
« Reply #13 on: January 13, 2006, 08:38:27 AM »
The first time I tested this:
(ax:ChangeBitmap "acad" "dimension" "linear dimension" "arch.bmp")
I could not get it to work in 2006, and with no error messages.

Well last night I tried it again on my menu and it worked fine.
(ax:ChangeBitmap "ARCH" "Arch Programİ" "UTIL" (strcat ARCH#IMAF "ARCH_UTILX.bmp"))

If it can't find the bitmap, you get an error message.


Code: [Select]
(defun ax:ChangeBitmap (mnuGroup tbrName btnName bitmap)
  (vl-load-com)
  (vla-setbitmaps
    (vla-item
      (vla-item
(vla-get-toolbars
  (vla-item (vla-get-menugroups (vlax-get-acad-object))
    mnuGroup
  )
)
tbrName
      )
      btnName
    )
    bitmap
    bitmap
  )
  (princ)
)

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64