screen colors with script

screen colors with script

Anonymous
Not applicable
2,001 Views
23 Replies
Message 1 of 24

screen colors with script

Anonymous
Not applicable

When teaching students new to AutoCAD, I have them run a script file to reset many options that others using the same computer may have changed. (pickbox size, osnap settings, grid on/off, etc.) I would like to add to the script file so that the screen color and crosshair colors are changed to a standard color when students run the script file. I find that for many new users it is helpful to have all monitors look the same.

0 Likes
Accepted solutions (1)
2,002 Views
23 Replies
Replies (23)
Message 2 of 24

rkmcswain
Mentor
Mentor
Take a look at: http://cadpanacea.com/wp/?p=242

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 24

TheCADnoob
Mentor
Mentor
0 Likes
Message 4 of 24

tramber
Advisor
Advisor

pickbox size, osnap settings, grid on/off, etc

 

APERTURE (registered)

PICKBOX (registered)

Grid parameters (DWG)

ORTHOMODE (DWG)

 

Just to say that some parameters depend on Templates (DWG or DWT to start with), not on registered settings....

Using a script to modify DWG parameters is not the good way to teach your student, according to me.

But you may want to turn the grid off,mainly. Then I'd understand !

 


EESignature

0 Likes
Message 5 of 24

krzysztof.psujek
Advocate
Advocate

Also you could look at https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/system-variable-for-crosshair-color/...

with this great routine written by Lee Mac - you could set any of ACI colors

 

I've added/modified original routine so if you want to change both colors you could try it:

 

;; Added part
;; just put values of ACI for firstly crosshair and then for background below
;; in example routine will set Red (1) - crosshair and grey (252)  background in model space

(defun c:ccc nil (ChCol 1 252))

