明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 40667|回复: 372

查看系统中的"命令/函数/变量"

    [复制链接]
发表于 2013-1-22 14:48 | 显示全部楼层 |阅读模式
;;1 如果你装了插件而又没有安装ET,其中定义了多个命令,你不知道,那就看看吧;
;;如果你想重新定义一个命令,又不想与原有命令干涉,那就更应该看看了。
;;2 有多少函数呢,你不知道吧,我从来也不知道,那我们一起来看看吧
;;3 你编程时如果不习惯设置局部变量,在这里你可以看到运行后的值是多少了
;;查看系统中的"命令/函数/变量"
;;查看系统中的"命令/函数/变量"------------------------自贡黄明儒 2013.1.22
(defun c:MyLsp (/ A B FILE GETKW LST N TEMP_FILE)
  ;;1 是否是命令
  (defun Is-command (a /)
    (and (equal "C:" (substr (xstrcase a) 1 2))
         (Is-function (eval (read a)))
    )
  )
  ;;2 判断表 Lst 是否是点对表
  (defun consp (lst)
    (not (vl-list-length lst))
  )
  ;;3 是否函数
  (defun Is-function (b /)
    (or        (and (= 'LIST (type b))               
             (not (consp b))               
             (> (length b) 1)
             (or (= 'LIST (type (car b)))
                 (not (car b))
             )
        )
        (= 'SUBR (type b))               
        (= 'USUBR (type b))               
        (= 'EXRXSUBR (type b))               
    )
  )
  ;;4 结果显示
  (defun My-princ (a / c)
    (if        (setq c (type (eval (read a))))
      (setq c (vl-symbol-name c))
      (setq c "nil")
    )
    (setq c (strcat "(" c ")"))
    (if        (= "C:" (substr a 1 2))
      (setq a (substr a 3))
    )
    (while (< (strlen a) 40)
      (setq a (strcat a " "))
    )
    (while (< (strlen c) 20)
      (setq c (strcat c " "))
    )
    (strcat a c)
  )

  ;;5 本程序主程序
  (initget "Commands Functions Variables")
  (setq        getkw (getkword
                "\n 选项[Commands/Functions/Variables]<Variables>: "
              )
  )
  (setq lst (acad_strlsort (atoms-family 1)))
  (setq Temp_File (vl-filename-mktemp nil nil ".txt"))
  (setq file (open Temp_File "w"))
  (cond
    ((= getkw "Commands")
     (repeat (setq n (length lst))
       (setq a (xstrcase (nth (setq n (1- n)) lst)))
       (if (Is-command a)
         (write-line (My-princ a) FILE)
       )
     )
    )
    ((= getkw "Functions")
     (repeat (setq n (length lst))
       (setq a (xstrcase (nth (setq n (1- n)) lst)))
       (if (and        (setq b (eval (read a)))
                (Is-function b)
           )
         (write-line (My-princ a) FILE)
       )
     )
    )
    (T
     (repeat (setq n (length lst))
       (setq a (xstrcase (nth (setq n (1- n)) lst)))
       (setq b (eval (read a)))
       (if (and
             (not (Is-function b))
             (not (Is-command a))
           )
         (write-line (My-princ a) FILE)
       )
     )
    )
  )
  (close FILE)
  (startapp "notepad" Temp_File)
  (princ)
)
;;查看系统中的"命令/函数/变量"------------------------自贡黄明儒 2013.1.22

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

评分

参与人数 3明经币 +3 收起 理由
Kye + 1 赞一个!
zzyong00 + 1 很给力!
xyp1964 + 1 赞一个!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下

本帖被以下淘专辑推荐:

发表于 2018-6-1 20:51 | 显示全部楼层
这个好 每天折腾  好多变量冲突了
发表于 2023-1-4 16:42 | 显示全部楼层
很实用的程序,感谢黄大师分享
发表于 2020-3-20 22:44 | 显示全部楼层

还有这么好的工具。下下来看看
发表于 2013-1-22 16:12 | 显示全部楼层
解决了一大问题,3Q
发表于 2013-1-22 17:49 | 显示全部楼层
看看,
发表于 2013-1-22 17:51 | 显示全部楼层
不错,修改为查看单个程序更实用些
发表于 2013-1-22 18:02 | 显示全部楼层
关注一下下
发表于 2013-1-22 21:39 | 显示全部楼层
学习学习。
发表于 2013-1-22 21:41 | 显示全部楼层
响应楼主,那就看看吧
发表于 2013-1-23 00:44 | 显示全部楼层
是什么东东
发表于 2013-1-23 04:53 | 显示全部楼层
学习一下,谢谢分享
发表于 2013-1-23 08:12 | 显示全部楼层
好贴,好想法!支持黄大侠
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 15:52 , Processed in 0.213330 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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