Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Page Layout paper background via lisp.

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
LDShaw
3229 Views, 18 Replies

Changing Page Layout paper background via lisp.

I need to change some of the drawing background colors throughout the company. For the most part I've been able to find the ones I want.
Can anyone point me to a list of variables for colors or just tell me the one I need?
I am thinking something along the lines of

GraphicsWinlayoutPaperColor but that one did not work.

background.PNG
An example of one I know is.
(vlax-put-property acaddisp 'ModelCrosshairColor 16777215)

Thanks for any help.

18 REPLIES 18
Message 2 of 19
devitg
in reply to: LDShaw


(defun set-croos-hair-color () (vl-load-com) (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ THE ACAD OBJECT (setq preferences-acad-obj (vla-get-preferences ACAD-OBJ)) (setq preferencesDisplay (vla-get-display preferences-acad-obj)) (setq color (ACAD_COLORDLG 1 )) (vlax-put-property preferencesDisplay 'ModelCrosshairColor color ) )

Try it 

Message 3 of 19
LDShaw
in reply to: devitg

That did not quite do what I need.

 

this is what I have that works so far (Barring the green line.)

(setq acadobject (vlax-get-acad-object))
(setq acadpref (vlax-get-property acadobject 'preferences))
(setq acaddisp (vlax-get-property acadpref 'display))
(vlax-put-property acaddisp 'GraphicsWinmodelBackgrndColor 0)  ;;Model space background
(vlax-put-property acaddisp 'ModelCrosshairColor 16777215)  ;; crosshairs
(vlax-put-property acaddisp 'TextWinBackgrndColor 16777215)  ;;command area

 

(vlax-put-property acaddisp 'XXXXXX 16777215)  ;;sheet layout area

 

I just need the call for Sheet/layout  Paper background
(The highlighted part in the jpg I attached in my original post.)

Hope that clears it up somewhat and I do appreciate the help.

 

Message 4 of 19
devitg
in reply to: LDShaw

Hi Ishaw , please state what color you want to change 

 

The blue or the red 

 

 

wich one you want to change.PNG

Message 5 of 19
LDShaw
in reply to: devitg

The blue color.

 

Sorry I was not very clear on it what I wanted to change.

I should have said.
Sheet/layout>>Paper background.


Thanks.

Message 6 of 19
devitg
in reply to: LDShaw

Ishaw , sad to notice you, that I can not find such PROPERTY , maybe other user can help us,
Message 7 of 19
LDShaw
in reply to: devitg

Thanks for the try.

I remember someone finding all of these by doing an export autocad settings and digging them out of one of those files. I was kinda hoping someone would be able to point me to the right file in the zip. I figure if I can just find the names I will be fine.

Message 8 of 19
devitg
in reply to: LDShaw

As far as I know , all settings done by OPTION , is filed in a *.arg file 

Message 9 of 19
devitg
in reply to: devitg

As far as I know , all settings done by OPTION , is filed in a *.arg file Find attached the arg file for a red paper space background, both are the same , it is a txt file , I change the extension to TXT from a copy So then seem to be it need to be handle by REGISTER KEY . SEE AT , 2016-red background-AND-2016WHITE BACGROUND - copia.TXT , LINE 197 WHERE THE VALUE IS CHANGED Paper background=dword:000000FF For white background 000000FF Paper background=dword:00FFFFFF For red background 00FFFFFF I NEVER TRY TO CHANGE A REGISTRY KEY , BUT IT CAN BE DO. Also you can set to import your ARG file to all yours ACAD user. Neither I know how to do it in LISP.

Message 10 of 19
devitg
in reply to: devitg

Find the attached text file , with a clear explanation
Message 11 of 19
Ranjit_Singh1
in reply to: LDShaw

Use the environment variable Paper background

(setenv "Paper background" "12566463")

I am using my background as example where the color for my paper background is 191 191 191. The RGB color needs to be passed as True color.

 

Message 12 of 19
devitg
in reply to: Ranjit_Singh1

How to convert RGB color to TRUE COLOR ?

Message 13 of 19
Ranjit_Singh1
in reply to: devitg

Try this code

(defun RGBToTrueColor (rgb)
 (setq r (lsh (car rgb) 16))
 (setq g (lsh (cadr rgb) 8))
 (setq b (caddr rgb))
 (setq tcol (+ (+ r g) b)) 
) 

Hope it helps. I found the code here RGB to True Color

 

Message 14 of 19

make sure to pass RGB as a list. For ex. you will call the function

(RGBtoTrueColor  '(191 191 191))
Message 15 of 19
LDShaw
in reply to: Ranjit_Singh1

I thought I'd come back around to this. I ended up finding what I wanted to change by typing this.

(vlax-dump-object (vla-get-display (vla-get-preferences (vlax-get-Acad-object))) T

I then sorted out what colors I wanted to change. I don't know if this gives a complete list but it gave me what I needed.

BTW

(vlax-dump-object (vla-get-preferences (vlax-get-Acad-object)) T)


Will give you the Tab names to drill down and find what you need.



 

Message 16 of 19
Anonymous
in reply to: devitg

I know this page is marked as "solved", but did you end up finding the 'vla-put..' for the blue space?? I can't seem to see it here..

Message 17 of 19
Anonymous
in reply to: devitg

I know this post is quite old now but for the sake of providing a solution for others, to change the 'blue' area (from grey to whatever the paper colour is ie. black), you can simply go:
Command:Options > Display Tab > Layout elements > Untick the Display paper background.

 

If you'd like to do this in lisp:

(vl-load-com)
(setq DisObj (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
(setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object))))
(vlax-put DisObj "LayoutDisplayPaper" 0)
(princ)

Alternatively, you can keep the keep the DisplayPaperBackground ticked on, & change the colour of it to whatever you want with:

(setenv "Paper background" "12566463") ;this number = 191,191,191 = grey area around paper

;; Black=0, Red=255, Blue=16711680, White=16777215 - google 'VBA.ColorConstants'



Hope this is of some help!

Message 18 of 19
LDShaw
in reply to: Anonymous

Wow it's been a while since I had to think about this one.

yes. Here is what I wrote to get it done. 

(setq acadobject (vlax-get-acad-object))
(setq acadpref (vlax-get-property acadobject 'preferences))
(setq acaddisp (vlax-get-property acadpref 'display))
(vlax-put-property acaddisp 'GraphicsWinmodelBackgrndColor 1423) ;;Model space background
(vlax-put-property acaddisp 'GraphicsWinLayoutBackgrndColor  0) ;;command area
(vlax-put-property acaddisp 'ModelCrosshairColor 16777215) ;; crosshairs
(vlax-put-property acaddisp 'TextWinBackgrndColor 16777215) ;;command area



Message 19 of 19
heather_o
in reply to: LDShaw

I'm going down the rabbit hole trying to write a simple LSP routine and I'm hoping y'all can help me.  I want a lsp "BG" (background)  I only want 2 options.  White background or Black background.  All the routines I'm seeing look like novels to me 🙂  

I thought I could create a different workspace with the different backgrounds, but that didn't work.  

Any advise/help would be greatly appreciated

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report