Author Topic: Change crosshair color when switched to paperspace  (Read 13971 times)

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #30 on: September 08, 2004, 08:29:29 PM »
Don't lie in bed tonight counting popcorn on the ceiling trying to figure it out.
thanks for ur help :)

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Change crosshair color when switched to paperspace
« Reply #31 on: September 08, 2004, 10:46:07 PM »
Well the code isnt really a problem, its just that i dont think i know of a way to test to see if the user is in "floating model space". Cha know?

...Not to mention that i seriously doubt that there is a "viable" way to react to that.

Well that is a thunk-er but i dont think i can help you anymore. (that is about the best i can offer you. Sorry.) Let's see if someone else thinks of a way.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #32 on: September 09, 2004, 08:08:01 AM »
Thanks for all of your help

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #33 on: September 09, 2004, 08:16:19 AM »
Well, if this code that se7en posted works, I'll definately look into seeing what I can come up with, since I could use it myself.

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Change crosshair color when switched to paperspace
« Reply #34 on: September 09, 2004, 08:25:49 AM »
No problem.

Of course it works Daron. (I wouldnt have posted it if it didnt ya boob. :lol:)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #35 on: September 09, 2004, 08:43:19 AM »
I didn't mean work as in it wouldn't. I meant works in if I could make it work for the thought I've got in mind.

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Change crosshair color when switched to paperspace
« Reply #36 on: September 09, 2004, 08:45:57 AM »
Ohhhhoo, I got cha.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #37 on: September 09, 2004, 10:31:18 AM »
I was looking a bit and the only thing I could find that would tell you if you were in a viewport or not would be to look at the customscale property. In paperspace it appears to be 1.0, but in mspace not 1.0, unless of course you are scaled to 1:1.

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #38 on: September 09, 2004, 11:45:50 AM »
Got some help on Autodesk forum here it is:
Thanks to all who helped out

Code: [Select]
;;;Changes the crosshairs to Red when switching to pspace
;;;changes back to white when in current vport or modelspace
;;;To Install, change the name of this file to AcadDOC.lsp & add to the acad support directory
 
(vl-load-com)

(or Me:Svr
 (setq Me:Svr (VLR-SysVar-Reactor
               nil
              '((:VLR-sysVarChanged . MeChangeCrosshairColor))
              )
 )
)  
(or Me:Dmr
 (setq Me:Dmr (vlr-DocManager-reactor
               nil
              '((:VLR-documentToBeDestroyed . MeDoCloseStuff))
              )
 )
)

(defun MeDoCloseStuff (Rea Arg)
 (mapcar 'VLR-remove (list Me:Svr Me:Dmr))
 (setq Me:Dmr nil
       Me:Svr nil
 )
 (princ)
)

(defun MeChangeCrosshairColor (Rea Arg / AcaDsp AcaObj LayBco)
 (if (vl-position (car Arg) '("CVPORT"))
  (progn
   (setq AcaObj (vlax-get-acad-object)
         AcaDsp (vla-get-Display (vla-get-Preferences AcaObj))
         LayBco (vlax-variant-value
                 (vlax-variant-change-type
                  (vla-get-GraphicsWinLayoutBackgrndColor AcaDsp)
                  vlax-vbLong
                 )
                )
   )
   ;
   ; Color list:
   ;        0 = Black
   ;      255 = Red
   ;    65535 = Yellow
   ;    65280 = Green
   ; 16776960 = Cyan
   ; 16711680 = Blue
   ; 16711935 = Magenta
   ; 16777215 = White
   ; Set the cursor color to the appropriate value:
   ;
   (vla-put-LayoutCrosshairColor
    AcaDsp
    (if (= (getvar "CVPORT") 1)
     255 ;Cursor color in Paperspace
     (MeInvGreyCol LayBco)
    )
   )
  )
 )
 (princ)
)

(defun MeInvGreyCol (Col)
 (boole 6
  (*
   (*
    (/
     (/
      (+ (logand Col 255) (logand (/ Col 256) 255) (logand (/ Col 65536) 255))
      3
     )
     128
    )
    255
   )
   65793
  )
  16777215
 )
)

(princ)

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Change crosshair color when switched to paperspace
« Reply #39 on: September 09, 2004, 01:13:44 PM »
"VLR-SysVar-Reactor" ...huh?! cool!

Who did that? (some of that code style looks familiar. but the formatting looks...?) There are some prety cool lil tricks in there. You should thank whoever did that alot; they taught some prety cool lessons.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Change crosshair color when switched to paperspace
« Reply #40 on: September 09, 2004, 01:16:28 PM »
"CVPORT" ...That is it!!! Thats the variable i was tryin to think of last night!!!! w00t!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Change crosshair color when switched to paperspace
« Reply #41 on: September 09, 2004, 01:44:16 PM »
Quote from: Se7en
Who did that?

Jürg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
TheSwamp.org  (serving the CAD community since 2003)

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #42 on: September 09, 2004, 02:04:50 PM »
Yep, that's the guy who wrote it.

Jürg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch