CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
Plex.Earth connects AutoCAD and Google Earth
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedLisp to calculate area and place a field

 Post Reply Post Reply
Author
ABUSAIF View Drop Down
Groupie
Groupie


Joined: 05.Sep.2012
Location: United States
Using: Autocad 2013
Status: Offline
Points: 21
Direct Link To This Post Topic: Lisp to calculate area and place a field
    Posted: 11.Oct.2012 at 16:42
Hi everybody, looking for a lisp to calculate area of multiple closed polyline and place a field in each with the area, now I need the field to be divided by 10, 20 where I can change it in the lisp. I do Panels in cad that are standard in the width 10, 20.. but the height is different Im trying to get the height only displayed in the rectange I could not find anything to calculate only the height. if anybody can help.. I have a lisp but for some reson it the conversion factor is not right.
thanks al,,

;;; 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: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;; 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
%<\AcObjProp Object(%<\_ObjId 8796088586896>%).Area \f "%lu2%pr2">%
))
)



Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,066 seconds.