明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 981|回复: 1

[提问] 不知道为什么提示未知命令呢??

[复制链接]
发表于 2014-10-14 00:09:07 | 显示全部楼层 |阅读模式
  1. (defun c:xx()
  2.   (setq ss (ssget))
  3.   (setq i 0)
  4.   (repeat (sslength ss)
  5.     (setq aa (nth i ss))
  6.     (setq sc (strlen aa))
  7.     (if (= sc 8)
  8.       (setq q2 (substr aa 1 2))
  9.       (setq q3 (substr aa 5 3))
  10.       (setq new (strcat q2 "0" "x" q2 "0"))
  11.       (func1)
  12.       )
  13.     (if (= sc 7)
  14.       (setq q2 (substr aa 1 2))
  15.       (setq q3 (substr aa 5 2))
  16.       (setq new (strcat q2 "0" "x" q2 "0"))
  17.       (func1)
  18.       )
  19.     (setq i (1+ i))
  20.   )
  21. )

  22. (defun func1()
  23.   (setq ent_list (entget aa))
  24.   (setq ent_1_old (assoc 1 ent_list))
  25.   (setq ent_1_new (cons 1 new))
  26.   (SETQ ent_list (subst ent_1_new ent_1_old ent_list))
  27.   (entmod ent_list)
  28.   )
  29. ;;;先是把第三个数字弄为0,在把最后一个弄成(因为有500x1000和500x00两种情况,所以第

  30. 三个是确定的但是最后一个的是第几个不确定)
发表于 2014-10-14 08:17:41 | 显示全部楼层
错误太多
  1. (defun c:xx()
  2.   (setq ss (ssget '((1 . "*#x#*"))))
  3.   (setq i 0)
  4.   (repeat (sslength ss)
  5.     (setq ent (entget(ssname ss i)))
  6.     (setq aa (cdr(assoc ent)))
  7.     (setq sc (strlen aa))
  8.     (if (< 6 sc 9) (progn
  9.       (setq q2 (substr aa 1 2))
  10.       (setq q3 (substr aa 5 (- sc 5)))
  11.       (setq new (strcat q2 "0" "x" q3 "0"))
  12.       (entmod (subst (cons 1 new) (assoc 1 ent) ent))
  13.     ))
  14.     (setq i (1+ i))
  15.   )
  16.   (princ)
  17. )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-24 01:38 , Processed in 0.175656 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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