iDwgLsp 프로그램을 설치하면 구글 블로거에 등록된 리습코드를 구동 시켜주는 기능을 지원합니다. - 다운로드 사이트 : http://arx119.egloos.com/10973367 - 지원버전 오토캐드 (2007~2013)
2012년 12월 25일 화요일
[LISP-GSJ] FuncEntity.lsp (포스트아이디 : 5412586620614814752)
;;=========================================================================================================
;;=========================================================================================================
;;=========================================================================================================
(defun C:FuncEntity()
(princ "\nFuncEntity")
(princ)
)
;;=========================================================================================================
;;=========================================================================================================
;; Entity -> PointList
;;=========================================================================================================
(defun Func_EntityToPoint(dEntityName)
(setq dRtnList (list ))
(setq dRepNum 0)
(if (= (type dEntityName) 'ENAME)
(progn
(setq dEntityInfo (entget dEntityName))
(setq dEntityType (cdr (assoc 0 dEntityInfo)))
;----------------------------------------------------------------------------------------------
(cond
;------------------------------------------------------------------------------------------
((= dEntityType "LWPOLYLINE")
(setq dRepLen (length dEntityInfo))
(repeat dRepLen
(setq dAss10 (nth dRepNum dEntityInfo))
(if (= (car dAss10) 10)
(setq dRtnList (append dRtnList (list (cdr (append dAss10 (list 0.0))))))
)
(setq dRepNum (+ dRepNum 1))
)
)
;------------------------------------------------------------------------------------------
(t
(alert "지원하지 않는 Entity 입니다! ")
(setq dRtnList nil)
)
;------------------------------------------------------------------------------------------
)
;----------------------------------------------------------------------------------------------
)
(progn
(alert "올바른 Entity 이름이 아닙니다! ")
(setq dRtnList nil)
)
)
dRtnList
)
;=========================================================================================================
;;=========================================================================================================
;; Line Type 생성
;;=========================================================================================================
(defun Func_MakeLineType(iLTName iDescription iParamList / iLTName iDescription iParamList iX)
(if (tblsearch "LType" iLTName)
(progn
(setq iMKList (append (list '(0 . "LTYPE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLinetypeTableRecord")
(cons 2 iLTName) (cons 3 iDescription) '(70 . 0) (cons 72 65) (cons 73 (length iParamList))
;(cons 72 (ascii "A"))
(cons 40 (apply '+ (mapcar 'abs iParamList))))
(apply 'append (mapcar '(lambda (iX) (list (cons 49 iX) '(74 . 0))) iParamList)))
)
(entmake iMKList)
)
)
(princ)
)
;;=========================================================================================================
;;=========================================================================================================
;; Layer 생성
;;=========================================================================================================
(defun Func_MakeLayer(iLayerName iLayerColor iLineType iMakeFlag)
(if (and (= iMakeFlag 1) (= (tblsearch "Layer" iLayerName) nil))
(progn
(alert (strcat "[ " iLayerName " ] Layer를 생성합니다. \n\nLayer 명령을 사용해서 수정하세요 "))
(setq iMKList (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0)))
(setq iMKList (append iMKList (list (cons 2 iLayerName))))
(setq iMKList (append iMKList (list (cons 6 iLineType))))
(setq iMKList (append iMKList (list (cons 62 iLayerColor))))
(entmake iMKList)
)
)
(princ)
)
;;=========================================================================================================
;;=========================================================================================================
;;
;;=========================================================================================================
(defun Func_MakeEntity( iEntType iLName iLType iLColor iPTList iCloseFlag
/ iEntType iLName iLType iLColor iPTList iCloseFlag iEntHead iMakeFlag iMakeEntityInfo iReturnEntity)
(setq iMakeFlag 'T)
(setq iEntHead (list ))
(setq iEntHead (append iEntHead (list (cons 8 iLName))))
(if (and (/= (strcase iLType) "BYLAYER") (/= (strcase iLType) "0"))
(setq iEntHead (append iEntHead (list (cons 6 iLType))))
)
(if (and (/= iLColor 256) (/= iLColor 0))
(setq iEntHead (append iEntHead (list (cons 62 iLColor))))
)
(cond
;--------------------------------------------------------------------------------------------------
((= iEntType "LINE")
(setq iMakeEntityInfo (list '(0 . "LINE") (cons 10 (nth 0 iPTList)) (cons 11 (nth 1 iPTList))))
)
;--------------------------------------------------------------------------------------------------
(t
(alert "잘못된 Entity Type ")
(setq iMakeFlag nil)
)
;--------------------------------------------------------------------------------------------------
)
(if (= iMakeFlag 'T)
(progn
(setq iMakeEntityInfo (append iMakeEntityInfo iEntHead))
(entmake iMakeEntityInfo)
(setq iReturnEntity (entlast))
)
(setq iReturnEntity nil)
)
)
;;=====================================================================================================
;;=====================================================================================================
;; 기준이 되는 엔티티 이후의 모든 엔티티를 Entity Set으로 반환한다.
;;=====================================================================================================
(defun Func_AfterEntitySelect(LastEntity / LastEntity RtnEntitySet NextEntity)
(setq RtnEntitySet (ssadd))
(setq NextEntity (entnext LastEntity))
(while (/= NextEntity nil)
(setq RtnEntitySet (ssadd NextEntity RtnEntitySet))
(setq NextEntity (entnext NextEntity))
)
RtnEntitySet
)
;;=========================================================================================================
;;=========================================================================================================
;;=========================================================================================================
(princ)
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기
즐거운 하루되세요...^^