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

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Change crosshair color when switched to paperspace
« on: September 07, 2004, 08:16:24 PM »
How would i go about creating a reactor that would change the crosshairs to red everytime you're in paperspace & switch it back to white when in modelspace or tilemode 1?...or switch the background color from black to grey?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Change crosshair color when switched to paperspace
« Reply #1 on: September 07, 2004, 08:37:23 PM »
You can use the AcadPreferencesDisplay Object Properties.

explicitly
(vla-put-GraphicsWinLayoutBackgrndColor ...
(vla-put-LayoutCrosshairColor ...

  etc, etc,

A thought though.Are you aware these can be set from
 Options-> Display->Colors....

set and forget, and save the reactor processing ?
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.

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #2 on: September 07, 2004, 09:05:17 PM »
yeah i'm aware of the
Options-> Display->Colors....
The only problem is that the colors don't change when you're in pspace vs. mspace. I have two people that recently switched to using paperspace & they're continously drawing half of the entities in pspace & the other half in model. I figured if i could get the crosshairs to change to red when in paperspace that would throw up a red flag for them to switch to mspace. What's the best way to achieve this....using reactors???

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Change crosshair color when switched to paperspace
« Reply #3 on: September 07, 2004, 10:27:36 PM »
Quote from: bman
yeah i'm aware of the
Options-> Display->Colors....
The only problem is that the colors don't change when you're in pspace vs. mspace. I have two people that recently switched to using paperspace & they're continously drawing half of the entities in pspace & the other half in model. I figured if i could get the crosshairs to change to red when in paperspace that would throw up a red flag for them to switch to mspace. What's the best way to achieve this....using reactors???


funny, mine does.

and if they switch from paperspace to modelspace when in a layout, the X-Y Icon displays in the work area.

I would have another look before you start to think about adding reactors/event handling.
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.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Change crosshair color when switched to paperspace
« Reply #4 on: September 07, 2004, 10:38:57 PM »
Quote from: bman
I figured if i could get the crosshairs to change to red when in paperspace that would throw up a red flag for them to switch to mspace.


Wouldn't the bright white screen throw up a "red flag?"

hendie

  • Guest
Change crosshair color when switched to paperspace
« Reply #5 on: September 08, 2004, 03:20:31 AM »
Quote from: Dommy2Hotty
Wouldn't the bright white screen throw up a "red flag?"


that's just what I was thinking  :shock:

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #6 on: September 08, 2004, 08:20:28 AM »
It would if you left it as a bright white screen. Then again even if you do, it doesn't let the user know whether or not he's in a viewport or not. I do the same thing, where in the model tab, my crosshairs are green and when in any of the layout tabs, my crosshairs are red. If I should activate any of the viewports, the color of the crosshair is still red. What bman is looking for is the crosshairs to be changed to the model tab color while in a viewport through a layout tab. I kind of like the idea he's coming up with. As far as further development goes, it would be good if the crosshairs were changed to a color based on if the current viewport were locked or unlocked.

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #7 on: September 08, 2004, 08:52:39 AM »
I've changed the crosshairs under
Options>Display>Color>Layout Tabs Pointer to red.
When in tilemode 0, I switch back & forth between between pspace & mspace the crosshairs stay red. When in tilemode 0, I was thinking that if the crosshairs changed colors when switching from vport modelspace to pspace then hopefully that would turn on a light bulb.

The problem is that others here turn on all the layers & switch to tilemode 0 & freeze layers in the current vport & edit the plan sheets in each individual vport. I keep getting interupted quite often on a daily basis due to "Lost in Paperspace". I use scripts & layer manager to manipulate plans & switch to pspace to just plot the dwg so i don't have this problem.

I know some sort of standards would fix this problem but no one here is willing to enforce them. We have ten different people doing things ten different ways.

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #8 on: September 08, 2004, 08:56:39 AM »
bman, I feel your pain. We're going through similar problems here. Yours is far worse though. As far as your last post, I believe I do understand the line of thought you're after. I'll try to look into it using what Kerry offered up.

bman

  • Guest
Daron hit the nail on the head
« Reply #9 on: September 08, 2004, 09:03:14 AM »
It would help those who do their editing within the viewports if the crosshairs changed colors when switching from mspace to pspace so that things don't get unintentionally placed in pspace.

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #10 on: September 08, 2004, 09:06:45 AM »
I do understand as I have the same issues occasionally.

bman

  • Guest
Change crosshair color when switched to paperspace
« Reply #11 on: September 08, 2004, 09:07:24 AM »
Thanks Daron.
Any help is greatly appreciated!

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #12 on: September 08, 2004, 09:11:27 AM »
Kerry gave it to ya already. Didnt he? He told you some of the key functions to use. (Thats prety much it, after that is just misc "setup" code.)
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 #13 on: September 08, 2004, 09:22:26 AM »
Looks Greek to me as i am not familiar with creating reactors.

daron

  • Guest
Change crosshair color when switched to paperspace
« Reply #14 on: September 08, 2004, 09:23:48 AM »
Well, here's the start, but as you'll notice I had to change the value of the variant for the color code. For some reason it outputs as a 19 variant value, which doesn't seem to exist. Now, the value in the variant is, on my cpu, 65280?!? Anybody know how to make color sense of that?
Code: [Select]
(setq $acad (vlax-get-acad-object)
      $doc  (vla-get-activedocument $acad)
      )
(setq acpref (vla-get-preferences $acad)
      acdisp (vla-get-display acpref)
      aclcco (vlax-variant-change-type (vla-get-LayoutCrosshairColor acdisp) 5)
      )

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #15 on: September 08, 2004, 09:33:26 AM »
lol, Just for example:
Here is a small reactor lisp that will react to the "line" command. To cancel the reactor just issue a "SAVE" command.

This is a small demonstration for using Reactors to react to a command.
Code: [Select]
(vl-load-reactors)
(vlr-command-reactor nil '((:vlr-CommandWillStart . StartCommand)))
(defun StartCommand (calling-reactor startcommandinfo / thecommandstart)
  (setq thecommandstart (nth 0 startcommandInfo))
  (cond
    ((= thecommandstart "LINE")
     (theswamp)
     )
    ((= thecommandstart "SAVE")
     (vlr-remove-all :vlr-command-reactor)
     )
    ((= thecommandstart "QSAVE")
     (vlr-remove-all :vlr-command-reactor)
     )
    )
  )
(defun theswamp ()
  (alert "Please wait unitll direct you to TheSwamp...")
  (startapp "explorer" "http://www.theswamp.org/phpBB2/")
  (alert "You may now continue with your line.
         To cancle this reactor use the save command.")
 (princ)
)


When i get some time, ill see if i can help out more.
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 #16 on: September 08, 2004, 09:53:58 AM »
Do you copy this code to a vlisp editor & save as a vlx file & then appload?

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #17 on: September 08, 2004, 10:02:07 AM »
Me? No.

Cut and paste it into your command line and issue the line command. (type "l" <sapce bar>) and then you will get an alert box, then an explorer window will open to the swamp. Then issue a save command to cancle it. (ctrl+s).
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Anonymous

  • Guest
Change crosshair color when switched to paperspace
« Reply #18 on: September 08, 2004, 10:06:09 AM »
that's pretty cool

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #19 on: September 08, 2004, 10:13:47 AM »
Of course it is?! ...J/K, Glad you like it.
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 #20 on: September 08, 2004, 10:32:54 AM »
sorry, that was me...forgot to login (wasn't being sarcastic)

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #21 on: September 08, 2004, 10:44:00 AM »
Oh, i know. The thought of you being sarcastic didnt even cross my mind.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SMadsen

  • Guest
Change crosshair color when switched to paperspace
« Reply #22 on: September 08, 2004, 11:00:37 AM »
Quote from: Se7en
Me? No.


No, copy and paste to VIM, then save it in VIM with the extension .007, then setup VIM to colorcode lsp files, then write a WSH script to load .007 files in AutoCAD, then open VIM and ...

ok ok, that was sarcasm  :P

Good job Se7en. I think I'll put that alert into all my VI.. ummm lsp files

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #23 on: September 08, 2004, 11:41:44 AM »
Quote from: SMadsen
No, copy and paste to VIM, then save it in VIM with the extension .007, then setup VIM to colorcode lsp files, then write a WSH script to load .007 files in AutoCAD, then open VIM and ...

ok ok, that was sarcasm  :P

Good job Se7en. I think I'll put that alert into all my VI.. ummm lsp files
*blink* ... Ahhh!? *sigh*  

Pay no attention to him everybody, that is how he would do it. (*Se7en whispers* Cause he’s not that good with AutoLisp, so he has to do things five times.)

Stig, i thought you would like VIM because the guy that wrote it is Dutch. (Support those fellow Europeans.) --Ok, those were some bad jokes. ...darn it, I’m loosing the ability to make smartass remarks.

BTW, I like that extension of .007 ...*wink* lmao!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SMadsen

  • Guest
Change crosshair color when switched to paperspace
« Reply #24 on: September 08, 2004, 11:52:35 AM »
Hehe

Those dutchies are usually pretty good with computers but you know there has to be an exception to every rule .. I think VIM is it  :twisted:

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #25 on: September 08, 2004, 11:58:53 AM »
*choke* ...Ahhhh! Darnit!! Stig has got me on the fricken run here. I cant think of anything witty to say.
*Se7en starts shaking*
Stig your a big dummy!
...grrr!

Awe crap?!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #26 on: September 08, 2004, 12:01:08 PM »
...I think its MircoCrappy that is rotting my brain!?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #27 on: September 08, 2004, 05:09:31 PM »
Sorry, I had a meeting at lunch and i had another "thing" i needed to get done. But i whiped up some code for ya; Give this a try and let me know if it works alright for ya.

Code: [Select]
(vl-load-reactors)
(vlr-miscellaneous-reactor
   nil '((:vlr-layoutSwitched . ChangeLayoutCrosshairColor-Red)))
(defun ChangeLayoutCrosshairColor-Red (calling-reactor info /)
   (if (not (eq (car info) "Model"))
     (vla-put-LayoutCrosshairColor
       (vla-get-Display (vla-get-Preferences (vlax-get-acad-object)))
       (vlax-make-variant 255 vlax-vbLong))))
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 #28 on: September 08, 2004, 07:46:51 PM »
I think ur on the right path... that changed the crosshairs to red when switching to pspace. How do you get it to change to white when you click in a viewport?

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Change crosshair color when switched to paperspace
« Reply #29 on: September 08, 2004, 08:17:06 PM »
Holly cow man?! Your killing me! ...I dont have the first idea. Ill have to think that one over a bit.
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 #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: 10626
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: 10626
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: 10626
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: 10626
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: 10626
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