我的两分钱。。。
;;;--------------------------------------------------------------------;
;;; Load personal settings function:
(defun c:LPS(/ linList linetypesTable layerTable layerName layerItem
layerColor layerLineType)
(vl-load-com)
(vla-startundomark
(cond (*activeDoc*)
((setq *activeDoc*
(vla-get-activedocument (vlax-get-acad-object))))))
;; Linetypes check
(foreach lin'("hidden"
"hidden2"
"hiddenx2"
"center"
"center2"
"centerx2"
"phantom"
"phantom2"
"phantomx2")
(if (not (tblsearch "LTYPE" lin))
(setq linList (cons lin linList))))
(if linList
(foreach linlinList
(vla-load
(cond
(linetypesTable)
((setq linetypesTable (vla-get-linetypes *activeDoc*))))
lin
"acad.lin")))
;; Layer check
(foreach lay'(("BALLOON" "15" "CONTINUOUS")
("BORDER" "33" "CONTINUOUS")
("BOTTOM" "31" "CONTINUOUS")
("CENTER" "35" "CENTER" "")
("CONSTRUCTION" "5" "PHANTOM")
("DIMENSION" "40" "CONTINUOUS")
("FRONT" "83" "CONTINUOUS")
("GHOST" "12" "CONTINUOUS")
("HATCH" "123" "CONTINUOUS")
("HIDDEN" "252" "HIDDEN2")
("PART" "7" "CONTINUOUS")
("REV" "1" "CONTINUOUS")
("SECTION" "5" "PHANTOM2")
("SIDE" "30" "CONTINUOUS")
("NOTES" "40" "CONTINUOUS")
("TOP" "6" "CONTINUOUS"))
(setq layerTable (vla-get-layers *activeDoc*))
(if (tblsearch "LAYER" (setq layerName (car lay)))
(setq layerItem (vla-item layerTable layerName))
(setq layerItem (vla-add layerTable layerName)))
(if (/= (setq layerColor (cadr lay)) (vla-get-color layerItem))
(vla-put-color layerItem layerColor))
(if (/= (setq layerLineType (caddr lay))
(vla-get-linetype layerItem))
(vla-put-linetype layerItem layerLineType))
;; <- Additional layer checks go here, eg. freeze, description, etc.
)
(vla-endundomark *activeDoc*)
(princ))
;;;--------------------------------------------------------------------;
(if (= 1 (getvar 'dwgtitled)) ; If drawing is named,
(c:LPS)) ; Load personal settings
;;;--------------------------------------------------------------------;
(princ)
Thanks all!
I will study your revamped code examples and suggestions - it looks like the answer to my original post is in there. Hi Diedesigner,
I just happen to read this, maybe I can help because, one day, I had exactly the same problem.
It was caused by anin a lisp routine. Or so to say a "" too much. I cannot tell exactly how and where but I'd say somewhere at the end of a code.
What happens is when AutoCAD starts up, the routine is loaded, and anis given. Just the same as when starting up vanilla AutoCAD; when ready, hit enter and the help pops up.
My 2 cents. ("center" "35" "center" "")
页:
1
[2]