乐筑天下

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

[编程交流] Area & Volume of closed polyli

[复制链接]

5

主题

12

帖子

7

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 10:11:02 | 显示全部楼层 |阅读模式
hi to all, i have a question... what lisp routine for computing the volume of closed polyline? example, i will get the area of a close polyline then by entering the thickness of depth, it will show a volume.. and put it on the table... any help is appreciated,... tnx
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:33:31 | 显示全部楼层
In future please name your threads in a more appropriate manner so that they may found by the search utility.
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-6 10:35:55 | 显示全部楼层
Thread renamed.
 
You can Extrude your closed Polyline and then use the MASSPROP command to calculate volume.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:53:29 | 显示全部楼层
Not sure if its what you want as I don't completely understand your request, but it was fun to write:
 
  1. (defun c:V2Cell ( / tables ent dep pt doc ) (vl-load-com) ;; Lee Mac  ~  17.05.10 (while   (progn     (cond       (         (not           (or tables             (setq tables               (ss->vla                 (ssget "_X" '((0 . "ACAD_TABLE")))               )             )           )         )         (princ "\n** No Tables in Drawing **") nil       )       (         (not           (or ent             (setq ent               (CurveifFoo                 (lambda ( x )                   (vlax-property-available-p                     (vlax-ename->vla-object x) 'Area                   )                 )                 "\nSelect Object to Retrieve Volume: "               )             )           )         )        nil       )       (         (not           (or dep             (setq dep               (getdist "\nSpecify Depth: ")             )           )         )        nil       )       (         (not           (and             (setq pt               (getpoint "\nPick Cell for Volume: ")             )             (TextinCell tables pt               (strcat "%% * "                 (vl-princ-to-string dep) " \\f "%lu6%qf1">%"               )             )           )         )        (princ "\n** Cell Not Found **")       )     )   ) ) (princ))   (defun TextinCell ( tables pt str / data ) ;; Lee Mac  ~  17.05.10 (if   (setq data     (vl-some       (function         (lambda ( table )           (if             (eq :vlax-true               (vla-hittest table (vlax-3D-point (trans pt 1 0))                 (vlax-3D-point (trans (getvar 'VIEWDIR) 1 0)) 'row 'col               )             )             (list table row col)           )         )       )       tables     )   )   (not     (apply (function vla-setText)       (append data (list str))     )   ) ))(defun ss->vla ( ss ) (if ss   (     (lambda ( i / e l )       (while (setq e (ssname ss (setq i (1+ i))))         (setq l           (cons             (vlax-ename->vla-object e) l           )         )       )       l     )     -1   ) ))(defun CurveifFoo ( foo str / sel ent ) ;; Lee Mac  ~  17.05.10 (while   (progn     (setq sel (entsel str))          (cond       (         (vl-consp sel)         (if (not (foo (setq ent (car sel))))           (princ "\n** Invalid Object Selected **")         )       )     )   ) ) ent)(defun GetObjectID ( obj doc ) ;; Lee Mac  ~  17.05.10 (if   (eq "X64"     (strcase       (getenv "PROCESSOR_ARCHITECTURE")     )   )   (vlax-invoke-method     (vla-get-Utility doc) 'GetObjectIdString obj :vlax-false   )   (itoa (vla-get-Objectid obj)) ))
回复

使用道具 举报

8

主题

50

帖子

42

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 10:59:53 | 显示全部楼层
hi..Lee,
 
Command: v2cell
** No Tables in Drawing **
Command:

 
what does it mean..
 
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:21:57 | 显示全部楼层
The function is designed to place the result of the calculation into a table cell - as per the OP's request.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 21:18 , Processed in 0.374084 second(s), 64 queries .

© 2020-2025 乐筑天下

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