明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1283|回复: 1

[求助]d

[复制链接]
发表于 2006-1-17 11:08 | 显示全部楼层 |阅读模式

一个程序的时候就行!放在一块就不中了!

 帮忙指点!

(defun zd (/ )
     ; 字型不是STANDARD形式的,改为该形式,字宽比不等于0.9的更换为0.9
  (setq textall1 (ssget "X" '((0 . "text")))
 textlen1 (sslength textall1)
 k1  0
  )
  (repeat textlen1
    (setq textnow1    (ssname textall1 k1)
   textdetail1 (entget textnow1)
    )
    (setq textdetail1
    (subst (cons 7 "STANDARD")
    (assoc 7 textdetail1)
    textdetail1
    )
    )
    (setq textdetail1
    (subst (cons 41 0.9)
    (assoc 41 textdetail1)
    textdetail1
    )
    )
    (entmod textdetail1)
    (entupd textnow1)
    (setq k1 (1+ k1))
  )
     ; 字高小于2.0的更换为2.0
  (setq textall2 (ssget "X" '((0 . "text") (-4 . "<") (40 . 2.0)))
 textlen2 (sslength textall2)
 k2  0
  )
  (repeat textlen2
    (setq textnow2    (ssname textall2 k2)
   textdetail2 (entget textnow2)
    )
    (setq textdetail2
    (subst (cons 40 2.0)
    (assoc 40 textdetail2)
    textdetail2
    )
    )
    (entmod textdetail2)
    (entupd textnow2)
    (setq k2 (1+ k2))
  )
     ; 多义线宽大于0.25的调整为0.5
  (setq
    textall3 (ssget "X" '((0 . "lwPOLYLINE") (-4 . ">") (43 . 0.25)))
  )
  (setq textlen3 (sslength textall)
 k3  0
  )
  (repeat textlen3
    (setq textnow3    (ssname textall3 k3)
   textdetail3 (entget textnow3)
    )
    (setq textdetail3
    (subst (cons 43 0.5)
    (assoc 43 textdetail3)
    textdetail3
    )
    )     ;
    (entmod textdetail3)  ;
    (entupd textnow3)
    (setq k3 (1+ k3))
  )
)

发表于 2006-1-17 11:27 | 显示全部楼层

1.设置全局变量

2.在(setq textlen2 (sslength textall2))前要加上判断,(if textall2 (progn ...)),未必每个选择集都会有值的,当没有值的时候就出错了

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

本版积分规则

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

GMT+8, 2024-5-3 12:21 , Processed in 0.218985 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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