为便于讨论,将楼主的代码整理后放于下:
![](source/plugin/imc_colorcode/images/loading.gif)
- ;;===================================================
- (vl-load-com)
- ;;===================================================
- (defun MLA (layname laycolor)
- (SETVAR "CMDECHO" 0)
- (setq acadobject1 (vlax-get-acad-object)
- acaddocument1 (vla-get-activedocument acadobject1)
- mspace1 (vla-get-modelspace acaddocument1)
- )
- (setq LayerSel (vla-get-Layers AcadDocument1))
- (setq LayerObj (vla-add LayerSel layname))
- (if (/= nil (tblsearch "layer" layname))
- (progn
- (vla-put-activelayer AcadDocument1 LayerObj)
- (if (/= nil laycolor)
- (vla-put-color LayerObj laycolor)
- )
- )
- (progn
- (vla-get-activelayer AcadDocument1 LayerObj)
- (if (/= nil laycolor)
- (vla-put-color LayerObj laycolor)
- )
- )
- )
- )
- ;;===================================================
- (defun GG ()
- (setq dcl_id (load_dialog "tcgz.dcl"))
- (new_dialog "tcgz" dcl_id)
- (if (= txt nil)
- (set_tile "txt" "TEXT")
- (set_tile "txt" txt)
- )
- (if (= dim nil)
- (set_tile "dim" "DIM")
- (set_tile "dim" dim)
- )
- (if (= txtcolor nil)
- (set_tile "txtcolor" "3")
- (set_tile "txtcolor" txtcolor)
- )
- (if (= dimcolor nil)
- (set_tile "dimcolor" "6")
- (set_tile "dimcolor" dimcolor)
- )
- (action_tile "txt" "(setq txt $value)")
- (action_tile "dim" "(setq dim $value)")
- (action_tile "txtcolor" "(setq txtcolor $value)")
- (action_tile "dimcolor" "(setq dimcolor $value)")
- (action_tile "cancel" "(done_dialog 0)")
- (action_tile "accept" "(get_w)(done_dialog 1)")
- (setq next (start_dialog))
- (cond
- ((= next 01) (c:malay))
- )
- )
- ;;===================================================
- (defun get_w ()
- (setq txt (get_tile "txt"))
- (setq dim (get_tile "dim"))
- (setq txtcolor (get_tile "txtcolor"))
- (setq dimcolor (get_tile "dimcolor"))
- )
- ;;===================================================
- (defun DIY ()
- (setq txt "TEXT")
- (setq dim "DIM")
- (setq txtcolor "3")
- (setq dimcolor "6")
- (GG)
- )
- ;;===================================================
- (DEFUN c:malay (/ sst ssd ssl ssh ssx sss sxs xxx ssp)
- ;(setq img1 img11)
- (mla txt txtcolor)
- (mla dim dimcolor)
- (setq
- sst (ssget "X" '((0 . "*TEXT")))
- ssd (ssget "X" '((0 . "DIMENSION")))
- )
- (if sst
- (command "chprop" sst "" "la" txt "")
- )
- (if ssd
- (command "chprop" ssd "" "la" dim "")
- )
- )
- ;;===================================================
首先从主函数malay开始看起,
[PHP]
(mla txt txtcolor)
(mla dim dimcolor)
[/PHP]
这两句中有四个变量,不知从何而来,希望楼主能本着坦诚交流的心态将完整部分拿出来,以便进一步的讨论。 |