找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1045|回复: 3

[研讨] 获取 AcDbTable 合并单元格地址的方法

[复制链接]

已领礼包: 1268个

财富等级: 财源广进

发表于 2016-7-23 14:35:07 | 显示全部楼层 |阅读模式

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

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

×

查手册可能用到的方法

1 IsMergedCell

2 GetCellExtents

3 Hittest

4 selectsubregion
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2016-7-23 16:43:52 | 显示全部楼层
查的什么手册,能让我们看看不?

点评

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

使用道具 举报

已领礼包: 51个

财富等级: 招财进宝

发表于 2016-7-23 17:09:39 | 显示全部楼层
WhoCanSay 发表于 2016-7-23 16:43
查的什么手册,能让我们看看不?

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

使用道具 举报

已领礼包: 1268个

财富等级: 财源广进

 楼主| 发表于 2016-7-23 17:54:52 | 显示全部楼层
hittest 方法 Example

http://hyperpics.blogs.com/beyon ... sp-and-activex.html


(vl-load-com)

;; Example adds a table to model space that is 5 rows by 3 columns
;; with a row height of 10 units and column width of 30 units
(defun c:AddTable( / acadObj curDoc insPt mSpaceObj tableObj)
    (setq acadObj (vlax-get-acad-object))
    (setq curDoc (vla-get-ActiveDocument acadObj))

    (setq insPt (vlax-3d-point 0 0 0))

    (setq mSpaceObj (vla-get-ModelSpace curDoc))
    (setq tableObj (vla-Addtable mSpaceObj insPt 5 3 10 30))

    (vla-put-StyleName tableObj "MyTableStyle")
)

;; Example shows how to pick a single table cell on screen and change its value.
;; This example demonstrates the ActiveX properties/methods HitTest,
;; GetCellType, GetText and SetText.
(defun c:SelectTableCell ( / pick vHeight vWidth lwrLeft uprRight vector
                                           SS_TABLES cnt eMax tableObj row col cellValueOrg)
  
  ;; Ask the user for a point on screen
  (if (/= (setq pick (vlax-3d-point (getpoint "\nSelect Cell to edit: "))) nil)
    (progn

      ;; Get the corners of the screen display to build our selection set
      (setq vHeight (getvar "viewsize"))
      (setq vWidth (* (/ (nth 0 (getvar "screensize")) (nth 1 (getvar "screensize"))) vHeight))

      (setq lwrLeft (list (- (nth 0 (getvar "viewctr")) (/ vWidth 2)) (- (nth 1 (getvar "viewctr")) (/ vHeight  2)) 0))
      (setq uprRight (list (+ (nth 0 (getvar "viewctr")) (/ vWidth 2)) (+ (nth 1 (getvar "viewctr")) (/ vHeight  2)) 0))

      ;; Get the current display orientation
      (setq vector (vlax-make-safearray vlax-vbDouble '(0 . 2)))
      (vlax-safearray-fill vector '(1 1 1))
      (setq vector (vlax-make-variant vector))
      
      ;; Select all the table objects visible on screen
      (if (setq SS_TABLES (ssget "C" lwrleft uprright (list (cons 0 "ACAD_TABLE"))))
        (progn
   
          (setq cnt 0
                eMax (sslength SS_TABLES)
          )

          ;; Step through all the items in the selection set
          (while (> eMax cnt)
            ;; Geta table object from the selection set
            (setq tableObj (vlax-ename->vla-object (ssname SS_TABLES cnt)))
  
            ;; Return values for what cell was picked in
            (setq row 0
                  col 0)

            ;; Below is also a sample to see if a valid cell is picked
            ;; (vla-select table pick vector vector 5 5 :vlax-false 'row 'col)
     
            ;; Check to see if a valid cell was picked
            (if (= (vla-hittest tableObj pick vector 'row 'col) :vlax-true)
              (progn

                ;; Get out of the loop
                (setq cnt (1+ eMax))
  
                ;; Check to see what the Cell Type is (Text or Block)
                (if (= (vla-GetCellType tableObj row col) acTextCell)
                  (progn
                    ;; Let's get the value out
                    (setq cellValueOrg (vla-GetText tableObj row col))

                    ;; Change the current value
                    (vla-SetText tableObj row col "Revised Text")
                    (vla-Update tableObj)
                    (alert "Cell text was changed.")
         
                    ;; Restore the original value
                    (vla-SetText tableObj row col cellValueOrg)
                    (vla-Update tableObj)
                    (alert "Cell text was changed back to the original value.")
                    (setq cnt eMax)
                  )
                )
              )
            )
            (setq cnt (1+ cnt))
          )
        )
      )
    )
  )
(princ)
)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-21 17:49 , Processed in 0.623644 second(s), 37 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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