乐筑天下

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

[编程交流] Help on Lee Mac's "Areas

[复制链接]

11

主题

36

帖子

25

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
55
发表于 2022-7-5 15:55:22 | 显示全部楼层 |阅读模式
I've been using this neat routine for couple of months now. How can I change the output into "feet".  I always divide the total with 144 to get the value in ft2. Thanks
 

[code];;------------------------------------------------------------;;;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;;;------------------------------------------------------------;;(defun c:A2A nil (c:Areas2Attribute))(defun c:Areas2Attribute ( / *error* _StartUndo _EndUndo doc att ss ) (vl-load-com) (defun *error* ( msg )   (if doc (_EndUndo doc))   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")       (princ (strcat "\n** Error: " msg " **")))   (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc)   (vla-StartUndoMark doc) ) (defun _EndUndo ( doc )   (if (= 8 (logand 8 (getvar 'UNDOCTL)))     (vla-EndUndoMark doc)   ) ) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (if   (and (ssget '((0 . "ARC,CIRCLE,ELLIPSE,HATCH,*POLYLINE,REGION,SPLINE")))     (setq att       (LM:Selectif         (lambda ( x ) (eq "ATTRIB" (cdr (assoc 0 (entget x))))) nentsel "\nSelect Attribute: "       )     )   )   (progn (_StartUndo doc)     (       (lambda ( ss fld )         (vlax-for obj ss           (setq fld             (strcat fld "%% + "             )           )         )                   (vla-put-TextString (vlax-ename->vla-object att)           (setq fld             (strcat               (substr fld 1                 (- (strlen fld) (if (< 1 (vla-get-Count ss)) 3 5))               )               " \\f \"%lu6%qf1\">%"             )           )         )         (vla-delete ss) (vla-regen doc acActiveViewport)       )       (setq ss (vla-get-ActiveSelectionSet doc))       (if (< 1 (vla-get-Count ss)) "%
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 16:04:14 | 显示全部楼层
Change:
 
  1. " \\f "%lu6%qf1">%"
To:
 
  1. " \\f "%lu6%qf1%ct8[0.006944444444444444]">%"
1/144 = 0.00694444444444 ...
回复

使用道具 举报

11

主题

36

帖子

25

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
55
发表于 2022-7-5 16:13:53 | 显示全部楼层
Thanks Lee, as always you very helpful.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 16:26:39 | 显示全部楼层
You're very welcome Shakuhachi. In my other field related program 'Areas2Field', I include a separate line at the top of the program to allow the user to easily modify the field formatting, I may now update the 'Areas2Attribute' program you have posted to match.
 
Cheers,
 
Lee
回复

使用道具 举报

0

主题

26

帖子

26

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 16:34:22 | 显示全部楼层
Dear Lee,
current version v1-2 does work fine on polylines, but does not work in the attribute TAG option: lisp does not allow me to select blocks with predefined by me attribute "POW", unless I have added "INSERT" to the first setq filter, like below:
  1. (ssget '((0 . "INSERT,ARC,CIRCLE,ELLIPSE,HATCH,*POLYLINE,REGION,SPLINE"))))
 
...then lisp permits to pick blocks, fine, but when it comes to insert sum into the other attributed block, the sum equals "####". When I look up resulting filed formatting it is a sum of Objects "Block Unit" and not the tag in out case "POW". Lisp picks wrong object property, please correct me where I went wrong.
 
Best regards mate!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 16:44:28 | 显示全部楼层
 
I think you have misunderstood how the program operates:
The 'tag' parameter allows you to specify a predefined attribute tag to house the output from the program - you should not modify the ssget filter which is used to obtain the input.
回复

使用道具 举报

0

主题

26

帖子

26

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 16:52:07 | 显示全部楼层
Hello Lee!
Thanks for quick replay! In beginning I thought, and sorry my bad, that lisp as an option served to withdraw numeric data from predefined attribute, and then insert the formula sum of that attribute values into the other block attribute picked form list of its attributes.
 
And you see, with the proposed addition of INSERT in ssget line, it almost does the job!  I believe it is sooooo close!
Could you please try to adjust your program to accept blocks, so in case of blocks it ads the predefined TAG, not the first appearing Object property "Block Units"?
 
That would be very very neat and useful program of yours, don't you agree? Pleeeeease
Cheers Lee!
回复

使用道具 举报

0

主题

26

帖子

26

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 17:00:46 | 显示全部楼层
May I ask you to explain, how to to change the subfunctions of yours, to adopt this program to the described functionality? To learn from you would be even better approach here, as we are at cadtutor  Years pass, and I have only basic understanding of lisp programming.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 20:56 , Processed in 0.896684 second(s), 79 queries .

© 2020-2025 乐筑天下

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