找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 708|回复: 7

[求助] 如何实现图块缩放到表格框中

[复制链接]
发表于 2018-8-21 12:24:17 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 op90o 于 2018-8-29 11:41 编辑

请教各位先进
小弟我有一个源码,可以计算块生成表格,但是块大小不一定,所以会跑出去表格框外
不知是否可以实现图块缩放到表格框中
谢谢先进们
2018.08.21_3.png

Bbom.LSP

11.07 KB, 下载次数: 15, 下载积分: D豆 -1 , 活跃度 1

TEST.rar

32.65 KB, 下载次数: 9, 下载积分: D豆 -1 , 活跃度 1

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 145个

财富等级: 日进斗金

发表于 2018-8-21 17:40:35 | 显示全部楼层
自己画线的表格,
那就需要找到CELL的中心,然后你缩放、移动块,基点是块的中心,移动到CELL的中心,比例是CELL的短边和块的矩形框的短边的比值,构造个变换矩阵就可以了

不过,如果能把线表格转成TABLE实体,还是转成TABLE实体更好,也可以随时的导出到EXCEL
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 1 反对 0

使用道具 举报

已领礼包: 40个

财富等级: 招财进宝

发表于 2018-8-21 14:00:52 | 显示全部楼层
你说的是ACAD的表格实体?
去看下现成的插件的源代码,应该有启示

增强的填充面积统计报表插件
208 个回复 - 3497 次查看
强大的填充面积统计工具,可以根据模式,图层,颜色分类统计并生成图例及统计结果。 **** 本内容需购买可见 ****
2016-10-31 20:46 - Lispboy - 每日插件

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-8-21 16:25:27 | 显示全部楼层
newer 发表于 2018-8-21 14:00
你说的是ACAD的表格实体?
去看下现成的插件的源代码,应该有启示

不是ACAD的表格实体
而是自己画线的表格
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 604个

财富等级: 财运亨通

