我有我们的工程师使用的lisp例程。我过去曾对其进行过调整,但现在我无法确定它失败的原因。如果有比我更熟练的人帮助我确定问题以及如何纠正,我将不胜感激。该例程应允许选择多段线,然后放置显示平方英尺的多行文字字段。在字段放置的选择点之后失败。它不会出错,但也不会显示文本。
- [font=Courier New](defun c:arl64 ()[/font]
- [font=Courier New](vl-load-com)[/font]
- [font=Courier New];;get a reference to model space[/font]
- [font=Courier New](setvar "textsize" 0.09375)[/font]
- [font=Courier New](setvar "luprec" 0)[/font]
- [font=Courier New](setq *model-space*[/font]
- [font=Courier New] (vla-get-ModelSpace[/font]
- [font=Courier New] (vla-get-ActiveDocument (vlax-get-acad-object))[/font]
- [font=Courier New] )[/font]
- [font=Courier New])[/font]
- [font=Courier New];;pass this function an entity and a point[/font]
- [font=Courier New](defun LinkedArea (ent pt / obj objID ip width str)[/font]
- [font=Courier New] ;;convert the entity to an object[/font]
- [font=Courier New] (setq ar2 (car (entsel "\nSelect Area Boundary: ")))[/font]
- [font=Courier New] (setq objID (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) "GetObjectIdString" (vlax-ename->vla-object ar2) :vlax-False))[/font]
- [font=Courier New] (setq ;;convert the point[/font]
- [font=Courier New] ip (vlax-3D-Point pt)[/font]
- [font=Courier New] ;;set the width for the MTEXT[/font]
- [font=Courier New] width 0.0[/font]
- [font=Courier New] )[/font]
- [font=Courier New] ;;set the string - this creates the field[/font]
- [font=Courier New] (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " objID ">%).Area \\f "%pr0%lu2%ct4%qf1 SQ. FT.">%"))[/font]
- [font=Courier New] [/font]
- [font=Courier New] ;;Create the MTEXT entity containing the field.[/font]
- [font=Courier New] (vla-addMText *model-space* ip width str)[/font]
- [font=Courier New])[/font]
- [font=Courier New];; Set A = the entity and set B = Point for text[/font]
- [font=Courier New](setq a (car (entsel)) b (getpoint "\n Select Text Insertion Point: "))[/font]
- [font=Courier New];;Call the function[/font]
- [font=Courier New](linkedarea a b)[/font]
- [font=Courier New](princ)[/font]
- [font=Courier New] )s [/font]
谢谢
肖恩 |