明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: xd-xdcad

[求助]文字表格居中

  [复制链接]
发表于 2008-5-21 09:00:00 | 显示全部楼层
我测试仍然没问题,你可以测试一下 (command "_.boundary" "")在 acad2002上运行的情况,我用2009
 楼主| 发表于 2008-5-21 11:30:00 | 显示全部楼层
本帖最后由 作者 于 2008-5-21 11:36:46 编辑

可惜我的2002版本总是出现问题,应该能更改吧?

本帖子中包含更多资源

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

x
 楼主| 发表于 2008-5-21 11:35:00 | 显示全部楼层
输入命令_.boundary,显示如图

本帖子中包含更多资源

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

x
发表于 2008-5-21 12:06:00 | 显示全部楼层
(defun c:JZ (/ err)
  (defun algion (msg    /      ss     lst    i      vlalst boxlst
                 x      cor1   cor2   findboxpt     newboxpt
                 en1    en     enlst  y      y2
                )
    (princ msg)
    (setq ss (ssget '((0 . "text"))))
    (if (not ss) (exit))
    (setq lst nil)
    (setq i 0)
    (repeat (sslength ss)
      (setq lst (cons (ssname ss i) lst))
      (setq i (1+ i))
    )
    (setq vlalst (mapcar 'vlax-ename->vla-object lst))
    (setq boxlst (mapcar '(lambda (x / cor1 cor2)
                            (vla-GetBoundingBox x 'cor1 'cor2)
                            (list (vlax-safearray->list cor1)
                                  (vlax-safearray->list cor2)
                            )
                          )
                         vlalst
                 )
    )
    (setq
      findboxpt (mapcar '(lambda (x)
                           (polar (car x)
                                  (angle (car x) (cadr x))
                                  (/ (DISTANCE (car x) (cadr x)) 2.0)
                           )
                         )
                        boxlst
                )
    )
    (setq newboxpt (mapcar '(lambda (x)
                              (setq en1 (entlast))
                              (vl-cmdf "_boundary" x "")
                              (setq en (entlast))
                              (if (not (equal en1 en))
                                (progn
                                  (setq enlst (entget en))
                                  (setq lst (vl-remove-if-not
                                              '(lambda (y) (= (car y) 10))
                                              enlst
                                            )
                                  )
                                  (setq cor1 (vl-remove 10 (car lst))
                                        cor2 (vl-remove 10 (nth 2 lst))
                                  )
                                  (while (setq en1 (entnext en1))
                                    (entdel en1)
                                  )
                                  (polar cor1
                                         (angle cor1 cor2)
                                         (/ (DISTANCE cor1 cor2) 2.0)
                                  )
                                )
                              )
                            )
                           findboxpt
                   )
    )
    (mapcar '(lambda (x y y2)
               (vla-move x (vlax-3d-point y) (vlax-3d-point y2))
             )
            vlalst
            findboxpt
            newboxpt
    )
  )
  (setq err (VL-CATCH-ALL-APPLY 'algion (list "\n师兄 选择单行文字: ")))
  (princ)
)
 楼主| 发表于 2008-5-21 13:36:00 | 显示全部楼层
非常抱歉,问题依旧
发表于 2008-5-21 14:03:00 | 显示全部楼层

将1楼的程序中(setq    newboxpt (mapcar '(lambda (x)

改成(setq    newboxpt (mapcar '(lambda (x / en1 en)

就可以了

发表于 2008-5-21 14:06:00 | 显示全部楼层
或者把(entdel en1)改成(vl-cmdf "erase" en1 "")应该都可以
 楼主| 发表于 2008-5-21 14:26:00 | 显示全部楼层
sailorcwx发表于2008-5-21 14:06:00或者把(entdel en1)改成(vl-cmdf \"erase\" en1 \"\")应该都可以

这个方法可行,问题解决了,但出现了另外一个问题,执行命令后,按CTRL+Z,在恢复到原先的状态的同时,还会出现一个边框,

发表于 2008-5-21 15:49:00 | 显示全部楼层

那你用一个command把你的程序包起来嘛

发表于 2008-5-21 19:14:00 | 显示全部楼层

我推荐的是这种改法

将1楼的程序中(setq    newboxpt (mapcar '(lambda (x)

改成(setq    newboxpt (mapcar '(lambda (x / en1 en)

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

本版积分规则

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

GMT+8, 2024-11-15 07:05 , Processed in 0.182374 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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