The freeware AutoLISP AreaText.lsp has been updated to run on 64-bit AutoCAD as well.
On the x64 platform, creating a Field expression from lisp (or VB) requires that you use the 64-bit ObjectID as a string so the source code had to be updated accordingly using this function I got from ADN:
(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) ) ) )
If you want other units or formats or scaling of the text see the post Customize AreaText.LSP for AutoCAD.
Sadly, the routine gives the following error message on my AutoCAD 2011 64 bit, with metric units.
ReplyDeleteSelect object: Select point: ; error: bad argument type: numberp:
"8796083608048"
Any idea?
Try the tip here and see if it can help as you might need to use the FIELD command to figure out the code: Customize AreaText.LSP for AutoCAD
ReplyDeleteThe other idea is to run a piece of the code at the time to figure out where it fails:
You just paste it to the command line one row at a time.
Start by loading the LSP file.
(vl-load-com)
(setq entObject (vlax-ename->vla-object(car (entsel))))
(setq entObjectID (Get-ObjectIDx64 entObject))
(rtos entObjectID 2 0)
Then let me know what the command line shows.
Hi Jimmy,
ReplyDeleteThese are the results:
Command: at
Select object: Select point: ; error: bad argument type: numberp:
"8796083608032"
Command: (vl-load-com)
Command: (setq entObject (vlax-ename->vla-object(car (entsel))))
Select object: #
Command: (setq entObjectID (Get-ObjectIDx64 entObject))
"8796083608032"
Command: (rtos entObjectID 2 0)
; error: bad argument type: numberp: "8796083608032"
I think I found the issue that the code converted a value with rtos that already was a string.
ReplyDeletePlease download the updated code and try again.
Hi, This fixes the problem on a 64bit AutoCAD. But it introduces a problem on the 32bit version.
ReplyDeleteCommand: at
Select object: Select point: ; error: bad argument type: stringp 2128975088
Seems like the upload did not work. Try to download again. You might need to clear the cache.
ReplyDeleteIt does work on a 64bit AutoCAD, It doesnot on a 32bit AutoCAD.
ReplyDeleteMaybe the following also needs a
"if 64 bit; then ....; else ....' part.
InsertionPoint 0.0 (strcat
"%<\\AcObjProp Object(%<\\_ObjId "
entObjectID
">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. FT.\">%"
I have tried on 32bit and it works. What AutoCAD version do you have?
ReplyDeleteMake sure you have these rows in the code:
(rtos (vla-get-objectid obj) 2 0)
and further down
"%<\\AcObjProp Object(%<\\_ObjId "
entObjectID
">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. FT.\">%"
Hi,
ReplyDeleteIt works now. Thanks for all your support
is there a way to remove the wipeout behind the text?
ReplyDeleteThe FIELD object has a grey background that can be hidden using FIELDDISPLAY set to 0.
ReplyDelete