SLW210,
我刚用“on codes”更改了帖子。Sry。我还发现在jtbworld上的代码,没有以米为单位的区域代码,用这样的字段属性显示结果。
线程:
大家好!
我通常通过朋友的帐号进入论坛。但现在我真的需要你的帮助。
我发现了一个非常好的lisp,它可以获取多段线的面积,并使用字段属性插入多段线,字段属性的文本大小与注释预设中的文本大小相同。唯一的问题是,它将测量显示为平方英尺,但在Autocad 2011 x64上运行良好。
这是我找到的Lisp命令:
-
- ;;; AreaText.LSP ver 3.0
- ;;; Command name is AT
- ;;; Select a polyline and where to place the text
- ;;; Sample result: 2888.89 sq ft
- ;;; As this is a FIELD it is updated based on the FIELDEVAL
- ;;; or the settings found in the OPTIONS dialog box
- ;;; By Jimmy Bergmark
- ;;; Copyright (C) 2007-2010 JTB World, All Rights Reserved
- ;;; Website: [url="http://www.jtbworld.com"]www.jtbworld.com[/url]
- ;;; E-mail: [email="info@jtbworld.com"]info@jtbworld.com[/email]
- ;;; 2007-09-05 - First release
- ;;; 2009-08-02 - Updated to work in both modelspace and paperspace
- ;;; 2010-10-29 - Updated to work also on 64-bit AutoCAD
- ;;; Uses TEXTSIZE for the text height
- (defun Get-ObjectIDx64 (obj / util)
- (setq util (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))))
- (if (= (type obj) 'ENAME)(setq obj (vlax-ename->vla-object obj)))
- (if (= (type obj) 'VLA-OBJECT)
- (if (> (vl-string-search "x64" (getvar "platform")) 0)
- (vlax-invoke-method util "GetObjectIdString" obj :vlax-False)
- (rtos (vla-get-objectid obj) 2 0)
- )
- )
- )
- (defun c:AT (/ entObject entObjectID InsertionPoint ad)
- (vl-load-com)
- (setq entObject (vlax-ename->vla-object(car (entsel)))
- entObjectID (Get-ObjectIDx64 entObject)
- InsertionPoint (vlax-3D-Point (getpoint "Select point: "))
- ad (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- (vla-addMText (if (= 1 (vla-get-activespace ad))
- (vla-get-modelspace ad)
- (if (= (vla-get-mspace ad) :vlax-true)
- (vla-get-modelspace ad)
- (vla-get-paperspace ad)
- )
- )
- InsertionPoint 0.0 (strcat
- "####"
- ))
- )
如果有人能帮我更改这个lisp,使其仅以平方米(sufix为“m²”)显示度量值,我将不胜感激。
我在某处找到了这句话,我不知道它是否有用:
-
- ("%<[url="file://acobjprop/"]\\AcObjProp[/url] Object(%<[url="file://_objid/"]\\_ObjId[/url] "(rtos objID 2 0)">%).Area [url="file://f/"]\\f[/url] "%lu2%pr1%ps[Area , m sq]%ct8[1e-006]">%")
非常感谢你! |