发表于 2018-8-21 17:01:35 | 显示全部楼层
下面的程序一看就是高手写的,写得相当规范,在论坛上广泛流传,本论坛也应该有,那时还没有autocad2005。有了05,用table程序就精干很多很多了。
  1. ;;==============================块统计

  2. ;;;----------------------------------------------------------------------------------------------
  3. ;;;检查输入的原始参数表是否使用了组件的别名,如果使用了,便把别名改成组件全名。无论是否已使用组件的别名,都返回可供后续程序使用的参数表。
  4. (defun listFormatInputList (listInput             /                     listComponentAlias    listFormatedInput     listMemberOfInput
  5.                             boolIsAlias           intDefinedAliasNumber k                     strInputComponentName strAlias
  6.                            )
  7. ;;;----------------------------------------------------------------------------------------------
  8. ;;;定义组件别名表,形式为  ( (  组件别名 组件原名) )
  9. (setq listComponentAlias '(("bt" "button")
  10.                             ("edit" "edit_box")
  11.                             ("edit12" "edit12_box")
  12.                             ("edit32" "edit32_box")
  13.                             ("listbox" "list_box")
  14.                             ("ComboBox" "popup_list")
  15.                             ("btRadio" "radio_button")
  16.                             ("tg" "toggle")
  17.                             ("btOK" "ok_only")
  18.                             ("btCancel" "cancel_button")
  19.                             ("btErrer" "errtile")
  20.                             ("btHelp" "help_button")
  21.                             ("btInfo" "info_button")
  22.                             ("btOC" "ok_cancel")
  23.                             ("btOCH" "ok_cancel_help")
  24.                             ("btOCHE" "ok_cancel_help_errtile")
  25.                             ("btOCHI" "ok_cancel_help_info")
  26.                             ("color17" "color_palette_1_7")
  27.                             ("color19" "color_palette_1_9")
  28.                             ("color09" "color_palette_0_9")
  29.                             ("color250255" "color_palette_250_255")
  30.                             ("stdColor" "std_rq_color")
  31.                            )
  32. )
  33. ;;;----------------------------------------------------------------------------------------------
  34. (setq listFormatedInput nil)
  35. (foreach listMemberOfInput listInput
  36.   (setq k 0
  37.         boolIsAlias "No"
  38.   )
  39.   (setq strInputComponentName (strcase (car listMemberOfInput) T))
  40.   (setq intDefinedAliasNumber (length listComponentAlias))
  41.   (while (and (< k intDefinedAliasNumber) (= boolIsAlias "No"))
  42.    (setq strAlias (strcase (car (nth k listComponentAlias)) T))
  43.    (if (= strInputComponentName strAlias)
  44.     (progn (setq boolIsAlias "Yes")
  45.            (setq listFormatedInput (append listFormatedInput
  46.                                            (list (cons (cadr (nth k listComponentAlias))
  47.                                                        (cdr listMemberOfInput)
  48.                                                  )
  49.                                            )
  50.                                    )
  51.            )
  52.     )
  53.    )
  54.    (setq k (1+ k))
  55.   )
  56.   (if (= boolIsAlias "No")
  57.    (setq listFormatedInput (append listFormatedInput
  58.                                    (list (cons (strcase (car listMemberOfInput) T)
  59.                                                (cdr listMemberOfInput)
  60.                                          )
  61.                                    )
  62.                            )
  63.    )
  64.   )
  65. )
  66. listFormatedInput
  67. )
  68. ;;;----------------------------------------------------------------------------------------------
  69. ;;;把输入的参数表转换为字符串表
  70. (defun listInputToString (listInput  /  listMemberOfInput   listCdrMemberOfInput
  71.    listMemberOfComponentParameters   listComponentParameters  listCadrMemberOfComponentParameters
  72.    listResult   k j   boolDefinementFound strTmp  test1   test2  )
  73. ;;;----------------------------------------------------------------------------------------------
  74. ;;;组件定义参数表,形式为 ( ( 组件名列表) ( 对应参数名列表) )
  75. ;;; 无属性控件,生成dcl文件时,在组件名后添加" ; “即可;如为“end”,在dcl文件里加上"}"字符即可
  76. ;;; 容器控件及带属性控件,需要在名前添加” : ",名后加 "{"
  77. (setq listComponentParameters '((("容器控件" "dialog")
  78.                                   ("label"               "key"                 "value"               "initial_focus"
  79.                                    "height"              "width"               "children_alignment"  "children_fixed_height"
  80.                                    "children_fixed_width"
  81.                                   )
  82.                                  )
  83.                                  (("容器控件"          "boxed_column"      "boxed_row"         "boxed_radio_column"
  84.                                    "boxed_radio_row"   "column"            "row"               "radio_row"         "radio_column"
  85.                                    "concatenation"     "paragraph"
  86.                                   )
  87.                                   ("label"               "key"                 "is_enabled"          "alignment"
  88.                                    "height"              "width"               "fixed_height"        "fixed_width"
  89.                                    "children_alignment"  "children_fixed_height"                     "children_fixed_width"
  90.                                   )
  91.                                  )
  92.                                  (("带属性控件" "button")
  93.                                   ("label"         "key"           "action"        "alignment"     "height"        "width" "horizontal_margin"
  94.                                    "vertical_margin" "fixed_height"  "fixed_width"   "is_cancel"     "is_default"    "is_enabled"    "is_tab_stop"
  95.                                    "mnemonic"
  96.                                   )
  97.                                  )
  98.                                  (("带属性控件" "edit_box" "edit12_box" "edit32_box" "fcf_ebox" "fcf_ebox1")
  99.                                   ("label"          "key"            "value"          "action"         "alignment"      "height"
  100.                                    "width"          "fixed_height"   "fixed_width"    "allow_accept"   "edit_limit"     "edit_width"
  101.                                    "is_enabled"     "is_tab_stop"    "mnemonic"       "password_char"
  102.                                   )
  103.                                  )
  104.                                  (("带属性控件" "image" "image_block" "icon_image")
  105.                                   ("key"           "value"         "action"        "alignment"     "height"        "width"
  106.                                    "fixed_height"  "fixed_width"   "is_enabled"    "is_tab_stop"   "mnemonic"      "aspect_ratio"
  107.                                    "color"
  108.                                   )
  109.                                  )
  110.                                  (("带属性控件" "image_button" "swatch" "fcf_ibut" "fcf_ibut1")
  111.                                   ("key"            "action"         "alignment"      "height"         "width"          "fixed_height"
  112.                                    "fixed_width"    "is_enabled"     "is_tab_stop"    "mnemonic"       "allow_accept"   "aspect_ratio"
  113.                                    "color"
  114.                                   )
  115.                                  )
  116.                                  (("带属性控件" "list_box")
  117.                                   ("label"          "key"            "value"          "action"         "alignment"      "height"
  118.                                    "width"          "fixed_height"   "fixed_width"    "allow_accept"   "fixed_width_font"
  119.                                    "is_enabled"     "is_tab_stop"    "list"           "mnemonic"       "multiple_select"
  120.                                    "tabs"           "tab_truncate"
  121.                                   )
  122.                                  )
  123.                                  (("带属性控件" "popup_list")
  124.                                   ("label"         "key"           "value"         "action"        "alignment"     "height"
  125.                                    "width"         "fixed_height"  "fixed_width"   "edit_width"    "fixed_width_font"
  126.                                    "is_enabled"    "is_tab_stop"   "list"          "mnemonic"      "tabs"          "tab_truncate"
  127.                                   )
  128.                                  )
  129.                                  (("带属性控件" "radio_button")
  130.                                   ("label"         "key"           "value"         "action"        "is_enabled"    "is_tab_stop"
  131.                                    "mnemonic"      "alignment"     "height"        "width"         "fixed_height"  "fixed_width"
  132.                                   )
  133.                                  )
  134.                                  (("带属性控件" "slider")
  135.                                   ("label"         "key"           "value"         "action"        "alignment"     "height"
  136.                                    "width"         "fixed_height"  "fixed_width"   "big_increment" "layout"        "max_value"
  137.                                    "min_value"     "mnemonic"      "small_increment"
  138.                                   )
  139.                                  )
  140.                                  (("带属性控件" "spacer")
  141.                                   ("value" "height" "width" "fixed_height" "fixed_width")
  142.                                  )
  143.                                  (("带属性控件" "text" "text_part" "text_25")
  144.                                   ("label" "key" "value" "alignment" "height" "width" "fixed_height" "fixed_width" "is_bold")
  145.                                  )
  146.                                  (("带属性控件" "toggle")
  147.                                   ("label" "key" "value" "action" "alignment" "height" "width" "fixed_height" "fixed_width" "is_enabled"
  148.                                    "is_tab_stop")
  149.                                  )
  150.                                  (("无属性控件"           "cancel_button"        "errtile"              "help_button"
  151.                                    "info_button"          "ok_cancel"            "ok_cancel_help"       "ok_cancel_help_errtile"
  152.                                    "ok_cancel_help_info"  "ok_only"              "spacer"               "spacer_0"
  153.                                    "spacer_1"             "color_palette_1_7"    "color_palette_1_9"    "color_palette_0_9"
  154.                                    "color_palette_250_255"                       "std_rq_color"
  155.                                   )
  156.                                  )
  157.                                  (("无属性控件" "end")) ;以"end"作为单个组件定义的结束,生成dcl文件时,以“}“代替
  158.                                 )
  159. )
  160. ;;;----------------------------------------------------------------------------------------------        
  161. (setq listResult nil)
  162. (setvar "dimzin" 8)
  163. (foreach listMemberOfInput listInput
  164.   (setq k 0
  165.         boolDefinementFound "NotYet"
  166.   )
  167.   (while (and (= boolDefinementFound "NotYet")
  168.               (< k (length listComponentParameters))
  169.          ) ;未找到组件参数名列表且未搜索完组件预定义列表时循环
  170.    (setq listMemberOfComponentParameters (nth k listComponentParameters))
  171.    (if (and (member (car listMemberOfInput)
  172.                     (car listMemberOfComponentParameters)
  173.             )
  174.             (if (= "spacer" (car listMemberOfInput))
  175.              (>= (length listMemberOfInput)
  176.                  (length listMemberOfComponentParameters)
  177.              )
  178.              T
  179.             ) ;因spacer既可为无属性控件也可为带属性控件,故特别处理
  180.        )
  181.     (progn (setq boolDefinementFound  "Found"
  182.                  listCdrMemberOfInput (cdr listMemberOfInput)
  183.            )
  184.            (cond ((or (= "容器控件" (car (car listMemberOfComponentParameters)))
  185.                       (= "带属性控件" (car (car listMemberOfComponentParameters)))
  186.                   )
  187.                   listCdrMemberOfInput ;组件参数值有数据时
  188.                   (setq listResult (append listResult
  189.                                            (list (strcat ":" (car listMemberOfInput) "{\n"))
  190.                                    )
  191.                   )
  192.                   (setq j                                   0
  193.                         listCadrMemberOfComponentParameters (cadr listMemberOfComponentParameters)
  194.                   )
  195.                   (while (< j (length listCdrMemberOfInput))
  196.                    (if (not (= "" (nth j listCdrMemberOfInput)))
  197.                     (progn ;参数值非空时
  198.                      (if (numberp (nth j listCdrMemberOfInput))
  199.                       (setq strTMP (strcat (nth j listCadrMemberOfComponentParameters)
  200.                                            "="
  201.                                            (rtos (nth j listCdrMemberOfInput) 2 3)
  202.                                            ";\n"
  203.                                    )
  204.                       ) ;参数为数值时
  205.                       (setq strTMP (strcat (nth j listCadrMemberOfComponentParameters)
  206.                                            "=\""
  207.                                            (nth j listCdrMemberOfInput)
  208.                                            "\";\n"
  209.                                    )
  210.                       ) ;参数非数值时
  211.                      )
  212.                      (setq listResult (append listResult (list strTMP)))
  213.                     )
  214.                    )
  215.                    (setq j (1+ j))
  216.                   )
  217.                   (if (= "带属性控件" (car (car listMemberOfComponentParameters)))
  218.                    (setq listResult (append listResult (list "}\n")))
  219.                   ) ;带属性控件时,在字符串末尾加上组件结束标志 "}"
  220.                  )
  221.                  ((= (car listMemberOfInput) "end")
  222.                   (setq listResult (append listResult (list "}\n")))
  223.                  )
  224.                  (T ;(= "无属性控件" (car (car listMemberOfComponentParameters))) ,默认为无属性控件
  225.                   (setq listResult (append listResult
  226.                                            (list (strcat (car listMemberOfInput) ";\n"))
  227.                                    )
  228.                   )
  229.                  )
  230.            )
  231.     )
  232.     (setq k (1+ k))
  233.    )
  234.   )
  235. )
  236. listResult
  237. )
  238. ;;;----------------------------------------------------------------------------------------------
  239. ;;;生成并显示输入对话框
  240. ;;;调用形式 ( listGenerateDCL  DCL文件名(无路径及后缀)
  241. ;;;                 表( ( ( "组件名或别名")  ( 参数值表 )  )   ...)
  242. ;;;                 表( (  "组件编号"  "组件初始值"  )   ...)    ;组件显示值初始化
  243. ;;;                 表( (  "组件编号"  "动作代码"  )   ...)      ;需设置动作的组件及对应的动作
  244. ;;;                 表("组件编号"  ...)   )    ;用户点“确定”键时,需获取输入值的组件名
  245. ;;;注意,调用参数均为字符串形式
  246. ;;;返回值为表,形式为 ( 关闭对话框的整数代码       指定组件返回值列表)
  247. (defun listGenerateDCL (strDCLFileName      listInputDefinements                    listKeysAndValues   listKeysAndActions
  248.                         listKeysToGetValue  /                   listFormatedInput   intDialogCloseType  listKeysValue
  249.                         listResult          fStream             strFileFullName     objectFile          fileStream
  250.                         templist            i                   dclid
  251.                        )
  252. ;;;----------------------------------------------------------------------------------------------
  253. ;;;按 ( ( “组件名”  显示"  ) ) 表,设置各组件的值
  254. (defun SetDCLValues (listKeysAndValues / listEachKeyAndValue)
  255.   (foreach listEachKeyAndValue listKeysAndValues
  256.    (set_tile (car listEachKeyAndValue)
  257.              (cadr listEachKeyAndValue)
  258.    )
  259.   )
  260. )
  261. ;;;----------------------------------------------------------------------------------------------
  262. ;;;按 ( ( “组件名”  “动作"  ) ) 表,把组件与动作关联
  263. (defun SetDCLActions (listKeysAndActions / listEachKeyAndAction)
  264.   (foreach listEachKeyAndAction listKeysAndActions
  265.    (action_tile (car listEachKeyAndAction)
  266.                 (cadr listEachKeyAndAction)
  267.    )
  268.   )
  269. )
  270. ;;;----------------------------------------------------------------------------------------------
  271. ;;;按 ( “组件名” ) 表,查询各组件值并返回值表
  272. (defun listGetDCLValues (listKeys / listEachKey listValues)
  273.   (setq listValues nil)
  274.   (foreach listEachKey listKeys
  275.    (setq listValues (append listValues (list (get_tile listEachKey))))
  276.   )
  277.   listValues
  278. )
  279. ;;;----------------------------------------------------------------------------------------------                 
  280. (setq strFileFullName (vl-filename-mktemp (strcat strDCLFileName ".dcl")))
  281. (setq objectFile (open strFileFullName "w"))
  282. (setq listFormatedInput (listFormatInputList listInputDefinements))
  283. (setq fileStream (append (list strDCLFileName)
  284.                           (listInputToString listFormatedInput)
  285.                   )
  286. )
  287. (foreach fStream fileStream (princ fStream objectFile))
  288. (close objectFile)
  289. ;;以上生成dcl文件,以下调用DCL,设置组件值、关联动作,获取返回值
  290. (setq listResult nil)
  291. (setq dclid (load_dialog strFileFullName))
  292. (if (not (new_dialog strDCLFileName dclid ""))
  293.   (progn (alert "对话框加载失败!") (exit))
  294. )
  295. (if listKeysAndValues
  296.   (SetDCLValues listKeysAndValues)
  297. )
  298. (if listKeysAndActions
  299.   (SetDCLActions listKeysAndActions)
  300. )
  301. (if listKeysToGetValue
  302.   (action_tile "accept"  "(setq listKeysValue (listGetDCLValues listKeysToGetValue)) (done_dialog 1)" )
  303. )
  304. (setq intDialogCloseType (start_dialog))
  305. (unload_dialog dclid)
  306. (vl-file-delete strFileFullName)
  307. (setq listResult (append (list intDialogCloseType) listKeysValue))
  308. listResult
  309. )
  310. ;;;----------------------------------------------------------------------------------------------
  311. ;;;----------------------------------------------------------------------------------------------
  312. ;;;----------------------------------------------------------------------------------------------
  313. ;;;----------------------------------------------------------------------------------------------
  314. ;;;----------------------------------------------------------------------------------------------
  315. ;;;;funlib.lsp
  316. ;;; -------------------------------------------------------------------------
  317. ;;;计算以当前设置书写的文本占用长度
  318. ;;;调用参数形式 (  字符串 )
  319. (defun strLength (str / sLength x1 x2 lst)
  320. (setq lst (textbox (list (cons 1 str))))
  321. (setq x1 (car (nth 0 lst))
  322.        x2 (car (nth 1 lst))
  323. )
  324. (setq sLength (abs (- x2 x1)))
  325. sLength
  326. )
  327. ;;; -------------------------------------------------------------------------
  328. ;;;以当前设置初始化文本高、宽
  329. (defun initText (/ pt str eTextN)
  330. (setq pt (list 0 0))
  331. (setq str "初始化")
  332. (command "text" pt #ZiGao# 0 str)
  333. (setq eTextN (entlast))
  334. (entdel eTextN)
  335. )
  336. ;;; -------------------------------------------------------------------------
  337. ;;; 返回polyline的点表
  338. ;;;调用参数形式 (  多义线图元名 )
  339. (defun getplpts (pl / mark pts ver1 i ee pt)
  340. (if (= "POLYLINE" (cdr (assoc 0 (entget pl))))
  341.   (progn  ; read points of ployline
  342.    (setq mark "VERTEX"
  343.          i    0
  344.          ver1 (entnext pl)
  345.    )
  346.    (while (= "VERTEX" mark)
  347.     (setq pts (append pts (list (cdr (assoc 10 (entget ver1))))))
  348.     (setq ver1 (entnext ver1)
  349.           i    (1+ i)
  350.     )
  351.     (setq mark (cdr (assoc 0 (entget ver1))))
  352.    )
  353.   )
  354.   (progn  ; read points of lwployline
  355.    (setq ee (entget pl))
  356.    (foreach pt ee
  357.     (if (= 10 (car pt))
  358.      (setq
  359.       pts (append
  360.            pts
  361.            (list (append (cdr pt) (list (cdr (assoc 38 ee)))))
  362.           )
  363.      )
  364.     )
  365.    )
  366.   )
  367. )
  368. pts
  369. )



  370. ;;;-------------------------------------------------------------
  371. ;;;在001图层、当前空间画直线
  372. ;;;调用形式 (  AddLineone 起点坐标  终点坐标 ),如果成功,返回定义数据的图元表,否则返回 nil。
  373. (defun AddLineone (listStartPoint listEndPoint)
  374. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  375. (if (null (tblsearch "LAYER" "001")) ; 如果还没有001图层
  376.     (command "._layer" "m" "001" "c" "240" "" "lt" "continuous" "" "LW"
  377.          "0.13" "" ""
  378.     )
  379.     (setvar "clayer" "001")           ; 否则直接转换到001图层
  380.   )
  381. (entmake (list '(0 . "LINE")
  382.                 (cons 10 listStartPoint)
  383.                 (cons 11 listEndPoint)
  384.           )
  385. )
  386.    (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  387.     (command pause)
  388.   )
  389.   (SETVAR "CLAYER" CLAY)
  390. )

  391. ;;;------------------------------------------------------------------------
  392. ;;;在当前图层、当前空间、按文本居中方式,写单行文本
  393. ;;;调用形式 (  AddText_AlignmentMiddle  插入点坐标 显示 文本旋转角度(rad)  文本内容  宽高比例 字体样式名),如果成功,返回定义数据的图元表,否则返回 nil。
  394. (defun AddText_AlignmentMiddle  (listInsertPoint floatTextHigh floatRotateAngle strText floatScaleFactor  strStyleName)
  395. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  396. (if (null (tblsearch "LAYER" "003")) ; 如果还没有003图层
  397.     (command "._layer" "m" "003" "c" "100" "" "lt" "continuous" "" "LW"
  398.          "0.13" "" ""
  399.     )
  400.     (setvar "clayer" "003")           ; 否则直接转换到003图层
  401.   )
  402. (entmake (list '(0 . "TEXT")
  403.                 '(10 0 0 0)
  404.                 (cons 11 listInsertPoint)
  405.                 (cons 40 floatTextHigh)
  406.                 (cons 1 strText)
  407.                 (cons 50 floatRotateAngle)
  408.                 (cons 41 floatScaleFactor)
  409.                 (cons 7 strStyleName)
  410.                 '(72 . 1)
  411.                 '(100 . "AcDbText")
  412.           )
  413. )
  414.     (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  415.     (command pause)
  416.   )
  417.   (SETVAR "CLAYER" CLAY)
  418. )

  419. ;;;------------------------------------------------------------------------
  420. (defun AddText_AlignmentMiddleone  (listInsertPointone floatTextHighone floatRotateAngleone strTextone floatScaleFactorone  strStyleNameone)
  421. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  422. (if (null (tblsearch "LAYER" "0")) ; 如果还没有0图层
  423.     (command "._layer" "m" "0" "c" "255" "" "lt" "continuous" "" "LW"
  424.          "0.13" "" ""
  425.     )
  426.     (setvar "clayer" "0")           ; 否则直接转换到0图层
  427.   )
  428.    (entmake (list '(0 . "TEXT")
  429.                 '(10 0 0 0)
  430.                 (cons 11 listInsertPointone)
  431.                 (cons 40 floatTextHighone)
  432.                 (cons 1 strTextone)
  433.                 (cons 50 floatRotateAngleone)
  434.                 (cons 41 floatScaleFactorone)
  435.                 (cons 7 strStyleNameone)
  436.                 '(72 . 1)
  437.                 '(100 . "AcDbText")
  438.           )
  439. )
  440.     (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  441.     (command pause)
  442.   )
  443.   (SETVAR "CLAYER" CLAY)
  444. )

  445. ;;;------------------------------------------------------------------------
  446. (defun AddText_AlignmentMiddletwo  (listInsertPointtwo floatTextHightwo floatRotateAngletwo strTexttwo floatScaleFactortwo  strStyleNametwo)
  447. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  448. (if (null (tblsearch "LAYER" "004")) ; 如果还没有004图层
  449.     (command "._layer" "m" "004" "c" "210" "" "lt" "continuous" "" "LW"
  450.          "0.13" "" ""
  451.     )
  452.     (setvar "clayer" "004")           ; 否则直接转换到004图层
  453.   )
  454.    (entmake (list '(0 . "TEXT")
  455.                 '(10 0 0 0)
  456.                 (cons 11 listInsertPointtwo)
  457.                 (cons 40 floatTextHightwo)
  458.                 (cons 1 strTexttwo)
  459.                 (cons 50 floatRotateAngletwo)
  460.                 (cons 41 floatScaleFactortwo)
  461.                 (cons 7 strStyleNametwo)
  462.                 '(72 . 1)
  463.                 '(100 . "AcDbText")
  464.           )
  465. )
  466.     (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  467.     (command pause)
  468.   )
  469.   (SETVAR "CLAYER" CLAY)
  470. )
  471.   ;;;------------------------------------------------------------------------
  472. (defun AddText_AlignmentMiddlethree  (listInsertPointthree floatTextHighthree floatRotateAnglethree strTextthree floatScaleFactorthree  strStyleNamethree)
  473. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  474. (if (null (tblsearch "LAYER" "005")) ; 如果还没有005图层
  475.     (command "._layer" "m" "005" "c" "41" "" "lt" "continuous" "" "LW"
  476.          "0.13" "" ""
  477.     )
  478.     (setvar "clayer" "005")           ; 否则直接转换到005图层
  479.   )
  480.    (entmake (list '(0 . "TEXT")
  481.                 '(10 0 0 0)
  482.                 (cons 11 listInsertPointthree)
  483.                 (cons 40 floatTextHighthree)
  484.                 (cons 1 strTextthree)
  485.                 (cons 50 floatRotateAnglethree)
  486.                 (cons 41 floatScaleFactorthree)
  487.                 (cons 7 strStyleNamethree)
  488.                 '(72 . 1)
  489.                 '(100 . "AcDbText")
  490.           )
  491. )
  492.     (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  493.     (command pause)
  494.   )
  495.   (SETVAR "CLAYER" CLAY)
  496. )
  497. ;;输出表头
  498. ;;;------------------------------------------------------------------------
  499. ;;;在当前图层、当前空间、按文本左对齐方式,写单行文本
  500. ;;;调用形式 (  AddText_AlignmentLeft  插入点坐标 显示 文本旋转角度(rad)  文本内容  宽高比例 字体样式名),如果成功,返回定义数据的图元表,否则返回 nil。
  501. (defun AddText_AlignmentLeft  (listInsertPoint floatTextHigh floatRotateAngle strText floatScaleFactor  strStyleName)
  502. (entmake (list '(0 . "TEXT")
  503.                 (cons 10 listInsertPoint)
  504.                 (cons 40 floatTextHigh)
  505.                 (cons 1 strText)
  506.                 (cons 50 floatRotateAngle)
  507.                 (cons 41 floatScaleFactor)
  508.                 (cons 7 strStyleName)
  509.                 '(100 . "AcDbText")
  510.           )
  511. )
  512. )

  513. ;;;------------------------------------------------------------------------
  514. ;;;在当前图层、当前空间插入块
  515. ;;;调用形式 ( InsertBlock  显示  插入点  旋转角度 )
  516. ;;;成功时,返回dxf组码,否则返回nil
  517. (defun InsertBlock ( strBlockName listInsertPoint floatRotateAngle )
  518. (entmake (list '(0 . "INSERT")
  519. '(100 . "AcDbEntity")
  520. '(100 . "AcDbBlockReference")
  521. (cons 2 strBlockName)
  522. (cons 10 listInsertPoint)
  523. (cons 50 floatRotateAngle)))
  524. )
  525. ;;;-------------------------------------------------------------
  526. ;;;标记undo编组开始点
  527. (defun BeginUndoGroup()
  528. (command "undo" "be")
  529. )
  530. ;;; -------------------------------------------------------------------------
  531. ;;;标记undo编组结束点
  532. (defun EndUndoGroup()
  533. (command "undo" "e")
  534. )
  535. ;;; -------------------------------------------------------------------------
  536. ;;; -------------------------------------------------------------------------
  537. ;;; -------------------------------------------------------------------------
  538. ;;; -------------------------------------------------------------------------
  539. ;;; -------------------------------------------------------------------------
  540. ;;块统计.LSP


  541. ;;;--------------------------------------------------------------------------------
  542. ;;;从块选择集中选择指定块名的对象,并返回结果选择集
  543. (defun intCountSingleBlock (ssOriginal strTargetBlockName /
  544.                   strEntityName listEntityDXF strBlockName intSingleBlockCount k)
  545. (setq intSingleBlockCount 0
  546.        k -1 )
  547. (repeat (sslength ssOriginal) ; 循环与所选择的对象数量相等的次数
  548.   (setq strEntityName (ssname ssOriginal (setq k (1+ k)))) ; strEntityName,取得第k个对象名
  549.   (setq listEntityDXF (entget strEntityName))
  550.   (setq strBlockName (cdr (assoc 2 listEntityDXF)))
  551.   (if (= strBlockName strTargetBlockName)
  552.    (setq intSingleBlockCount (1+ intSingleBlockCount))
  553.   )
  554. )
  555. intSingleBlockCount
  556. )
  557. ;;;--------------------------------------------------------------------------------
  558. ;;;从块选择集中删除指定块名的对象,并返回结果选择集
  559. (defun ssDelEntitysFromBlockSelectionSet (ssOriginal strTargetBlockName
  560.                        / strEntityName listEntityDXF strBlockName ssResult k)
  561. (setq ssResult (ssadd)
  562.        k -1 )
  563. (repeat (sslength ssOriginal) ; 循环与所选择的对象数量相等的次数
  564.   (setq strEntityName (ssname ssOriginal (setq k (1+ k)))) ; strEntityName,取得第k个对象名
  565.   (setq listEntityDXF (entget strEntityName))
  566.   (setq strBlockName (cdr (assoc 2 listEntityDXF)))
  567.   (if (/= strBlockName strTargetBlockName)
  568.    (setq ssResult (ssadd strEntityName ssResult))
  569.   )
  570. )
  571. ssResult
  572. )
  573. ;;;--------------------------------------------------------------------------------
  574. ;;;插入块缩略图
  575. (defun PrintBlockMiniature (floatBasicPointX                  floatBasicPointY                  strBlockName
  576.                             /                                 floatMaxBlockWidth                floatMaxBlockHigh
  577.                             floatBlockOriginalWidth           floatBlockOriginalHigh            floatBlockWidthScale
  578.                             floatBlockHighScale               floatBlockBoundingBoxTargetMinPointX
  579.                             floatBlockBoundingBoxTargetMinPointY   floatBlockBoundingBoxTargetMaxPointX
  580.                             floatBlockBoundingBoxTargetMaxPointY   listTargetBlockCenterPoint
  581.                             listBlockBoundingBoxMinPoint      listBlockBoundingBoxMaxPoint      objectBlockEntity
  582.                             strEntityName                     listInsertPoint                   floatBlockScale
  583.                             listBlockEntityDXF                listBlockCenterPoint
  584.                            )
  585. ;; floatBasicPointX floatBasicPointY 缩略图所在表格单元左下角点坐标
  586. ;;计算图块缩略图在图中允许放置范围的左下及右上角点坐标的X、Y数值
  587. (setq floatMaxBlockWidth 21
  588.        floatMaxBlockHigh 8
  589. )
  590. (setq floatBlockBoundingBoxTargetMinPointX (+ floatBasicPointX 2)
  591.        floatBlockBoundingBoxTargetMinPointY (+ floatBasicPointY 1)
  592.        floatBlockBoundingBoxTargetMaxPointX (+ floatBasicPointX floatMaxBlockWidth 2)
  593.        floatBlockBoundingBoxTargetMaxPointY (+ floatBasicPointY floatMaxBlockHigh 1)
  594. )
  595. (setq listTargetBlockCenterPoint (list (/ (+ floatBlockBoundingBoxTargetMinPointX  floatBlockBoundingBoxTargetMaxPointX ) 2)
  596.                                         (/ (+ floatBlockBoundingBoxTargetMinPointY floatBlockBoundingBoxTargetMaxPointY )  2 )
  597.                                         0
  598.                                   )
  599. )
  600. (setq listInsertPoint (list floatBlockBoundingBoxTargetMinPointX  floatBlockBoundingBoxTargetMinPointY  ) )
  601. (InsertBlock strBlockName listInsertPoint 0)
  602. ;;以块缩略图允许放置范围的左下角点为块缩略图的基点插入图块
  603. (setq strEntityName (entlast))
  604. (setq objectBlockEntity (vlax-ename->vla-object strEntityName))
  605. (if  (vl-catch-all-error-p (vl-catch-all-apply 'vla-GetBoundingBox
  606.                                                 (list objectBlockEntity  'listBlockBoundingBoxMinPoint 'listBlockBoundingBoxMaxPoint ))
  607.          ) ;判断块是否存在边框,若块含无限长直线等时,则不存在边框
  608.     (AddText_AlignmentMiddle listBlockCenterPoint 3 0 "本块无缩略图" 0.8 "standard")
  609.    
  610.     (progn
  611. (setq listBlockBoundingBoxMinPoint (vlax-safearray->list listBlockBoundingBoxMinPoint) )
  612. (setq listBlockBoundingBoxMaxPoint (vlax-safearray->list listBlockBoundingBoxMaxPoint) )
  613.   
  614. (if (> (car listBlockBoundingBoxMaxPoint)  (car listBlockBoundingBoxMinPoint) )
  615.       (setq floatBlockWidthScale (/ floatMaxBlockWidth
  616.                                      (- (car listBlockBoundingBoxMaxPoint) (car listBlockBoundingBoxMinPoint) )
  617.                                      )
  618.          )
  619.        (setq  floatBlockWidthScale 0)
  620.      )

  621. (if (> (cadr listBlockBoundingBoxMaxPoint) (cadr listBlockBoundingBoxMinPoint)  )
  622.     (setq   floatBlockHighScale  (/ floatMaxBlockHigh
  623.                                     (- (cadr listBlockBoundingBoxMaxPoint) (cadr listBlockBoundingBoxMinPoint) )
  624.                                   )
  625.       )
  626.      (setq   floatBlockHighScale 0)
  627.     )
  628. ;计算块缩略图允许放置范围的边框长宽与块外框长宽的比值
  629.   
  630. (cond
  631.   ((= (+ floatBlockWidthScale floatBlockHighScale) 0)  (setq floatBlockScale 1)) ;块为单点时,缩放比例取为1
  632.   ((=  floatBlockWidthScale 0)  (setq floatBlockScale floatBlockHighScale) ) ;块为竖直短线时
  633.   ((=  floatBlockHighScale 0)  (setq floatBlockScale floatBlockWidthScale) ) ;块为水平短线时
  634.   ((> floatBlockWidthScale floatBlockHighScale )  (setq floatBlockScale floatBlockHighScale) ) ;数值较小者为块的控制缩放比例
  635.   (T  (setq floatBlockScale floatBlockWidthScale) )  
  636.   )
  637. (setq listBlockEntityDXF (entget strEntityName))
  638. (entmod (subst (cons 41 floatBlockScale) (assoc 41 listBlockEntityDXF) listBlockEntityDXF ) )
  639. (entupd strEntityName)
  640. (setq listBlockEntityDXF (entget strEntityName))
  641. (entmod (subst (cons 42 floatBlockScale) (assoc 42 listBlockEntityDXF) listBlockEntityDXF ) )
  642. (entupd strEntityName)
  643. (setq listBlockEntityDXF (entget strEntityName))
  644. (entmod (subst (cons 43 floatBlockScale) (assoc 43 listBlockEntityDXF) listBlockEntityDXF ) )
  645. (entupd strEntityName)
  646. ;;缩放块
  647. (vla-GetBoundingBox objectBlockEntity 'listBlockBoundingBoxMinPoint 'listBlockBoundingBoxMaxPoint)
  648. (setq listBlockBoundingBoxMinPoint (vlax-safearray->list listBlockBoundingBoxMinPoint) )
  649. (setq listBlockBoundingBoxMaxPoint (vlax-safearray->list listBlockBoundingBoxMaxPoint) )
  650. (setq listBlockCenterPoint (list (* 0.5 (+ (car listBlockBoundingBoxMaxPoint) (car listBlockBoundingBoxMinPoint) ) )
  651.                                   (* 0.5 (+ (cadr listBlockBoundingBoxMaxPoint) (cadr listBlockBoundingBoxMinPoint) ) )
  652.                                   0
  653.                             )
  654. )
  655. (vla-move objectBlockEntity (vlax-3d-point listBlockCenterPoint) (vlax-3d-point listTargetBlockCenterPoint))
  656. )
  657. )
  658. )
  659. ;;;--------------------------------------------------------------------------------
  660. ;;;显示统计结果表
  661. (defun PrintCountResultList (listResult  /  i  ListLength strBlockName
  662.   intNumberOfSSSingleBlockName   strNumberOfSSSingleBlockName  pt pt1 pt2  pt3 pt4 pt5 pt6 pt7  x  y  x1  y1 y2
  663.   x2  x3  floatTextHigh floatTextHighone  blocknumber blocknumbersum)
  664. (setq pt (getpoint "\n点取要标注块统计结果信息的位置:"))
  665. (setq x (car pt)
  666.        y (cadr pt)
  667.        i 1
  668.        floatTextHigh 4
  669.             floatTextHighone 7
  670.                  floatTextHightwo 4.5
  671. )
  672. (setq ListLength (length listResult))
  673. (setq y1 (- y (* (1+ (+ 1 ListLength)) 10))) ;行高取10
  674. (while (<= i 2)
  675.   (setq x1 (+ x (* i 25))) ;列宽取25
  676.   (setq pt1 (list x1 y 0)
  677.         pt2 (list x1 y1 0)
  678.   )
  679.   (AddLineone pt1 pt2)
  680.   (setq i (1+ i))
  681. )
  682. ;;;画竖向表格线
  683. (setq i 1)
  684. (setq x1 (+ x (* 3 25)))
  685. (while (<= i (1+ ListLength))
  686.   (setq y1 (- y (* i 10)))
  687.   (setq pt1 (list x y1 0)
  688.         pt2 (list x1 y1 0)
  689.   )
  690.   (AddLineone pt1 pt2)
  691.   (setq i (1+ i))
  692. )
  693. ;;;画横向表格线
  694. ;;;------------------------------------------------------------------------
  695. (setq clay (getvar "clayer"))    ; 原始图层状态赋值给oldlay
  696. (if (null (tblsearch "LAYER" "002")) ; 如果还没有002图层
  697.     (command "._layer" "m" "002" "c" "41" "" "lt" "continuous" "" "LW"
  698.          "0.5" "" ""
  699.     )
  700.     (setvar "clayer" "002")           ; 否则直接转换到002图层
  701.   )
  702. (setq x1 (+ x (* 3 25))
  703.      y1 (- y (* 10 (+ 2 ListLength))))
  704.   (setq pt1 (list x y 0)
  705.        pt2 (list x1 y1 0)
  706.                  pt3 (list x y1 0)
  707.                  pt4 (list x1 y 0)
  708.   )
  709.    (command "pline" pt1 pt4 pt2 pt3 "c")
  710.   (princ)
  711.       (while (/= 0 (getvar "cmdactive"))   ; 没有它回不到原来图层
  712.     (command pause)
  713.   )
  714.   (SETVAR "CLAYER" CLAY)
  715. ;;;画外围矩形
  716. ;;;------------------------------------------------------------------------
  717. (setq x1 (+ x (* 0.5 25))
  718.        x2 (+ x (* 1.5 25))
  719.        x3 (+ x (* 2.5 25))
  720.        y1 (- y 7)
  721.            y2 (+ y 5)
  722. )
  723. (setq pt1 (list x1 y1 0)
  724.        pt2 (list x2 y1 0)
  725.        pt3 (list x3 y1 0)
  726.            pt8 (list x2 y2 0)
  727. )
  728. (AddText_AlignmentMiddlethree pt1 floatTextHigh 0 "块缩略图" 0.8 "standard")
  729. (AddText_AlignmentMiddlethree pt2 floatTextHigh 0 "块名称" 0.8 "standard")
  730. (AddText_AlignmentMiddlethree pt3 floatTextHigh 0 "块数量" 0.8 "standard")
  731. (AddText_AlignmentMiddlethree pt8 floatTextHighone 0 "图块数量统计" 0.8 "standard")
  732. ;;输出表头
  733. ;;;------------------------------------------------------------------------

  734. (setq i 0
  735.        floatTextHigh 3
  736.               blocknumber 0    )
  737. (while (< i ListLength)
  738.   (setq y1 (+ y (* -10 (+ i 2))))
  739.   (setq ;pt1 (list x1 y1 0)
  740.         pt2 (list x2 (+ y1 3) 0)
  741.         pt3 (list x3 (+ y1 3) 0)
  742.   )
  743.   (setq strBlockName (car (nth i listResult))
  744.         intNumberOfSSSingleBlockName (cadr (nth i listResult))
  745.   )
  746.   (setq blocknumber (+ blocknumber intNumberOfSSSingleBlockName))
  747.   (setq strNumberOfSSSingleBlockName (itoa intNumberOfSSSingleBlockName))
  748.   (AddText_AlignmentMiddle pt2 floatTextHigh 0 strBlockName 0.8 "standard")
  749.   (AddText_AlignmentMiddle pt3 floatTextHigh 0 strNumberOfSSSingleBlockName 1.0 "standard")
  750.   
  751.   (if (vl-catch-all-error-p (vl-catch-all-apply 'PrintBlockMiniature (list x y1 strBlockName)))
  752.      (AddText_AlignmentLeft (list (+ x 1) (+ y1 2)) 3 0 "生成块缩略图时出错" 0.8 "standard")
  753.    )
  754.   (setq i (1+ i))
  755. )
  756. ;;;显示表内容
  757. (setq i 0
  758.       blocknumbersum 0 )
  759. (while (< i ListLength)
  760.        (setq blocknumbersum (+ blocknumbersum intNumberOfSSSingleBlockName))
  761.             (setq i (1+ i))
  762.                 )
  763. (setq intNumberOfSSSingleBlockName (itoa blocknumbersum))               
  764. (setq strNumberOfSSSingleBlockName (itoa blocknumber))         
  765. (setq   y1 (- (- y (* 10 (+ 1 ListLength))) 7 )
  766. )
  767. (setq pt5 (list x1 y1 0)
  768.        pt6 (list x2 y1 0)
  769.        pt7 (list x3 y1 0)
  770. )
  771. (AddText_AlignmentMiddletwo pt5 floatTextHightwo 0 intNumberOfSSSingleBlockName  0.8 "standard")
  772. (AddText_AlignmentMiddle pt5 floatTextHightwo 0 "共      种"  0.8 "standard")
  773. (AddText_AlignmentMiddlethree pt6 floatTextHightwo 0 "汇  总" 0.8 "standard")
  774. (AddText_AlignmentMiddletwo pt7 floatTextHightwo 0 strNumberOfSSSingleBlockName 0.8 "standard")
  775. (AddText_AlignmentMiddle pt7 floatTextHightwo 0 "共       个"  0.8 "standard")
  776. ;;输出表尾
  777. ;;;------------------------------------------------------------------------
  778. )
  779. ;;;--------------------------------------------------------------------------------
  780. (defun GetBlocksSelectionRange (/ strDCLFileName listInputDefinements listKeysAndValues listKeysAndActions listKeysToGetValue
  781.                      listDCLReturn intButtonClick strSelectRange)
  782. (setq strSelectRange  "UserSelection" )
  783. (setq strDCLFileName "BlocksSelectionRange")
  784. (setq listInputDefinements '(("dialog" "指定统计范围" "")
  785.                                ("spacer")
  786.                                 ("radio_column" "进行块统计的范围:")
  787.                                  ("btRadio" "手工选择" "brUserSelection")
  788.                                  ("btRadio" "整个图形" "brDrawingFile")
  789.                                 ("end")
  790.                                 ("text" "注:不统计含无限长直线的块!")
  791.                               ("spacer")
  792.                               ("btOK")
  793.                               ("end")
  794.                              )
  795. )
  796. (setq listKeysAndValues '(("brUserSelection" "1")))
  797. (setq listKeysAndActions '(("brUserSelection" "(setq strSelectRange \"UserSelection\")")
  798.                             ("brDrawingFile" "(setq strSelectRange \"DrawingFile\")")) )
  799. (setq listKeysToGetValue nil)
  800. (setq listDCLReturn (listGenerateDCL strDCLFileName listInputDefinements listKeysAndValues listKeysAndActions listKeysToGetValue) )
  801. (setq intButtonClick (car listDCLReturn )  )
  802. strSelectRange
  803. )
  804. ;;;--------------------------------------------------------------------------------
  805. ;;;块数量统计
  806. (defun tktj (/ ssObjects  strEntityName  listEntityDXF  strBlockName
  807.   listResult  intSingleBlockCount  listMinPoint listInsertPoint  floatBlockRotateAngle
  808.                                              ;;listResult 用于记录统计结果,形式为((  显示  块数量  同名块中一个实体的对象名 )...)
  809.                      )
  810. ; (initget "D S _DrawingFile UserSelection")
  811. ; (setq strSelectRange (getkword "\n统计块的范围[显示(D)/显示(S)]<S>:"))
  812. (setq strSelectRange (GetBlocksSelectionRange))
  813. (if (= strSelectRange "DrawingFile")
  814.   (setq ssObjects  (ssget "X" '((0 . "insert")(100 . "AcDbBlockReference")))) ; 创建选择集 ssObjects
  815.   (progn
  816.    (princ "\n请选择需要统计的块:\n")
  817.    (setq ssObjects (ssget '((0 . "INSERT")(100 . "AcDbBlockReference")))) ; 创建选择集 ssObjects
  818.   )
  819. )
  820. (if ssObjects
  821.   (progn
  822.    (setq listResult nil)
  823.    (while (> (sslength ssObjects) 0)
  824.     (setq strEntityName (ssname ssObjects 0)) ; strEntityName,取得第1个对象名
  825.     (setq listEntityDXF (entget strEntityName))
  826.     (setq strBlockName (cdr (assoc 2 listEntityDXF)))
  827.     (setq intSingleBlockCount (intCountSingleBlock ssObjects strBlockName ) )
  828.     (setq ssObjects (ssDelEntitysFromBlockSelectionSet ssObjects strBlockName))
  829.     (setq listResult (append listResult
  830.                              (list (list strBlockName intSingleBlockCount))
  831.                      )
  832.     )
  833.    )
  834.    (setvar "dimzin" 8)
  835.    (setvar "osmode" 0)
  836.   (if  (tblsearch "style" "standard")
  837.     ;;判断是否存在"standard"字体,有则设为当前,无则创建。
  838.        (setvar "textstyle" "standard")
  839.        (command "_style" "standard" "sceie.shx,sceic.shx" 0 0.8 0 "N" "N" "N")
  840.    )
  841.    (PrintCountResultList listResult)
  842.    (setvar "osmode" 16383)
  843.   )
  844. )
  845. (princ)
  846. )

  847. (defun c:tjk()(tktj))
  848. ;;;--------------------------------------------------------------------------------
3.gif
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-8-22 09:08:47 | 显示全部楼层
XDSoft 发表于 2018-8-21 17:40
自己画线的表格,
那就需要找到CELL的中心,然后你缩放、移动块,基点是块的中心,移动到CELL的中心,比例 ...

明白了,多谢前辈指导
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-8-22 09:09:53 | 显示全部楼层
明白了,多谢前辈指导
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 6056个

财富等级: 富甲天下

发表于 2018-8-23 09:09:18 | 显示全部楼层
这个程序不错!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-30 22:26 , Processed in 0.307691 second(s), 48 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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