;; modified function
(defun ChCol ( CrossHairCol BackGroundCol )
        (vla-put-modelcrosshaircolor
            (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
            (LM:ACI->OLE CrossHairCol)
        )
	  
	(vla-put-GraphicsWinModelBackgrndColor
	    (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
            (LM:ACI->OLE BackGroundCol)
        )
      (princ)
)

;;-------------------------------------------------------------------------------------------;;
;;                            
;; Original posted by Lee Mac 
;;                            
(defun c:ccch ( / c )
    (if (setq c (acad_colordlg 7 nil))
        (vla-put-modelcrosshaircolor
            (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
            (LM:ACI->OLE c)
        )
    )
    (princ)
)

;; ACI -> OLE  -  Lee Mac
;; Args: c - [int] ACI (AutoCAD Colour Index) Colour (1<=c<=255)

(defun LM:ACI->OLE ( c )
    (apply 'LM:RGB->OLE (LM:ACI->RGB c))
)

;; RGB -> OLE  -  Lee Mac
;; Args: r,g,b - [int] Red, Green, Blue values

(defun LM:RGB->OLE ( r g b )
    (logior (fix r) (lsh (fix g) 8) (lsh (fix b) 16))
)

;; ACI -> RGB  -  Lee Mac
;; Args: c - [int] ACI (AutoCAD Colour Index) Colour (1<=c<=255)

(defun LM:ACI->RGB ( c / o r )
    (if (setq o (vla-getinterfaceobject (LM:acapp) (strcat "autocad.accmcolor." (substr (getvar 'acadver) 1 2))))
        (progn
            (setq r
                (vl-catch-all-apply
                   '(lambda ( )
                        (vla-put-colorindex o c)
                        (list (vla-get-red o) (vla-get-green o) (vla-get-blue o))
                    )
                )
            )
            (vlax-release-object o)
            (if (vl-catch-all-error-p r)
                (prompt (strcat "\nError: " (vl-catch-all-error-message r)))
                r
            )
        )
    )
)

;; Application Object  -  Lee Mac
;; Returns the VLA Application Object

(defun LM:acapp nil
    (eval (list 'defun 'LM:acapp 'nil (vlax-get-acad-object)))
    (LM:acapp)
)

(vl-load-com) (princ)

Chris

 

 

 

 

 

 

 

0 Likes
Message 6 of 24

stevetamplen
Alumni
Alumni

Hello tcsteid;

 

Or you could just reset to defaults...wouldn't that be a lot easier?


Steve Tamplen

Technical Support Specialist
0 Likes
Message 7 of 24

stevetamplen
Alumni
Alumni

@Anonymous;

 

Did any of the posts get your problem resolved?

 

If so, please hit the Accept as Solution button for that post so that more community members can profit from the solution.

 

If you still need assistance, please post back to let us know!


Steve Tamplen

Technical Support Specialist
0 Likes
Message 8 of 24

Anonymous
Not applicable

I am still trying to find a solution.

0 Likes
Message 9 of 24

stevetamplen
Alumni
Alumni

Can you please post back with more detailed information about what you have tried, and why it didn't work for you? That way, we can give new possibilities and not hash over old suggestions!


Steve Tamplen

Technical Support Specialist
0 Likes
Message 10 of 24

Anonymous
Not applicable

My issue is that multiple instructors use the classroom and students in some classes like to change screen colors. It is very un-nerving to new students to see a black screen one day a red screen the next..... I have students use a script file that does many things such as turn off osnaps, turn off grids, ortho, snaps and reset many variables etc so that they have the same screen every time they use the computer. These students take one class in AutoCAD as a required course so we just cover basic information not getting into adjusting settings. The more I can do to make all computers look the same every day the easier it is on students.

0 Likes
Message 11 of 24

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

export the profile and the template file means you have saved (or restored) 99% of the settings.

When a user is starting then he can import the profile and make sure the standard template is on it's location.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 12 of 24

Anonymous
Not applicable

thank you for responding but this solution just will not work in my situation. If I could add to the script file I use so that a profile was automatically added that would solve our problem.

0 Likes
Message 13 of 24

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> If I could add to the script file I use so that a profile was

>> automatically added that would solve our problem.

You can start AutoCAD with parameter /b /p and specifying the ARG-file.

The only need is to make sure that a profile does not already exist with the same name (can be removed from the registry before starting AutoCAD).

 

[edit] sorry parameter for profile is /p [/edit]

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 14 of 24

Anonymous
Not applicable

I sometimes have up to 50 computers in various locations that I would need to setup or make adjustments. By instructing the students to run a script file when they sit down at a  computer has been a fantastic solution in my environment. I just wish I could include screen and crosshair colors. Students in these classes only need a brief introduction to AutoCAD and we would like to concentrate on basic commands (lines, circles, arcs...). We often get a few students who are taking advanced classes that love to customize there computer which frustrates the next person who sits at that computer.

0 Likes
Message 15 of 24

Ed__Jobe
Mentor
Mentor

So, did you ever update your script?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 16 of 24

RobDraw
Mentor
Mentor

You really should listen to what @Alfred.NESWADBA is saying. Some companies mandate a default profile and it's quite easy to setup.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 17 of 24

Ed__Jobe
Mentor
Mentor

@Anonymous Yes, for example, if you set AutoCAD's shortcut properties to use the /p switch on all the pc's, you only have to do it once. Each time the pc is started, it starts using the specified profile and everything is always the same. One step better is to use a profile (*.arg) stored on the network. That way if you want to make a change to the profile, you do it once and all the pc's will use the updated profile. You don't have to go back to each pc again. It will also be available for future upgrades.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 18 of 24

Anonymous
Not applicable

I am not sure I understand what you are suggesting. I am including my script file in hopes that you can help me out.

 

Setvar ANGBASE 0
Setvar Annoautoscale 4
Setvar ANGDIR 0
Setvar APBOX 0
Setvar APERTURE 10
Setvar ATTDIA 0
Setvar ATTMODE 1
Setvar ATTREQ 1
Setvar AUDITCTL 0
Setvar AUTOSNAP 39
Setvar AUTOSNAP 47
Setvar Colortheme 0
Setvar COORDS 1
Setvar CURSORSIZE 8
Setvar DELOBJ 1
Setvar DIMASZ .2
Setvar DIMCEN -.09
Setvar DIMDEC 3
Setvar DIMGAP .09
Setvar Dimlayer Dimensions
Setvar Dimexo .175
Setvar Dimfxlon 0
Setvar Dimjust 0
Setvar Dimlfac 1
Setvar Dimlunit 2
Setvar Dimtfill 0
Setvar Donutid .25
Setvar DRAGMODE 2
Setvar DRAGP1 10
Setvar DRAGP2 25
Setvar Dynprompt 0
Setvar Dynmode 0
Setvar EDGEMODE 0
Setvar EXPERT 0
Setvar EXPLMODE 1
Setvar FILEDIA 1
Setvar FONTALT "simplex.shx"
Setvar Galleryview 1
Setvar Gridmode 0
Setvar GRIPBLOCK 0
Setvar GRIPCOLOR 5
Setvar GRIPHOT 1
Setvar GRIPS 1
Setvar GRIPSIZE 5
Setvar IMAGEHLT 0
Setvar ISAVEBAK 1
Setvar ISAVEPERCENT 0
Setvar ISOLINES 4
Setvar LOGFILEMODE 0
Setvar LWDEFAULT 25
Setvar Lwdisplay 0
Setvar LWUNITS 1
Setvar MAXACTVP 64
Setvar MAXSORT 1000
Setvar Menubar 1
Setvar MBUTTONPAN 1
Setvar Menubar 1
Setvar OLEHIDE 0
Setvar OLEQUALITY 1
Setvar ORTHOMODE 0
Setvar OSMODE 0
Setvar OSNAPCOORD 2
Setvar PAPERUPDATE 0
Setvar Pdmode 2
Setvar PELLIPSE 0
Setvar PICKADD 1
Setvar PICKAUTO 1
Setvar PICKBOX 5
Setvar PICKDRAG 0
Setvar PICKFIRST 1
Setvar PICKSTYLE 1
Setvar PLINETYPE 2
Setvar PLOTROTMODE 2
Setvar POLARADDANG .
Setvar POLARANG 5
Setvar POLARDIST 0.0000
Setvar POLARMODE 0
Setvar PROJMODE 2
Setvar PROXYGRAPHICS 1
Setvar PROXYNOTICE 1
Setvar PROXYSHOW 1
Setvar PSTYLEPOLICY 1
Setvar RTDISPLAY 1
Setvar SDI 0
Setvar SHORTCUTMENU 11
Setvar SNAPmodE 0
Setvar Startup 1
Setvar Statusbar 1
Setvar TEXTFILL 1
Setvar TOOLTIPS 1
Setvar TRACKPATH 0
Setvar Transparencydisplay 0
Setvar TREEMAX 10000000
Setvar TRIMMODE 1
Setvar UCSICON 0
Setvar UCSAXISANG 90
Setvar UCSORTHO 1
Setvar UCSVIEW 1
Setvar WHIPARC 0
Setvar WMFBKGND 1
Setvar XREFCTL 0
Setvar ZOOMFACTOR 60
_CleanscreenOFF
^c^c^c
;end of script

 

0 Likes
Message 19 of 24

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I am not sure I understand what you are suggesting

You are running a scriptfile inside AutoCAD (in that case you should add the LISP from LeeMac shown in post 5).

 

What I'm referring to is to start AutoCAD using the /p parameter with an ARG-file, no script needed here at all to get settings for AutoCAD you specified (and exported as ARG file from command _OPTIONS).

 

Start parameters in AutoCAD: >>>details<<<

Exporting profile: >>>click<<<

Import and Export settings (also a way to go): >>>click<<<

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 20 of 24

RobDraw
Mentor
Mentor

Why are you still trying to use a script?

 

You've got seasoned AutoCAD veterans telling you that a profile is the way to go. You would be done by now.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Likes