- UID
- 215173
- 积分
- 411
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-1-29
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[php]
(defun ObjectDCL_LoadArx ()
(if (< (atof (getvar "acadver")) 16.0)
(if (not (member "objectdcl.arx" (arx)))
(arxload "objectdcl.arx" "ObjectDCL.arx not found.")
)
(if (not (member "objectdcl2004.arx" (arx)))
(arxload "objectdcl2004.arx" "objectdcl2004.arx not found.")
)
)
)
(defun c:hy_sm(/ oldcmd oldos layerlist layerthaw layon cord_layer fillayer
filENT colorlist)
(vl-load-com)
(ObjectDCL_LoadArx)
(setq oldcmd (getvar "cmdecho"))
(setq oldos (getvar "osmode"))
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq layerlist nil layerthaw nil layon nil)
(setq cord_layer (tblnext "layer" t))
(while cord_layer
(setq layerlist (cons (cdr(assoc 2 cord_layer)) layerlist)
layerthaw (cons (cdr(assoc 70 cord_layer)) layerthaw);;0--thaw 1--froze
layon (cons (cdr(assoc 62 cord_layer)) layon));;7---on -7---off
(setq cord_layer (tblnext "layer"))
)
(setq layerlist (reverse layerlist)
layerthaw (reverse layerthaw)
layon (reverse layon))
(defun c:hysm_DclForm1_OnInitialize (/ i)
(setq i 0)
(repeat (length layerlist)
(Odcl_Grid_AddString hy_sm_hysm_DclForm1_Grid1
(strcat (itoa i) "\t" (nth i layerlist)))
(if (or (= (nth i layerthaw) 1) (< (nth i layon) 0))
(Odcl_Grid_SetItemCheck hy_sm_hysm_DclForm1_Grid1 i 1 0)
(Odcl_Grid_SetItemCheck hy_sm_hysm_DclForm1_Grid1 i 1 1)
)
(setq i (1+ i))
)
(Odcl_Control_SetValue hy_sm_hysm_DclForm1_CheckBox1 t)
(Odcl_ListBox_AddString hy_sm_hysm_DclForm1_ListBox1 "256 號顏色(隨層)")
)
(defun c:hysm_DclForm1_TextButton13_OnClicked ()
(odcl_form_close hy_sm_hysm_DclForm1)
)
(defun c:hysm_DclForm1_TextButton1_OnClicked (/ i)
(setq i 0)
(repeat (length layerlist)
(Odcl_Grid_SetItemCheck hy_sm_hysm_DclForm1_Grid1 i 1 1)
(setq i (1+ i))
)
)
(defun c:hysm_DclForm1_TextButton2_OnClicked (/ i)
(setq i 0)
(repeat (length layerlist)
(Odcl_Grid_SetItemCheck hy_sm_hysm_DclForm1_Grid1 i 1 0)
(setq i (1+ i))
)
)
(defun c:hysm_DclForm1_TextButton7_OnClicked (/ i)
(setq i 1)
(repeat 14
(Odcl_Control_SetValue (eval(read(strcat "hy_sm_hysm_DclForm1_CheckBox" (itoa i)))) t)
(setq i (1+ i))
)
)
(defun c:hysm_DclForm1_TextButton8_OnClicked (/ i)
(setq i 1)
(repeat 14
(Odcl_Control_SetValue (eval(read(strcat "hy_sm_hysm_DclForm1_CheckBox" (itoa i)))) nil)
(setq i (1+ i))
)
)
(defun c:hysm_DclForm1_TextButton3_OnClicked ()
(Odcl_ListBox_AddString hy_sm_hysm_DclForm1_ListBox1
(strcat (itoa (acad_colordlg 1)) " 號顏色"))
)
(defun c:hysm_DclForm1_TextButton4_OnClicked ()
(Odcl_ListBox_DeleteString hy_sm_hysm_DclForm1_ListBox1 (Odcl_ListBox_GetFocusIndex hy_sm_hysm_DclForm1_ListBox1))
)
(defun c:hysm_DclForm1_TextButton5_OnClicked ()
(Odcl_ListBox_Clear hy_sm_hysm_DclForm1_ListBox1)
)
;;;;;;;;;;;;;;;;;;;;
(defun hy_sm_getlayerinformation(/ i)
(setq i 0)
(setq fillayer "")
(repeat (length layerlist)
(if (Odcl_Grid_GetItemCheck hy_sm_hysm_DclForm1_Grid1 i 1)
(setq fillayer (strcat fillayer "," (nth i layerlist)
))
)
(setq i (1+ i))
)
(setq fillayer (vl-string-right-trim "," fillayer))
(setq fillayer (vl-string-left-trim "," fillayer))
)
(defun hy_sm_getentinformation(/ i)
(setq i 1)
(setq filENT "")
(setq entlist '("POINT" "ARC" "LINE" "CIRCLE" "LWPOLYLINE" "TEXT" "DIMENSION" "INSERT"
"POLYGON" "MTEXT" "HATCH" "REGION" "ELLIPSE" "SPLINE"))
(repeat 14
(if (Odcl_Control_GetValue (eval(read(strcat "hy_sm_hysm_DclForm1_CheckBox" (itoa i)))))
(SETQ filENT (strcat filENT "," (NTH (- I 1) ENTLIST)))
)
(SETQ I (1+ i))
)
(setq filENT (vl-string-right-trim "," filent))
(setq filENT (vl-string-left-trim "," filent))
)
(defun hy_sm_getcolorinformation(/ i num)
(setq num (Odcl_ListBox_GetCount hy_sm_hysm_DclForm1_ListBox1))
(setq colorlist nil)
(setq i 0)
(repeat num
(setq colorlist
(cons
(cons 62 (atoi (substr (Odcl_ListBox_GetText hy_sm_hysm_DclForm1_ListBox1 i) 1 3)))
colorlist)
)
(setq i (1+ i))
)
)
;;;;;;;;;
(defun c:hysm_DclForm1_TextButton9_OnClicked (/ ss)
(hy_sm_do "移動")
(if ss (vl-cmdf ".move" ss "" pause pause))
)
(defun c:hysm_DclForm1_TextButton10_OnClicked ()
(hy_sm_do "刪除")
(if ss (vl-cmdf ".erase" ss ""))
)
(defun c:hysm_DclForm1_TextButton11_OnClicked ()
(hy_sm_do "復制")
(if ss
(vl-cmdf ".copy" ss "" pause pause)
)
)
(defun hy_sm_do(cmd)
(hy_sm_getlayerinformation)
(hy_sm_getentinformation)
(hy_sm_getcolorinformation)
(if (not colorlist) (setq colorlist (list '(62 . 256))))
(odcl_form_close hy_sm_hysm_DclForm1)
(prompt (strcat "\n請選擇要" cmd "的圖元:"))
(setq ss (ssget (append (list '(-4 . "<and") (cons 0 filENT) (cons 8 fillayer))
(list '(-4 . "<or"))
colorlist
(list '(-4 . "or>"))
(list '(-4 . "and>"))
)
)
)
)
(odcl_loadproject "hy_sm.odc" t)
(startapp "objectdclpromptcancel.exe")
(odcl_form_show hy_sm_hysm_DclForm1)
(setvar "cmdecho" oldcmd )
(setvar "osmode" oldos )
(prin1)
)
[/php]
程序為繁體版本
運行需要安裝OBJECTDCL 3.0 本論壇有下載
將OBJECTDCL.arx和下下載的程序文件(共有3個)放在CAD支持目錄下
加載 hy_sm.lsp 執行命令hy_sm |
|