Nobull84 Posted March 5, 2014 Author Posted March 5, 2014 I really thank you blackbox and everyone else involved on this thread. Being a beginner is the whole lisp world, I did not realize such a request would require so much time and effort. Thank you all for the time you've put in this, even if it all works in the end or not. I wish I could have half your knowledge of this! -Nobull Quote
BlackBox Posted March 5, 2014 Posted March 5, 2014 I really thank you blackbox and everyone else involved on this thread. Being a beginner is the whole lisp world, I did not realize such a request would require so much time and effort. Thank you all for the time you've put in this, even if it all works in the end or not. I wish I could have half your knowledge of this! Firstly, that is very kind of you to say to me, and everyone else. I'm sure we all agree when I say that we're happy to help. [Edit] - Except maybe Alan. While I may have hit a roadblock, which (and I cannot go into detail other than to say that it) doesn't seem as though it will be resolved in the next release, that should not in any way stop you, or anyone else for that matter, from attempting this, or another routine, app, or plug-in... Imagine what can be done, figure out what you can, ask for help where you're stuck, and dream even bigger. Since you're new(-ish?) to development, believe me when I say that you're capable of a lot more than you might think. Late 2009 I joined AUGI (then CADTutor, etc.) and didn't even know what a LISP Defun was, and now find myself reporting issues in the .NET API to ADN, and have a small handful of my own apps that I use daily published at Autodesk Exchange, and in use in myriad countries. DREAM BIG... Because 'potential has a shelf life.' Quote
BlackBox Posted March 5, 2014 Posted March 5, 2014 (edited) While I may have hit a roadblock, which (and I cannot go into detail other than to say that it) doesn't seem as though it will be resolved in the next release, that should not in any way stop you, or anyone else for that matter, from attempting this, or another routine, app, or plug-in... Imagine what can be done, figure out what you can, ask for help where you're stuck, and dream even bigger. Since you're new(-ish?) to development, believe me when I say that you're capable of a lot more than you might think. Also to clarify, going back a few posts... Adding in the secondary step of changing the background color is entirely possible, and is relatively easy to implement. ... Point being, just store the current BG color, change it to white. Next time it's run restore the original BG color. [Edit] - Same rules apply as with other persistent settings. Edited March 5, 2014 by BlackBox Quote
Nobull84 Posted March 6, 2014 Author Posted March 6, 2014 Below is my elementary version of what I've been trying to do. The onlything I will add at some point is layers on/off in certain modes. All I've done here iscompile codes written by others and combined them to suit my purposes (and maybe changed the keys to execute the command). I agreewith Blackbox in that, ideally, a program like this would be helpful to themasses but this one is relatively suited to my needs and I still need to watch forwhat settings I leave a drawing on if someone else in my office needs to lookat. Others may be able to use this as well as it is relatively simple. Suggestions/fixes/improvements are always welcome. "BW" to toggle the plot styles -Blackbox "BGT" to change background to white - Jimmy Bergmark, JTB World "BGB" to change backgroung to black - Jimmy Bergmark, JTB World ;;The following lisps were compiled by A. Noble, 3/6/14;; |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;Lisp found on JTB World;; ;;; BackgroundChanger.LSP ver 1.0 ;;; Lets you change the background in a simple way ;;; Works for both model space and paper space but could simply be customized for your need ;;; ;;; By Jimmy Bergmark ;;; Copyright (C) 1997-2004 JTB World, All Rights Reserved ;;; Website: [url="http://www.jtbworld.com"]www.jtbworld.com[/url] ;;; E-mail: [email="info@jtbworld.com"]info@jtbworld.com[/email] ;;; 2003-07-01 - First release ;;; Tested on AutoCAD 2002, 2004, 2005 ; Set the background in model and paper space to grey (defun c:BGGrey () (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 5987163) (vla-put-GraphicsWinLayoutBackgrndColor disp 5987163) (vla-put-LayoutCrosshairColor disp 16777215) (vla-put-ModelCrosshairColor disp 16777215) (vla-put-AutoTrackingVecColor disp 16777215) (vla-put-AutoSnapMarkerColor drafting 2) (princ) ) ; Set the background in model and paper space to white (defun c:BGWhite () (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 16777215) (vla-put-GraphicsWinLayoutBackgrndColor disp 16777215) (vla-put-LayoutCrosshairColor disp 0) (vla-put-ModelCrosshairColor disp 0) (vla-put-AutoTrackingVecColor disp 0) (vla-put-AutoSnapMarkerColor drafting 6) (princ) ) ; Set the background in model and paper space to black (defun c:BGB () (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 0) (vla-put-GraphicsWinLayoutBackgrndColor disp 0) (vla-put-LayoutCrosshairColor disp 16777215) (vla-put-ModelCrosshairColor disp 16777215) (vla-put-AutoTrackingVecColor disp 16777215) (vla-put-AutoSnapMarkerColor drafting 2) (princ) ) ; Background toggle between black and white (defun c:bgt () (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)))) (if (= (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor disp) vlax-vblong ) ) 0 ) (c:bgwhite) (c:bgblack) ) (princ) ) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;Lisp created by BlackBox,3-4-14;; ;;found on Cadtutor.net;; (princ) (vl-load-com) (defun c:BW (/ *error* acDoc show) (defun *error* (msg) (setq *ShowPlotStyles* (if (= :vlax-true show) :vlax-true :vlax-false ) ) (if acDoc (progn (vla-regen acDoc acallviewports) (vla-endundomark acDoc) ) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (setq show (if (= :vlax-true *ShowPlotStyles*) :vlax-false :vlax-true ) ) (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (vlax-for x (vla-get-layouts acDoc) (vla-put-showplotstyles x show) ) (*error* nil) ) put-AutoSnapMarkerColor drafting 2) (princ) ) (setq prf (vla-get-display (vla-get-Preferences (vlax-get-acad-object)))) (setq col (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor prf) vlax-vblong ) ) ) (if (zerop col) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 16777215 vlax-vblong) ) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 0 vlax-vblong) ) ) (vlax-release-object prf) (princ) ) "Potential has a shelf life." - Margaret Atwood Quote
BlackBox Posted March 6, 2014 Posted March 6, 2014 If I have time, I'll post a sample of how to go about this as one contiguous LISP routine (that used to really help me when I dove into the deep end of Visual LISP anyway)... For now, however, this may yield a similar result: (defun c:FOO1 () (c:BW) (c:BGT) (princ)) (defun c:FOO2 () (c:BW) (c:BGB) (princ)) [Edit] - Just be mindful of accidentally invoking either c:FOO2, or c:BW first, as this will mismatch the functionality of these pseudo-routines. It may be worthwhile to compartmentalize my offering into two separate routines, one to enable, and another to disable, etc. in order to avoid this potentiality. Cheers Quote
Nobull84 Posted March 6, 2014 Author Posted March 6, 2014 If I have time, I'll post a sample of how to go about this as one contiguous LISP routine (that used to really help me when I dove into the deep end of Visual LISP anyway)... For now, however, this may yield a similar result: (defun c:FOO1 () (c:BW) (c:BGT) (princ)) (defun c:FOO2 () (c:BW) (c:BGB) (princ)) [Edit] - Just be mindful of accidentally invoking either c:FOO2, or c:BW first, as this will mismatch the functionality of these pseudo-routines. It may be worthwhile to compartmentalize my offering into two separate routines, one to enable, and another to disable, etc. in order to avoid this potentiality. Cheers Thanks for the tip. I'll mess with it and see what I come up with. That may be above my head. It took me a minute to figure out how to get the proper layers to turn on and off with each function. Lots of trial and error lol -Nobull Quote
jstaddon Posted March 6, 2014 Posted March 6, 2014 (edited) I just found this today, works in model space: ;;; CADALYST 05/07 Tip 2209: TWB.lsp Toggle Black and White Background Color (c) 2007 Watson Kilbourne ;;;;;; *** TWB.LSP *** ;;;;;; Toggle White or Black screen;;; (Does not effect colored crosshairs);;; (defun c:TWB (/ prf col) (setq prf (vla-get-display (vla-get-Preferences (vlax-get-acad-object)))) (setq col (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor prf) vlax-vblong ) ) ) (if (zerop col) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 16777215 vlax-vblong) ) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 0 vlax-vblong) ) ) (vlax-release-object prf) (princ) ) Edited March 6, 2014 by jstaddon Quote
Nobull84 Posted March 7, 2014 Author Posted March 7, 2014 Below is my elementary version of what I've been trying to do. The onlything I will add at some point is layers on/off in certain modes. All I've done here iscompile codes written by others and combined them to suit my purposes (and maybe changed the keys to execute the command). I agreewith Blackbox in that, ideally, a program like this would be helpful to themasses but this one is relatively suited to my needs and I still need to watch forwhat settings I leave a drawing on if someone else in my office needs to lookat. Others may be able to use this as well as it is relatively simple. Suggestions/fixes/improvements are always welcome. "BW" to toggle the plot styles -Blackbox "BGT" to change background to white - Jimmy Bergmark, JTB World "BGB" to change backgroung to black - Jimmy Bergmark, JTB World ;;The following lisps were compiled by A. Noble, 3/6/14;; |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;Lisp found on JTB World;; ;;; BackgroundChanger.LSP ver 1.0 ;;; Lets you change the background in a simple way ;;; Works for both model space and paper space but could simply be customized for your need ;;; ;;; By Jimmy Bergmark ;;; Copyright (C) 1997-2004 JTB World, All Rights Reserved ;;; Website: [url="http://www.jtbworld.com"]www.jtbworld.com[/url] ;;; E-mail: [email="info@jtbworld.com"]info@jtbworld.com[/email] ;;; 2003-07-01 - First release ;;; Tested on AutoCAD 2002, 2004, 2005 ; Set the background in model and paper space to grey (defun c:BGGrey () (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 5987163) (vla-put-GraphicsWinLayoutBackgrndColor disp 5987163) (vla-put-LayoutCrosshairColor disp 16777215) (vla-put-ModelCrosshairColor disp 16777215) (vla-put-AutoTrackingVecColor disp 16777215) (vla-put-AutoSnapMarkerColor drafting 2) (princ) ) ; Set the background in model and paper space to white (defun c:BGWhite () (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 16777215) (vla-put-GraphicsWinLayoutBackgrndColor disp 16777215) (vla-put-LayoutCrosshairColor disp 0) (vla-put-ModelCrosshairColor disp 0) (vla-put-AutoTrackingVecColor disp 0) (vla-put-AutoSnapMarkerColor drafting 6) (princ) ) ; Set the background in model and paper space to black (defun c:BGB () (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 0) (vla-put-GraphicsWinLayoutBackgrndColor disp 0) (vla-put-LayoutCrosshairColor disp 16777215) (vla-put-ModelCrosshairColor disp 16777215) (vla-put-AutoTrackingVecColor disp 16777215) (vla-put-AutoSnapMarkerColor drafting 2) (princ) ) ; Background toggle between black and white (defun c:bgt () (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)))) (if (= (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor disp) vlax-vblong ) ) 0 ) (c:bgwhite) (c:bgblack) ) (princ) ) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;Lisp created by BlackBox,3-4-14;; ;;found on Cadtutor.net;; (princ) (vl-load-com) (defun c:BW (/ *error* acDoc show) (defun *error* (msg) (setq *ShowPlotStyles* (if (= :vlax-true show) :vlax-true :vlax-false ) ) (if acDoc (progn (vla-regen acDoc acallviewports) (vla-endundomark acDoc) ) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (setq show (if (= :vlax-true *ShowPlotStyles*) :vlax-false :vlax-true ) ) (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (vlax-for x (vla-get-layouts acDoc) (vla-put-showplotstyles x show) ) (*error* nil) ) put-AutoSnapMarkerColor drafting 2) (princ) ) (setq prf (vla-get-display (vla-get-Preferences (vlax-get-acad-object)))) (setq col (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor prf) vlax-vblong ) ) ) (if (zerop col) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 16777215 vlax-vblong) ) (vla-put-graphicswinmodelbackgrndcolor prf (vlax-make-variant 0 vlax-vblong) ) ) (vlax-release-object prf) (princ) ) "Potential has a shelf life." - Margaret Atwood *UPDATE* This has been working rather well but I have had a couple hiccups. I've received a couple errors stating: Color Scheme has been Changed to Windows 7 Basic I know how to change it back but if I could avoid this error, it would avoid confusion amongst others who want to use it. I'm not sure if this may be because when this happens, I have around 25-30 dwg files open with CAD, amongst other things (email, explorer, tekla, excel, etc, etc...) and maybe my hardware isn't able to keep up with rapid changes? I really have no clue... And two, could anyone show how to change the layer "viewport" to a transparency of 90 when a command is enabled? Earlier in this thread, it was mentioned just to change colors but I saw that the transparency looked a little better for my application. Thanks, -Nobull Quote
BlackBox Posted March 7, 2014 Posted March 7, 2014 ... could anyone show how to change the layer "viewport" to a transparency of 90 when a command is enabled? This old thread may be of use. Cheers Quote
Nobull84 Posted March 7, 2014 Author Posted March 7, 2014 This old thread may be of use. Cheers Thanks. I took ten minutes or so look it over. Anything over a line or two is basically jibberish to me but I'll spend some time with it when I can and try to incorporate it. I really only get lunch breaks to look at this stuff. No CAD at home anymore I'm definitely a noob with this, but hopefully with research, it'll make some sense one day. -Nobull Quote
BlackBox Posted March 7, 2014 Posted March 7, 2014 ... I really only get lunch breaks to look at this stuff. No CAD at home anymore FWIW - An AUGI Professional Membership includes a FREE Autodesk Developer Network Membership, which grants one access to an ADN license to download and install any software title Autodesk produces. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.