找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 667|回复: 0

[分享]:给大家写好个“给INSERT实体追加(不包含属性的)或者修改已有的属性定义的工

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-8-31 21:02:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×

  1. [FONT=courier new]
  2. ;|
  3.    命令:blk_addAttrib
  4.    功能:给INSERT实体追加或者修改已有的属性定义
  5. |;
  6. (defun c:blk_addAttrib (/ $do_default fitPnt basePt insPt e Tag Mat iMat
  7.                           blkNa tf tf1
  8.                        )
  9.   (defun $do_default ()
  10.     (setq fitPnt nil)
  11.     (if (not $blk_addAttrib_hmode)
  12.       (setq $blk_addAttrib_hmode "Left")
  13.       (if (or
  14.             (= "Fit" $blk_addAttrib_hmode)
  15.             (= "Align" $blk_addAttrib_hmode)
  16.           )
  17.         (setq $blk_addAttrib_hmode "Left")
  18.       )
  19.     )
  20.     (if (not $blk_addAttrib_vmode)
  21.       (setq $blk_addAttrib_vmode "Base")
  22.     )
  23.     (if (not $blk_addAttrib_textstyle)
  24.       (setq $blk_addAttrib_textstyle "Standard")
  25.     )
  26.     (if (not $blk_addAttrib_angle)
  27.       (setq $blk_addAttrib_angle "0")
  28.     )
  29.     (if (not $blk_addAttrib_height)
  30.       (setq $blk_addAttrib_height 500.0)
  31.     )
  32.   )
  33.   (if (and
  34.         (setq e (car (xdrx_entsel "\n请点取需要添加属性的INSERT实体<退出>:"
  35.                                   '((0 . "insert"))
  36.                      )
  37.                 )
  38.         )
  39.         (/= "" (setq Tag (getstring "\n属性标签字符串<退出>:")))
  40.         (setq basePt (getpoint "\n基点<退出>:"))
  41.       )
  42.     (progn
  43.       ($do_default)
  44.       (setq insPt (xdrx_getentdxf 10)
  45.             Mat (xdrx_matrix_block2wcs e)
  46.             iMat (xdrx_matrix_inverse Mat)
  47.             blkNa (xdrx_getentdxf 2)
  48.       )
  49.       (setq tf t)
  50.       (while tf
  51.         (prompt (strcat "\r{文字样式(" $blk_addAttrib_textstyle
  52.                         ")/水平对齐(" $blk_addAttrib_hmode ")/垂直对齐("
  53.                         $blk_addAttrib_vmode ")/字高(" (rtos $blk_addAttrib_height
  54.                                                              2 2
  55.                                                        ) ")/角度("
  56.                         $blk_addAttrib_angle ")}"
  57.                 )
  58.         )
  59.         (initget "S H V G A")
  60.         (setq tf (getkword "\n修改参数:[样式-S /水平-H /垂直-V /字高-G /角度-A]<下一步>:"))
  61.         (cond
  62.           ((= tf "S"))
  63.           ((= tf "H")
  64.             (initget "Left Right Mid Cen Fit Align")
  65.             (if (setq tf1 (getkword (strcat "\n水平对齐方式:[左-Left /右-Right /中间-Mid /中心-Cen /调整-Fit /对齐-Align]<"
  66.                                             $blk_addAttrib_hmode ">:"
  67.                                     )
  68.                           )
  69.                 )
  70.               (progn
  71.                 (setq $blk_addAttrib_hmode tf1)
  72.               )
  73.             )
  74.             (if (or
  75.                   (= $blk_addAttrib_hmode "Align")
  76.                   (= $blk_addAttrib_hmode "Fit")
  77.                 )
  78.               (progn
  79.                 (initget 1)
  80.                 (setq fitPnt (getpoint basePt "\n请拾取对齐点:"))
  81.                 (grdraw basePt fitPnt -2 1)
  82.                 (setq fitPnt (xdrx_point_transForm fitPnt iMat))
  83.               )
  84.             )
  85.           )
  86.           ((= tf "V")
  87.             (initget "Base Bottom Mid Top")
  88.             (if (setq tf1 (getkword (strcat "\n水平对齐方式:[基线-Left /底-Bottom /中间-Mid /顶-Top]<"
  89.                                             $blk_addAttrib_vmode ">:"
  90.                                     )
  91.                           )
  92.                 )
  93.               (setq $blk_addAttrib_vmode tf1)
  94.             )
  95.           )
  96.           ((= tf "G")
  97.             (initget 4)
  98.             (if (setq tf1 (getdist basePt (strcat "\n文字高度<"
  99.                                                   (rtos $blk_addAttrib_height
  100.                                                         2 2
  101.                                                   ) ">:"
  102.                                           )
  103.                           )
  104.                 )
  105.               (setq $blk_addAttrib_height tf1)
  106.             )
  107.           )
  108.           ((= tf "A")
  109.             (initget 4)
  110.             (if (setq tf1 (getangle basePt (strcat "\n文字角度<"
  111.                                                    $blk_addAttrib_angle ">:"
  112.                                            )
  113.                           )
  114.                 )
  115.               (setq $blk_addAttrib_angle (angtos tf1))
  116.             )
  117.           )
  118.         )
  119.       )
  120.       (setq basePt (xdrx_point_transForm basePt iMat))
  121.       (xdrx_blkdef_addAttribDef blkNa Tag basePt "" ""
  122.                                 $blk_addAttrib_textstyle
  123.                                 $blk_addAttrib_height (angtof $blk_addAttrib_angle)
  124.                                 $blk_addAttrib_hmode (if fitPnt
  125.                                                        fitPnt
  126.                                                        $blk_addAttrib_vmode
  127.                                                      )
  128.       )
  129.     )
  130.   )
  131.   (princ)
  132. )
  133. [/FONT]
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-3-29 22:21 , Processed in 0.344292 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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