明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1209|回复: 0

请问高手,如何选取下拉列表,取得图层的线型与颜色

[复制链接]
发表于 2005-11-16 23:50 | 显示全部楼层 |阅读模式

请高手给看一下,我想选下拉列表图层后,便取得相应的线型与颜色

然后再改相应图层与颜色

    (defun c:tc111( )
        (vl-load-com)
  (cmdla0)
  (setq dcl_id (load_dialog "tc_gtcmxxjys"))
(if (not(new_dialog "tc_gtcmxxjys" dcl_id))(exit))
 (setq tc_dqtclist (erase-equal-lst (Get-Laylist-BDY)))
 ;(setq tc_dqxxlist (erase-equal-lst (Get-Linelist-BDY)))    
 (show_list "tc_gtcmxxjys01" tc_dqtclist)
 (show_list "tc_gtcmxxjys03" tc_2005list1)
 (show_list "tc_gtcmxxjys04" tc_2005list2)
 

     
          (if (null yy10)
    (progn
      (set_tile "yy" "2")
      (setq yy10 "2")
    )
    (set_tile "yy" yy10)
  )

            (if (null yy11)
    (progn
      (set_tile "yy" "2")
      (setq yy11 "2")
    )
    (set_tile "yy" yy11)
 )
     
         (if (null tc_ss300)
    (progn
      (set_tile "tc_gtcmxxjys01" "0")
      (setq tc_ss300 "0")
    )
    (set_tile "tc_gtcmxxjys01" tc_ss300)
  )

        (if (null tc_ss400)
    (progn
      ;(set_tile "tc_gtcmxxjys02" "选取图层")
      (set_tile "tc_gtcmxxjys02" "选取图层")
      (setq tc_ss400 "选取图层")
    )
    (set_tile "tc_gtcmxxjys02" tc_ss400)
  )

             (if (null tc_ss500)
    (progn
      (set_tile "tc_gtcmxxjys03" "2")
      (setq tc_ss500 "2")
    )
    (set_tile "tc_gtcmxxjys03" tc_ss500)
  )
             (if (null tc_ss600)
    (progn
      (set_tile "tc_gtcmxxjys04" "2")
      (setq tc_ss600 "2")
    )
    (set_tile "tc_gtcmxxjys04" tc_ss600)
  )

     
  (setq key10 "img10")
  (setq px10(dimx_tile key10))
  (setq py10(dimy_tile key10))
  (start_image key10)
  (fill_image 0 0 px10 py10 (atoi yy10))
  (end_image)
     
  (setq key11 "img11")
  (setq px11(dimx_tile key11))
  (setq py11(dimy_tile key11))
  (start_image key11)
  (fill_image 0 0 px11 py11 (atoi yy11))
  (end_image)
     
     
      (action_tile "img10" "(tc_img10)")
      (action_tile "img11" "(tc_img11)")
      (action_tile "tc_gtcmxxjys01" "(setq tc_ss300 $value)");
      (action_tile "tc_gtcmxxjys02" "(setq tc_ss400 $value)")
      (action_tile "tc_gtcmxxjys03" "(setq tc_ss500 $value)")
      (action_tile "tc_gtcmxxjys04" "(setq tc_ss600 $value)")
      (action_tile "tc_gtcmxxjys05" "(tc_gtcmxxjys005)")
      (action_tile "tc_gtcmxxjys06" "(tc_gtcmxxjys006)")
      (action_tile "tc_gtcmxxjys07" "(tc_value6)(tc_gtcmxxjys007)")
      (action_tile "accept" "(done_dialog 1)")
      (start_dialog)
     ;(cond ((= tt 1)(tc_aysgtczx)))
 )


(defun tc_gtcmxxjys005 ( / DAT_FILE2 TC_TSI2 TC_TSLIST2 TC_TSNUM2)
  (setq dat_file2 (getfiled "读取图层" "" "ini" 2))
  (setq tc_2005list1 (mc_getfile dat_file2))
  (show_list "tc_gtcmxxjys03" tc_2005list1)
  (prin1)
)

(defun tc_gtcmxxjys006 ( / DAT_FILE2 TC_TSI2 TC_TSLIST2 TC_TSNUM2)
  (setq dat_file2 (getfiled "读取线型" "" "ini" 2))
  (setq tc_2005list2 (mc_getfile dat_file2))
  (show_list "tc_gtcmxxjys04" tc_2005list2)
  (prin1)
)


(defun tc_gtcmxxjys007(/ TCSS300 TCSS500 TCSS600 YY10)
  (tc_chklay tcss300 (atoi yy10) tcss500 tcss600)
  (prin1)
  )


