excelautolispautocad-scripts

Modify Lee Mac's Length and Area Field to automatically copy the outputted length to clipboad


I'm using Lee Mac's length and area field to automatically get the total length of an object.

I'm a complete beginner on AutoLisp so I cant find the variable responsible on holding the total length so I can put it in my snippet code to automatically copy it on my clipboard for easy pasting on excel.

Here's my code snippet for automatically putting it to clipboard

(vlax-invoke
(vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData)
'setData
"TEXT"
(getvar 
)

Solution

  • Since my application uses AutoCAD field expressions to output the length and/or area, the length & area values are not stored in any variable in the code; furthermore, the resulting values displayed by the selected annotation object (which may also be converted to other units and formatted by the field expression) are only available after the field expression has been evaluated.

    Given the above, you would need to obtain the text content of the object selected for output after it has been populated with the field expression, before copying such content to the Windows clipboard.

    This would involve modifying every branch of my LM:outputtext function to assign the result of evaluating the field expression to a variable which may then be returned by the function and used by the calling function.