乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 16|回复: 8

[编程交流] table help-visual lisp- beginn

[复制链接]

5

主题

22

帖子

17

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 07:50:24 | 显示全部楼层 |阅读模式
Hi Guys,
I work on a lisp that will extract radius from circles in a drawing and insert these values in a table (and a number for each circle...). I want to use data taken from some cells, i don't know how. Any help? Some example? Some links? Some tutorials for table in visual lisp? Thanks!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:01:16 | 显示全部楼层
Since operations involving Table values in most cases involve specification of a row and column, the VLA Table Object is predominantly manipulated using Visual LISP methods rather than properties (which only use a single parameter).
 
To find the properties and methods associated with a Table Object, use the vlax-dump-object function:
 
  1. (defun c:dump ( / en )   (if (setq en (car (entsel)))       (vlax-dump-object (vlax-ename->vla-object en) t)   )   (princ))(vl-load-com) (princ)
You can then find information about each of these methods in the Visual LISP IDE Help Documentation; the documentation is written for VBA, but the parameter data types and their order translate directly to Visual LISP in most cases.
 
To retrieve data from Table Cells, look specifically into the GetText / GetValue / GetCellValue methods.
回复

使用道具 举报

5

主题

22

帖子

17

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 08:08:24 | 显示全部楼层
Best answer possible. Thanks, Lee
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:13:07 | 显示全部楼层
You're welcome, ask if you need further assistance
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 08:26:16 | 显示全部楼层
What you mean by this .... ?
 
回复

使用道具 举报

5

主题

22

帖子

17

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 08:33:53 | 显示全部楼层
A order number - in table and in circle's center.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 08:40:48 | 显示全部楼层
Things like this .... ?
 
  1. (defun c:Test (/ hgt spc d dia e ents inc increment Layers              insertionPoint tbl lengths lst r selectionset integer              selectionsetname             ) (vl-load-com);;; Tharwat 21 . June . 2012 ;;; (if (not acdoc)   (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq spc (if (> (vla-get-activespace acdoc) 0)             (vla-get-modelspace acdoc)             (vla-get-paperspace acdoc)           ) ) (setq   hgt (if         (zerop           (cdr             (assoc               40               (setq                 e (entget (tblobjname "STYLE" (getvar 'textstyle)))               )             )           )         )          (cdr (assoc 42 e))          (cdr (assoc 40 e))       ) ) (setq increment 1) (if (setq selectionset (ssget (list '(0 . "CIRCLE"))))   (progn     (repeat (setq integer (sslength selectionset))       (setq selectionsetname              (ssname selectionset                      (setq integer (1- integer))              )       )       (setq dia              (cons                (cons (* (cdr (assoc 40 (entget selectionsetname))) 2.)                      (itoa increment)                )                dia              )       )       (setq ents (cons selectionsetname ents))       (setq increment (1+ increment))     )   ) ) (if (and dia          (setq insertionPoint (getpoint "\n Specify Table Location :"))     )   (progn     (setq tbl (vla-addtable                 spc                 (vlax-3d-point insertionPoint)                 (+ (length dia) 2)                 2                 (* hgt 2.5)                 (* hgt 2.5)               )     )     (setq inc -1           r   1     )     (repeat 2       (vla-setcolumnwidth tbl 0 (* hgt 10.))       (vla-setcolumnwidth tbl 1 (* hgt 10.))       (vla-setrowheight tbl (setq inc (1+ inc)) (* hgt 1.5))     )     (vla-settext tbl 0 0 "Circle's Diameters")     (vla-settext tbl 1 0 "Reference No.")     (vla-settext tbl 1 1 "Diameter Value")     (foreach x (reverse dia)       (vla-settext tbl (setq r (1+ r)) 0 (cdr x))       (vla-setcellalignment tbl r 0 acMiddleCenter)       (vla-settext tbl r 1 (rtos (car x) 2))       (vla-setcellalignment tbl r 1 acMiddleCenter)     )     (setq increment 1)     (foreach p (reverse ents)       (setq d (* (cdr (assoc 40 (entget p))) 2.))       (entmakex (list '(0 . "TEXT")                       (assoc 10 (entget p))                       (cons 11 (cdr (assoc 10 (entget p))))                       (cons 40                             (if (> increment 9)                               (/ d 1.5)                               (if (> hgt d)                                 d                                 hgt                               )                             )                       )                       (cons 1 (itoa increment))                       '(72 . 1)                       '(73 . 2)                 )       )       (setq increment (1+ increment))     )   ) ) (princ "\n Written by Tharwat Al Shoufi") (princ))
回复

使用道具 举报

5

主题

22

帖子

17

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 08:45:26 | 显示全部楼层
Thanks, Tharwat.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 08:57:10 | 显示全部楼层
 
You're welcome brams
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-9 21:39 , Processed in 0.423294 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表