Jump to content

Area LAF not working in ACAD 2009 (64 bit)


Recommended Posts

Posted

I have searched and searched for this, but can't find a solution. I am using the x64 version of AutoCad 2009. Running this in a 32 bit version worked fine.

 

(This lisp will allow you to select multple (closed) polylines or rectangles and insert the area in square feet into the center of the "room" as a field.)

 

All it returns is #### instead of the area in sqft.

 

Anyone know why this won't work for AutoCad 2009 (64 bit)?

 

I will post my lisp.

 

Thank you for any help.

AreaLAF.lsp

Posted

i couldnt get it to do anything keep getting too few arguments, is this the whole thing or just a part of it?

Posted

No, that is the whole lisp from my computer.

 

I will check the same lisp on a co-workers that worked yesterday to double check. (he was using a 32 bit verison of Acad 2009.)

 

Are you using the 32 bit version as well?

Posted

I tried a co-workers machine (32 bit XP and Acad 2009) and everything worked fine. Over wrote the lisp on my (64 bit XP and Acad 2009) machine, used the EXACT same drawing and did the exact same commands. No Go.

 

(ie: Set DIMTXT, Type LAF, select various rectangles, hit enter and receive only "####")

 

Why, why, why.....

  • 4 years later...
Posted

did someone found a solution yet? having the same problems with the lisp, only show #### instead of a number...

Posted

The objectID is different on 64 bit machines. Try the following instead of (itoa (vlax-get obj 'objectid))...

 

eg.

(AT:ObjectID obj)

 

(eval
 ;; Get ObjectID of VLA-OBJECT (works on 32 & 64 bit machines)
 ;; obj - object to process for ObjectID
 ;; Alan J. Thompson, 12.01.11, 2014.03.17
 (list	'defun
'AT:ObjectID
'(obj)
(if (vlax-method-applicable-p
      (cond (*AcadUtil*)
	    ((setq *AcadUtil*
		    (vla-get-utility
		      (cond (*AcadDoc*)
			    ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
		      )
		    )
	     )
	    )
      )
      'getobjectidstring
    )
  (list 'vla-getobjectidstring *AcadUtil* 'obj ':vlax-false)
  '(itoa (vla-get-objectid obj))
)
 )
)

  • 1 year later...
Posted

I'm sorry, but what is the entire lsp please.

 

;; local defun

;; get center of closed object

(defun getcenter (obj / acsp cen rgn)

(setq acsp (vla-get-modelspace

(vla-get-activedocument

(vlax-get-acad-object)))

rgn (car (vlax-invoke acsp 'Addregion (list obj)))

cen (vlax-get rgn 'Centroid)

)

(vla-delete rgn)

cen

)

;; main part

;; label [plines w]/area field in sq. meters

(defun c:laf (/ acsp adoc axss cpt ins ss txt mtxtobj)

(vl-load-com)

(or adoc

(setq adoc (vla-get-activedocument

(vlax-get-acad-object)

)

)

)

(or acsp

(setq acsp (vla-get-modelspace

adoc

)

)

)

(if

(setq ss (ssget (list (cons 0 "*POLYLINE,*CONTOUR"))))

(progn

(setq axss (vla-get-activeselectionset adoc))

;; iterate through the active selection set collection

(vlax-for obj axss

; get a curve center

(setq cpt (trans (getcenter obj) 0 1))

(setq txt

; displayed in meters to 3 decimal place:

;;; (strcat "%\\AcObjProp Object(%\\_ObjId "

;;; (itoa (vlax-get obj 'ObjectID))

;;; ">%).Area \\f \"%lu2%pr3%ps[, m2]%ct8[1e-006]\">%"

;;; )

; displayed in engineering to 2 decimal place:

(strcat "%\\AcObjProp Object(%\\_ObjId "

(itoa (vlax-get obj 'ObjectID))

">%).Area \\f \"%pr2%lu2%ct4%qf1\">%");

; displayed in engineering to 2 decimal place with addition SQ. FT.:

;;; (strcat "%\\AcObjProp Object(%\\_ObjId "

;;; (itoa (vlax-get obj 'ObjectID))

;;; ">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. FT.\">%")

)

; add mtext object to model space

(setq mtxtobj (vlax-invoke

acsp 'AddMText

cpt ;insertion point

0.0 ; mtext width, optional = 0

txt ;string (field value)

))

; change mtext height accordingly to current dimension style text height:

(vlax-put mtxtobj 'Height (getvar "dimtxt")); change (getvar "dimtxt") on text height you need

; set justifying to middle center

(vlax-put mtxtobj 'AttachmentPoint acAttachmentPointMiddleCenter)

)

)

)

(vla-regen adoc acactiveviewport)

(princ)

)

(princ "\n Type LAF to label objects with area field")

(princ)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...