TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: One Shot on March 03, 2005, 03:15:44 PM
-
I am trying to set a viewport on A-Anno-Spce-Nplt . Can someone help with this. This is what I got so far. I don't think that it will work. I would like it to add the layer A-Anno-Spce-Nplt with color 8. It would need to have the print turned off.
Thank you for your help.
This is my first lisp that I tried to write.
; File Name: Revision Viewport Non Plot.LSP
; Description: Puts Viewports on its own Not Plot Layer so it will not plot.
;
;*******************************************************************************
(defun C:vport-nplt (/ SSetLayer)
(setq SSetLayer (ssget "_X" '((8 . "A-Anno-Spce-Nplt"))))
(if SSetLayer
(command "._A-Anno-Spce-Nplt" SSetLayer "")
)
(princ)
)
-
I am trying to set a viewport on A-Anno-Spce-Nplt . Can someone help with this. This is what I got so far. I don't think that it will work. I would like it to add the layer A-Anno-Spce-Nplt with color (8). It would need to have the print turned off.
Thank you for your help.
This is my first lisp that I tried to write.
; File Name: Revision Viewport Non Plot.LSP
; Description: Puts Viewports on its own Not Plot Layer so it will not plot.
;
;*******************************************************************************
(defun C:vport-nplt (/ SSetLayer)
(setq SSetLayer (ssget "_X" '((8 . "A-Anno-Spce-Nplt"))))
(if SSetLayer
(command "._A-Anno-Spce-Nplt" SSetLayer "")
)
(princ)
)
Can youu please move this to the Lips forum. I put it here by mistake
Thank you,
-
Done! :loneranger:
-
Done! :loneranger:
Thank you!
-
I have this in VBA if you cant figure it out. Sorry, my LISP is really bad
-
So the VP's are existing and you want to gather them all up in one sset them put them on the "A-Anno-Spce-Nplt" layer, and set that layer to "no plot"?
-
So the VP's are existing and you want to gather them all up in one sset them put them on the "A-Anno-Spce-Nplt" layer, and set that layer to "no plot"?
When yes and more.
Your lisp to your question!
Gather them up and put them to the A-Anno-Spce-Nplt and set the layer to color 8 and set the layer to "no plot". (yes)
My lisp to my question!
Add a VP and have them go to the A-Anno-Spce-Nplt and set the layer to color 8 and set the layer to "no plot". (yes)
Thank you,
-
Ok, here's a start. This will create a sset of all the VP's in the dwg. Gotta go ..........
(setq ss (ssget "x" '((0 . "VIEWPORT"))))
-
If you are creating the vport then you can use this code to create the layer then create the vport then set the layer back:
;;; ------------ Sub used to create layers
;;; Call it like this:
;;; (if (not (tblsearch "layer" "G-VPORT-NPLT"))
;;; (CREATE_LAYER "G-VPORT-NPLT" "Non-plotting viewport layer" "Continuous" "18" "7" "0")
;;; )
;;;
;;; (CREATE_LAYER "NAME" "Descriptions" "Linetype" "Thickness" "Color" "Plot") - Plot is "1" NoPlot is "0"
(defun CREATE_LAYER (Layer Descpition Linetype Thickness Color Plot / TmpList)
;; Create a list for entmake
(setq TmpList
'((0 . "LAYER")
(100 . "AcDbSymbolTableRecord")
(100 . "AcDbLayerTableRecord")
(70 . 0)
)
)
;; Create layer name list
(setq TmpList (append TmpList (list (cons 2 Layer))))
;; Create layer color list
(setq TmpList (append TmpList (list (cons 62 (atoi Color)))))
;; Create layer linetype list
(setq TmpList (append TmpList (list (cons 6 Linetype))))
;; Create layer lineweight list
(setq TmpList (append TmpList (list (cons 370 (atoi Thickness)))))
;; Create layer plot list
(setq TmpList (append TmpList (list (cons 290 (atoi Plot)))))
;; Create layer from first item in the list
(entmake TmpList)
;; Create layer description
(if(= 16.1 (atof(getvar "acadver")))
(progn
(setq VLA-Obj(vla-Add (vla-Get-Layers (vla-Get-ActiveDocument(vlax-Get-Acad-Object)))Layer))
(vla-Put-Description VLA-Obj Descpition)
)
)
)
I do this in my titleblock inserting program and it works fine.
If you have anymore question feel free to ask
-
If you are creating the vport then you can use this code to create the layer then create the vport then set the layer back:
;;; ------------ Sub used to create layers
;;; Call it like this:
;;; (if (not (tblsearch "layer" "G-VPORT-NPLT"))
;;; (CREATE_LAYER "G-VPORT-NPLT" "Non-plotting viewport layer" "Continuous" "18" "7" "0")
;;; )
;;;
;;; (CREATE_LAYER "NAME" "Descriptions" "Linetype" "Thickness" "Color" "Plot") - Plot is "1" NoPlot is "0"
(defun CREATE_LAYER (Layer Descpition Linetype Thickness Color Plot / TmpList)
;; Create a list for entmake
(setq TmpList
'((0 . "LAYER")
(100 . "AcDbSymbolTableRecord")
(100 . "AcDbLayerTableRecord")
(70 . 0)
)
)
;; Create layer name list
(setq TmpList (append TmpList (list (cons 2 Layer))))
;; Create layer color list
(setq TmpList (append TmpList (list (cons 62 (atoi Color)))))
;; Create layer linetype list
(setq TmpList (append TmpList (list (cons 6 Linetype))))
;; Create layer lineweight list
(setq TmpList (append TmpList (list (cons 370 (atoi Thickness)))))
;; Create layer plot list
(setq TmpList (append TmpList (list (cons 290 (atoi Plot)))))
;; Create layer from first item in the list
(entmake TmpList)
;; Create layer description
(if(= 16.1 (atof(getvar "acadver")))
(progn
(setq VLA-Obj(vla-Add (vla-Get-Layers (vla-Get-ActiveDocument(vlax-Get-Acad-Object)))Layer))
(vla-Put-Description VLA-Obj Descpition)
)
)
)
I do this in my titleblock inserting program and it works fine.
If you have anymore question feel free to ask
Thank you,
Brad
Tim,
Can you shoot me an e-mail?
-
If you give your ad. Sure
-
If you give your ad. Sure
bnc_designs@yahoo.com
-
If you give your ad. Sure
bnc_designs@yahoo.com
How would you have this lisp to be able to create the vports? Could it be done in a dialog box with these selections in it?(Fit/Shadeplot/Lock/Object/Polygonal/Restore/2/3/4/Fit) Also to have to change the print symbol in the layer manager to show Non Plot
;;; VPLMAKE
;;; Makes the layer A-Anno-Spce-Nplt and places all PS viewports on it
;;; Copyright 2005 Lance Gordon Custom Software
(defun c:vplmake (/ tm filter ss ssctr mctr)
(setvar "CMDECHO" 0)
(command "_UNDO" "BEgin")
(if (not (tblsearch "LAYER" "A-Anno-Spce-Nplt"))
(command "_-LAYER" "New" "A-Anno-Spce-Nplt" "OFF" "A-Anno-Spce-Nplt" "")
(command "_-LAYER" "OFF" "A-Anno-Spce-Nplt" "")
)
(setq tm (getvar "TILEMODE"))
(setq filter (list '(-4 . "<AND")
'(0
.
"VIEWPORT"
)
'(-4 . "<NOT")
'(69 . 1)
'(-4 . "NOT>")
'(-4 . "AND>")
)
) ; exclude model vport
(if (setq ss (ssget "X" filter))
(progn ; retrieve layout names
(setq llist (layout-list ss))
(if (= tm 1)
(setvar "TILEMODE" 0)
) ; and walk through layouts.
(setq mctr 0) ; count changed VPs
(foreach layout llist
(setvar "CTAB" layout)
(if (/= (getvar "CVPORT") 1)
(command "PSPACE")
) ; be sure we can get at the ports
(setq ssctr 0)
(while (< ssctr (sslength ss))
(setq cvp (ssname ss ssctr))
(if (and (= (getvar "CTAB") (cdr (assoc 410 (entget cvp))))
(/= (cdr (assoc 8 (entget cvp))) "A-Anno-Spce-Nplt")
) ; change vp if not already on A-Anno-Spce-Nplt layer
(progn
(command "_CHANGE" cvp "" "P" "LA" "A-Anno-Spce-Nplt" "")
(setq mctr (1+ mctr))
)
)
(setq ssctr (1+ ssctr))
)
)
)
(alert " No viewports found.")
)
(if (= tm 1)
(progn
(setvar "TILEMODE" 1)
)
)
(if (> mctr 0)
(princ
(strcat (itoa mctr) " viewport(s) placed on layer A-Anno-Spce-Nplt.")
)
) ; Warn that A-Anno-Spce-Nplt is turned off before exiting
(alert "NOTE: Layer \"A-Anno-Spce-Nplt\" is turned OFF.")
(command "_UNDO" "End")
(setvar "CMDECHO" 1)
(princ)
)
;;; LAYOUT-LIST creates a list of Layout names
;;; where viewports are found. The selection set
;;; passed with this routine is NOT altered or destroyed.
(defun layout-list (vps / vp el ctr)
(if (> (atoi (getvar "ACADVER")) 14) ; Check for R14 (one layout)
(progn
(setq ctr 0)
(while (< ctr (sslength vps))
(setq vp (ssname vps ctr))
(setq el (entget vp))
(if (/= (cdr (assoc 69 el)) 1) ; Look for Layout names of VPs
(if lllist ; and put them in a list
(if (not (member (cdr (assoc 410 el)) lllist))
(setq lllist (append lllist (list (cdr (assoc 410 el)))))
) ; Append only if not already in the list
(setq lllist (list (cdr (assoc 410 el))))
)
)
(setq ctr (1+ ctr))
)
)
(progn ; If this is R14,
(setq vp (ssname vps 0))
(while (not (null vp)) ; walk through VP list,
(ssdel vp vps)
(setq el (entget vp))
(if (/= (cdr (assoc 69 el)) 1) ; look for PSPACE A-Anno-Spce-Nplt,
(setq lllist "Layout")
) ; and note if found.
(setq vp (ssname vps 0))
)
)
)
lllist ; Send layout list back to calling routine
)
(princ "\nVPLMAKE loaded. (C)LGCS 2005\n")
(princ)