zoukankan      html  css  js  c++  java
  • AutoLISP对话框设计查询图元个数

    AutoLISP对话框设计查询图元个数,可查CIRCLE、LINE和TEXT的数量,DCL代码如下。

    dia5d:dialog {
        label = "练习" ;
        :concatenation {
            :text_part {
                label = "共选到【" ;
            }
            :text {
                width = 6 ;
                key = "t_cir" ;
            }
            :text_part {
                label = "】个CIRCLE" ;
            }
        }
        :concatenation {
            :text_part {
                label = "共选到【" ;
            }
            :text {
                width = 6 ;
                key = "t_line" ;
            }
            :text_part {
                label = "】个LINE" ;
            }
        }
        :concatenation {
            :text_part {
                label = "共选到【" ;
            }
            :text {
                width = 6 ;
                key = "t_text" ;
            }
            :text_part {
                label = "】个TEXT" ;
            }
        }
        ok_cancel;
    }

    LSP代码如下。

    (defun c:dia5d ()
        (setvar "cmdecho" 0)
        (sub_dia5d)
        (if    ss
        (dcl_dia5d)
        )
        (prin1)
    )
    (defun sub_dia5d ()
        (setq ss (ssget))
        (if    (null ss)
        (setq ss (ssadd))
        )
        (setq cir_num 0
          line_num 0
          text_num 0
        )
        (setq n 0)
        (repeat (sslength ss)
        (setq en (ssname ss n))
        (setq entype (cdr (assoc 0 (entget en))))
        (cond ((= entype "CIRCLE") (setq cir_num (1+ cir_num)))
              ((= entype "LINE") (setq line_num (1+ line_num)))
              ((= entype "TEXT") (setq text_num (1+ text_num)))
        )
        (setq n (1+ n))
        )
    )
    (defun dcl_dia5d ()
        (setq dcl_id (load_dialog "dia5d"))
        (if    (not (new_dialog "dia5d" dcl_id))
        (exit)
        )
        (set_tile "t_cir" (itoa cir_num))
        (set_tile "t_line" (itoa line_num))
        (set_tile "t_text" (itoa text_num))
        (setq dd (start_dialog))
    )

    代码完。

    查询其它图元类似。

    作者:codee
    文章千古事,得失寸心知。


  • 相关阅读:
    狭隘试试
    安装django
    青岛大学开源OJ以及部署
    十三、用户名密码管理
    十二、文件权限及所属主组的修改
    十一、tar打包命令的使用
    十、文件管理、属性、查找和软硬链接
    九、系统优化方法(基础优化)
    八、系统登陆信息的显示和硬件信息等
    七、常用基础配置
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2503064.html
Copyright © 2011-2022 走看看