- ;202108162107修改
- (defun c:kc (/ *error* ang l1 ltype mpt1 os out pt1 pt2 pt3 ptlst os1)
- (defun *error* (msg)
- (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
- (progn
- (setvar "OSMODE" os)
- (setvar "PLINEWID" os1)
- )
- )
- (princ)
- )
- ;;;;;;----------------------------------------------------
- (setq os (getvar "OSMODE"))
- (setq os1 (getvar "plinewid"))
- (setvar "OSMODE" 1025)
- ;;; (setvar "plinewid" 0.09)
- ;;; (initget "X")
- ;;; (setq pt1 (getpoint "\n第一点[虚线< X >]:"))
- ;;; (cond
- ;;; ((or (equal pt1 "x") (equal pt1 "X"))
- (while (setq pt1 (getpoint "\n第一点:"))
- (setq pt2 (getpoint pt1 "\n第二点[相邻点]:")
- pt3 (getcorner pt1 "\n第三点[对角点]:")
- L1 (distance pt1 pt2)
- ang (angle pt2 pt1)
- mpt1 (polar pt3 ang (* 0.5 L1))
- ptlst (list pt1 mpt1 pt2)
- Ltype (vlax-for each
- (vla-get-Linetypes
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (setq out (cons (vla-get-Name each) out))
- )
- )
- (if (member "JIS_09_15" ltype)
- (entmake (append
- (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- (cons 6 "JIS_09_15")
- (cons 62 6)
- (cons 43 0.09)
- (cons 90 (length ptlst))
- )
- (mapcar '(lambda (x) (cons 10 x)) ptlst)
- )
- )
- (progn
- (vla-Load (vla-get-Linetypes
- (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- "JIS_09_15"
- (findfile "acadiso.lin")
- )
- (entmake (append
- (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- (cons 6 "JIS_09_15")
- (cons 43 0.09)
- (cons 62 6)
- (cons 90 (length ptlst))
- )
- (mapcar '(lambda (x) (cons 10 x)) ptlst)
- )
- )
- )
- )
- )
- ;;; )
- ;;; (T
- ;;; (while pt1
- ;;; (setq pt2 (getpoint pt1 "\n第二点[相邻点]:")
- ;;; pt3 (getcorner pt1 "\n第三点[对角点]:")
- ;;; L1 (distance pt1 pt2)
- ;;; ang (angle pt2 pt1)
- ;;; mpt1 (polar pt3 ang (* 0.5 L1))
- ;;; ptlst (list pt1 mpt1 pt2)
- ;;; )
- ;;; (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length ptlst))) (mapcar '(lambda (x) (cons 10 x)) ptlst)))
- ;;; (setq pt1 (getpoint "\n第一点:"))
- ;;; )
- ;;; )
- (setvar "OSMODE" os)
- (SETVAR "plinewid" os1)
- (princ)
- )
- (prompt "\n******程序运行命令<kc>******")
- (prin1)
|