马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
修改图元特性的函数,野路子,写的不规范,欢迎大家提意见,让它更丰满,更规范,在这里先谢谢大家。
 - ;;;修改图元组码
- ;;;ss选折集、图元名、vla对象均可
- ;;;num需修改的组码表
- ;;;ch组码修改值表
- ;;;num与ch的个数必须相等
- (defun ch_dxf_ss (ss num ch / ssl en ent new_num old_num x y)
- (cond
- ((eq (type ss) 'PICKSET)
- (setq ssl (X_SS->List ss nil))
- )
- ((eq (type ss) 'ENAME)
- (setq ssl (list ss))
- )
- ((eq (type ss) 'VLA-OBJECT)
- (setq ssl (list (vlax-vla-object->ename ss)))
- )
- )
- (cond
- ((eq (type num) 'INT)
- (setq num (list num))
- )
- )
- (cond
- ((null (eq (type ch) 'LIST))
- (setq ch (list ch))
- )
- )
- (if (/= (length num) (length ch))
- (princ "组码表与修改表数目不等")
- (foreach en ssl
- (mapcar
- '(lambda (x y)
- (setq ent (entget en)
- new_num (cons x y)
- old_num (assoc x ent)
- )
- (if old_num
- (entmod (subst
- new_num
- old_num
- ent
- )
- )
- (entmod (reverse (cons new_num (reverse ent))))
- )
- )
- num
- ch
- )
- )
- )
- ss
- )
|