(defun tc_value6()
  (setq tcss300 (nth (atoi tc_ss300) tc_dqtclist)
 tcss400 (get_tile "tc_gtcmxxjys02")
 tcss500 (nth (atoi (get_tile "tc_gtcmxxjys03")) tc_2005list1)
 tcss600 (nth (atoi (get_tile "tc_gtcmxxjys04")) tc_2005list2)
 )
)


 (defun tc_chklay (layname cc layss linetype / TC_CC1 TC_COLOR TC_ENT TC_I TC_S1 TC_SS)
   (setq tc_ss (ssget (list (cons 8 layname)))
       tc_i    -1
  )
  (while (setq tc_s1 (ssname tc_ss (setq tc_i (1+ tc_i))))
   (setq tc_ent (entget tc_s1))
(setq tc_ent (subst (cons 8 layss) (assoc 8 tc_ent) tc_ent))
(setq tc_ent (subst (cons 6 linetype) (assoc 6 tc_ent) tc_ent))
(setq tc_color (cdr (assoc 62 tc_ent)))
    (if tc_color
      (setq tc_ent (subst (cons 62 cc) (assoc 62 tc_ent) tc_ent))
      (progn
 (setq tc_cc1 (cons 62 cc))
      (setq tc_ent (cons tc_cc1 tc_ent))
      )
      )
(entmod tc_ent)
  )

;;;;;;=======================================================
;;;;;;====================
;;;;;;=======================================================
  (defun tc_img10( )
(if (not(new_dialog "ys" dcl_id))(exit))
    (if (null yy10)
    (progn
     (set_tile "yy" "2")
      (setq yy10 "2")
    )
    (set_tile "yy" yy10)
  )
    (action_tile "yy" "(setq yy10 $value)")
  (setq yy10 (get_tile "yy"))
(start_dialog)
;(set_tile "img3" yy3)
  (start_image key10)
  (fill_image 0 0 px10 py10 (atoi yy10))
  (end_image)
  )

  (defun tc_img11( )
(if (not(new_dialog "ys" dcl_id))(exit))
    (if (null yy11)
    (progn
      (set_tile "yy" "2")
      (setq yy11 "2")
    )
    (set_tile "yy" yy11)
  )
    (action_tile "yy" "(setq yy11 $value)")
  (setq yy11 (get_tile "yy"))
(start_dialog)
;(set_tile "img3" yy3)
  (start_image key11)
  (fill_image 0 0 px11 py11 (atoi yy11))
  (end_image)
 )


(defun mc_getfile(files / tmplst x fn)
  (setq files(findfile files))
  (if files
    (progn
      (setq fn (open  files "r"))
      (while (setq x (read-line fn))
        (setq tmplst(append tmplst(list x)))
      )
      (close fn)
      tmplst
    )
     nil
  )
)

(defun show_list (key newlist)
  (start_list key)
  (mapcar 'add_list newlist)
  (end_list)
)


;;;;;;==============================================
;;;;;;===========读取线型并加载线型=================
;;;;;;==============================================
(defun tc_dqxxsj02 ( / DAT_FILE2 TC_TSI2 TC_TSLIST2 TC_TSNUM2 TC_TSTC2)
  (setq dat_file2 (getfiled "读取设置" "" "ini" 2))
  (setq tc_tsnum2 (mc_getfile_line dat_file2))
  (setq tc_tslist2 (mc_getfile dat_file2))
  (setq tc_tsi2 0)
  (repeat tc_tsnum2
    (setq tc_tstc2 (nth tc_tsi2 tc_tslist2))
    (setq tc_tsi2 (1+ tc_tsi2))
  )
  (prin1)
)

;;;;;;
;;;;;;读取文件成表
;;;;;;
(defun mc_getfile(files / tmplst x fn)
  (setq files(findfile files))
  (if files
    (progn
      (setq fn (open  files "r"))
      (while (setq x (read-line fn))
        (setq tmplst(append tmplst(list x)))
      )
      (close fn)
      tmplst
    )
     nil
  )
)
;;;;;;
;;;;;;取得文件的行数
;;;;;;
(defun mc_getfile_line(files / tmplst x fn)
  (setq files(findfile files))
  (if files
    (progn
      (setq tmplst 0)
      (setq fn(open files "r"))
      (while (read-line fn)
        (setq tmplst (+ 1 tmplst))
      )
      (close fn)
      tmplst
    )
    nil
  )
)
;;;;;;读取指定文件中指定行的内容
;;;;;;(mc_getfile_text files line)
;;;;;;
(defun mc_getfile_text (files line / fn text)
  (setq line(+ 1 line))
  (setq files (findfile files))
  (if files
    (progn
      (setq fn(open files "r"))
      (if (<= line (mc_getfile_line files))
        (progn
          (repeat line
            (setq text(read-line fn))
     ;(setq text (read text));新加
          )
          (close fn)
          text
        )
        nil
      )
    )
    nil
  )
)

;对话框程序


tc_gtcmxxjys:dialog{label="改图层名线型及颜色";
:boxed_column{label="     图层列表           线型列表       颜色";
:row{
:popup_list{key="tc_gtcmxxjys01";fixed_width=true;edit_width=15;}
:edit_box{key="tc_gtcmxxjys02";fixed_width=true;edit_width=15;}
:image_button{key ="img10";width = 6;aspect_ratio = 0.66;fixed_width = true;}
}
:row{
:popup_list{key="tc_gtcmxxjys03";fixed_width=true;edit_width=15;}
:popup_list{key="tc_gtcmxxjys04";fixed_width=true;edit_width=15;}
:image_button{key ="img11";width = 6;aspect_ratio = 0.66;fixed_width = true;}
}
:row{
:button{label="读取参照图层";key="tc_gtcmxxjys05";fixed_width=true;edit_width=15;}
:button{label="读取参照线型";key="tc_gtcmxxjys06";fixed_width=true;edit_width=15;}
}
:button{label="执行程序";key="tc_gtcmxxjys07";}
}
ok_cancel;
}

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 05:33 , Processed in 0.159098 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表