;;; -------------------------------------------------------------------------- ;
;;;
(defun kb:protect
-assign
(symbollist
) )
)
(defun kb:unprotect
-assign
(symbollist
) )
)
)
;;; -------------------------------------------------------------------------- ;
;;;
(setq *tempvarlist
* (list 'os_none 'os_end
'os_mid 'os_cen
'os_nod 'os_qua
'os_int 'os_ins
'os_per 'os_tan
'os_nea 'os_clear
'os_app 'os_ext
'os_par 'os_all
'kglobal:acadapp 'kglobal:activedoc
'kglobal:modelspace
'kb:on-error 'kb:savesysvar
'kb:getword 'kb:ss->objlist
'ucs2wcsmatrix 'wcs2ucsmatrix
'kb:get-ss-boundingbox
'kb:draw_lightweightpolyline
)
)
(kb:unprotect-assign *tempvarlist*)
os_end 1
os_mid 2
os_cen 4
os_nod 8
os_qua 16
os_int 32
os_ins 64
os_per 128
os_tan 256
os_nea 512
os_clear 1024
os_app 2048
os_ext 4096
os_par 8192
os_all 16383
)
;;; -------------------------------------------------------------------------- ;
;;;
)
)
;;; -------------------------------------------------------------------------- ;
;;;
(defun kb:on
-error
(msg
/ tmp
) ;;----- Cancel any Active Commands -------------------------------------
;;----- Display error message if applicable _---------------------------
'("console break" "function cancelled" "quit / exit abort")
)
)
)
;;----- Display backtrace ------------------------------------------
)
)
;;----- Release Bound Special Activex Objects --------------------------
(foreach varname kglobal:objectsbound
)
)
)
;;----- Reset System Variables from global list ------------------------
;;
(setq kglobal:sysvarlist
nil kglobal:objectsbound nil
)
)
;;; -------------------------------------------------------------------------- ;
;;; change sysvar value and save its previous value
(defun kb:savesysvar
(vars_list
/ generalvars
) (setq generalvars '
(("CMDECHO" 0) ; save current and Turns off echoing ("expert") ; save current value
("ORTHOMODE") ; save current value
("SNAPANG") ; save current value
("UCSICON") ; save current value
("SNAPMODE") ; save current value
("OSMODE") ; save current value
("PICKADD" 2) ; save current and Turns on PICKADD. Shift-Pick to remove
("PICKAUTO" 1) ; save current and Draws a selection window (for either a window or a crossing selection) automatically
("PICKBOX" 8) ; save current and initial is 3. my default is 6
("INSUNITS" 0) ; save current and Unspecified (No units)
("SORTENTS" 1) ; save current and use selection Order to control
)
)
kglobal:sysvarlist
)
)
)
)
)
;;; -------------------------------------------------------------------------- ;
;;; ( kb:restoresysvar )
(defun kb:restoresysvar
() (setq kglobal:sysvarlist
nil) )
;;; -------------------------------------------------------------------------- ;
;;;
;; kwb 20021103
;; Getreal with options
;; Arguments:
;; msg : The prompt string.
;; def : Value to return if response is <enter>.
;; bit : initget bit
;; kwd : Initget keywords string.
;;
;; Note : Arguments may be set to nil
;; (kb:getreal nil nil nil nil)
;| #lib.
kb:getReal (<Promptmsg><Default><InitBit><KeyWordList>)
Revised Library : kwb 20051031
20051101 kwb : ESC test added.
Build 2.0 :
(SETQ tmpVal (kb:getReal "Percentage of Load" 75.0 (+ 1 2 4) '("Default" "To-suit")))
(SETQ tmpVal (kb:getReal nil nil nil nil))
|;
/ initstring keywordstring returnvalue
)
;;------------------------------
)
2
)
)
keywordstring ""
)
)
;;------------------------------
("Specify Real Value")
)
keywordstring
)
""
)
": "
)
)
;;------------------------------
)
;; ESC was pressed.
default nil
)
)
returnvalue
default
)
)
;;; -------------------------------------------------------------------------- ;
;;;
;; kwb 20021103
;; Getword with options
;; Arguments:
;; msg : The prompt string.
;; def : Value to return if response is <enter>.
;; bit : initget bit
;; kwd : Initget keywords string.
;;
;; Note : Arguments may be set to nil
;;
;; (kb:getword "Specify a dimension [Length/Width/Depth/Option]" "Option" nil "Length Width Depth Option")
;; (kb:getword "Add Prefix to Dimension Text [Yes/No]" "No" nil "Yes No")
;;
(defun kb:getword
(msg def bit kwd
/ returnvalue
) bit
(logand bit
(~
1)) ; ~ (bitwise NOT) drop the 1 bit if def used )
)
returnvalue
def
)
)
;;; -------------------------------------------------------------------------- ;
;;
(defun kb:ss
->objlist
(ss
/ returnval
) )
)
)
returnval
)
;;; -------------------------------------------------------------------------- ;
;; transform objects from the UCS to the WCS
;; when result passed to vla-transformby
;; From gile@TheSwamp
(list '
(1 0 0) '
(0 1 0) '
(0 0 1)) )
)
)
)
;;; -------------------------------------------------------------------------- ;
;; transform objects from the WCS to the UCS
;; when result passed to vla-transformby
;; From gile@TheSwamp
(list '
(1 0 0) '
(0 1 0) '
(0 0 1)) )
)
)
)
;;; -------------------------------------------------------------------------- ;
;; Return the bounding box opposite corners of a selection set of objects
;; a list of 3D points representing lower-left and upper-right
;; expressed in the current UCS
;; From gile@TheSwamp
(defun kb:get
-ss
-boundingbox
(ss
/ obj ll ur ll
-ptlist ur
-ptlist
) ur
-ptlist
(cons (vlax
-safearray
->list ur
) ur
-ptlist
) )
)
(list ll
-ptlist ur
-ptlist
) )
)
;;; -------------------------------------------------------------------------- ;
;;;
(defun kb:draw_lightweightpolyline
(vertexlist la closeflag / ucsznormal elev polyobj)
)
'addlightweightpolyline
)
vertexlist
)
)
)
)
)
polyobj
)
;;; -------------------------------------------------------------------------- ;
;;;
(kb:protect-assign *tempvarlist*)
;;; -------------------------------------------------------------------------- ;
;;;