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
    文章千古事,得失寸心知。


  • 相关阅读:
    android之AlertDialog 点击其它区域自己主动消失
    leetCode191/201/202/136 -Number of 1 Bits/Bitwise AND of Numbers Range/Happy Number/Single Number
    CEF 框架使用集锦
    Qt WebEngine Debugging and Profiling
    Qt内置浏览器引擎WebEngine调试和分析方法
    QWebEngine踩坑记录
    带外(out of band)数据
    碰撞检测算法:点和矩形碰撞、点和圆形碰撞、矩形碰撞、圆形碰撞
    windows 7 安装visual studio 2019 闪退问题解决
    最小二乘法
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2503064.html
Copyright © 2011-2022 走看看