lisp to disable plot styles in model space when edit in place a block

lisp to disable plot styles in model space when edit in place a block

Anonymous
Not applicable
780 Views
3 Replies
Message 1 of 4

lisp to disable plot styles in model space when edit in place a block

Anonymous
Not applicable

hello i set a plot styles in model space in which i see all purple for praticity in my work;

i want when edit in place a block that all the colors come back...disabling plot styles ..there is a routine that in automatic do that?

thanks very much

0 Likes
781 Views
3 Replies
Replies (3)
Message 2 of 4

hencoop
Advisor
Advisor

I use this to set my standard page setup.  It might do what you need.  You will need to change the template file and page setup name to what you use. Make a page setup that has the appearance you need for your block editor and use this to set it and then set it back.  Save the code to filename SETSTDPAGE.LSP (the command to run it is SETSTDPAGE):

 

It requires these subroutines:

check_for_doslib.lsp

ustr.lsp

ukword.lsp

 

(DEFUN setstdpage (pagename / plotcfg)
  (VL-LOAD-COM)
  (SETQ allpages NIL)
  (VLAX-FOR plotcfg (VLA-GET-PLOTCONFIGURATIONS (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
    (SETQ allpages (APPEND allpages (LIST (VLA-GET-NAME plotcfg))))
  ) ;_ end of vlax-for
  (setq this-ver(getvar "acadver"))
  (setq this-ver-no (ATOF this-ver))
  (IF DOS_DELETE NIL
    (PROGN
      (IF check_for_doslib NIL (LOAD "check_for_doslib" "\nFile CHECK_FOR_DOSLIB.LSP not loaded"))
      (IF check_for_doslib
        (check_for_doslib)
      )
    )
  )
  (COND
    ((SETQ page-setup-template (FINDFILE "MCPU Standard.dwt")))
    ((WCMATCH (SUBSTR (STRCASE (GETVAR "LOGINNAME")) 1 4) "ANDY");(AND this-ver-no (EQ this-ver-no 19.0))
     (DOS_DELETE "L:\\Util\\pagesetup19.dwt")
     (DOS_COPY "L:\\Util\\pagesetup19-Andy.dwt" "L:\\Util\\pagesetup19.dwt")
     (SETQ page-setup-template "pagesetup19.dwt"))
    ((WCMATCH (STRCASE (GETVAR "LOGINNAME")) "COOPER");(AND this-ver-no (EQ this-ver-no 19.1))
     (DOS_DELETE "L:\\Util\\pagesetup19.dwt")
     (DOS_COPY "L:\\Util\\pagesetup19-Cooper.dwt" "L:\\Util\\pagesetup19.dwt")
     (SETQ page-setup-template "pagesetup19.dwt"))
    ((SETQ page-setup-template "pagesetup.dwt"))
  )
  (IF (MEMBER pagename allpages)
    (PROGN (COMMAND "-psetupin" page-setup-template pagename "Y")
               ;The template file named containing page setup named
               ;"PDF 34x22 Std B+W PS" is required on the AutoCAD Support File Search Path
           (SetPageSetup (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)) pagename)
           (VLA-REGEN (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)) ACALLVIEWPORTS)
    ) ;_ end of PROGN
    (PROGN (COMMAND "-psetupin" page-setup-template pagename)
               ;The template file containing page setup named
               ;"PDF 34x22 Std B+W PS" is required on the AutoCAD Support File Search Path
           (SetPageSetup (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)) pagename)
           (VLA-REGEN (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)) ACALLVIEWPORTS)
    ) ;_ end of PROGN
  ) ;_ end of IF
) ;_ end of DEFUN
(DEFUN SetPageSetup (doc name / layout plotcfg)
  (SETQ doc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
  (SETQ layout (VLA-GET-ACTIVELAYOUT doc))
  (SETQ plotcfg (VL-CATCH-ALL-APPLY 'VLA-ITEM (LIST (VLA-GET-PLOTCONFIGURATIONS doc) name)))
  (IF (NOT (VL-CATCH-ALL-ERROR-P plotcfg))
    (VLA-COPYFROM layout plotcfg)
  ) ;_ end of if
) ;_ end of defun
(DEFUN C:SETSTDPAGE ()
  (SETQ allpages NIL)
  (IF ustr NIL (LOAD "ustr" "\nFile USTR.LSP not loaded! "))
  (IF ukword NIL (LOAD "ukword" "\nFile UKWORD.LSP not loaded! "))
  (WHILE
    (EQ
      (SETQ pagename (ustr 1
                           "Enter pagesetup to use [?]"
                           (IF (AND pagename (/= pagename "?"))
                             pagename
                             (IF (WCMATCH (SUBSTR (STRCASE (GETVAR "LOGINNAME")) 1 4) "ANDY")
                               "TIFF 34x22 360dpi PS"
                               "PDF 34x22 Std B+W PS"
                             )
                           )
                           T
                     )
      )
;;;      (SETQ pagename
;;;            (ustr 1
;;;                  (ukword 0	;Attempt to get keywords within a getstring call
;;;                          (STRCAT "? " (IF (AND pagename (/= pagename "?")) pagename ""))
;;;                          "Enter pagesetup to use [?]"
;;;                          (IF (AND pagename (/= pagename "?")) pagename "TIFF 34x22 360dpi PS")
;;;                  )
;;;                  (IF (AND pagename (/= pagename "?")) pagename "TIFF 34x22 360dpi PS")
;;;                  T
;;;            )
;;;      )
      "?"
    )
    (PROGN
      (VLAX-FOR plotcfg (VLA-GET-PLOTCONFIGURATIONS (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
        (SETQ allpages (APPEND allpages (LIST (VLA-GET-NAME plotcfg))))
      ) ;_ end of vlax-for
      (FOREACH n allpages
        (PRINC "\n\t\t")
        (PRINC n)
        (PRINC)
      )
    )
  )
  (setstdpage pagename)
  (PRINC)
)

 ;|«Visual LISP© Format Options»
(120 2 15 2 T "end of " 100 9 2 0 nil nil nil T T)
;*** DO NOT add text below the comment! ***|;

 

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 3 of 4

Anonymous
Not applicable
Sorry But i don t understand Too difficult for me
0 Likes
Message 4 of 4

Anonymous
Not applicable
Where i find subroutines?
0 Likes