jvillarreal Posted November 9, 2010 Posted November 9, 2010 (edited) Something I did at theswamp i thought i'd share here as well. This routine labels objects at center and creates table, txt, or xls of areas. Option for field usage available if object id successfully obtained Unitlist includes: (list "Sq Inches" "Sq Feet" "Sq Yards" "Acres" "Sq Miles" "Sq Millimeters" "Sq Centimeters" "Sq Meters" "Sq Kilometers") Its been tested on acad 2008 thru 2010 Note: I haven't worked on obtaining a proper width to use in the tables for the field text strings. AC_AREA-CALC_v1.3.lsp Edited November 9, 2010 by jvillarreal Quote
BlackBox Posted November 9, 2010 Posted November 9, 2010 :: Danger, Will Robinson! :: While many AutoCAD deployments utilize the default C:\Program Files\\Support\ folder for their mapped location to pull from ACAD.pat, this is not the case for all, and will result in an error if the local directory returned by (setq wPath (findfile "ACAD.PAT")) does not permit write access: Command: ac Object Filter [ ANY / POLYLINE / CIRCLE / ELLIPSE / REGION / SPLINE ]: <ANY> Select objects: 1 found Select objects: button07 : button { width = 7; alignment = centered; fixed_width = true; } AreaCalc : dialog { label = "Results"; :row { : text { label = "Prefix:" ; alignment = Centered; } : text { label = "Initial #:" ; alignment = Centered; } } :row { :edit_box { key = "Pfx"; alignment = centered; edit_limit = 18; edit_width = 18; } :edit_box { key = "init"; alignment = centered; edit_limit = 18; edit_width = 18; } } :row { :toggle { key = "kword"; label = "Label Areas"; alignment = center; } :toggle { key = "fields"; label = "Use Fields"; alignment = center; } } :boxed_column { label = "Area Conversion"; :popup_list { key = "Selection1"; label = "Convert From:" ;alignment = left; edit_width = 18;} :popup_list { key = "Selection2"; label = "Convert To:" ;alignment = left; edit_width = 18;} :edit_box { key = "Original"; label = "Total:"; alignment = left; edit_limit = 18; edit_width = 18; } :edit_box { key = "Converted"; label = "Converted:"; alignment = left; edit_limit = 18; edit_width = 18; } :row { :toggle { key = "include"; label = "Suffix"; alignment = center; } :popup_list { key = "Selection3";alignment = left; edit_width = 18;} } } :boxed_column { label = "Report Format"; :popup_list { key = "Selection4"; alignment = left; edit_width = 18;} } : button07 { key = "accept"; label = "Done"; fixed_width = true ; alignment = centered; is_default = true; is_cancel = true; } } [color=red]<bad argument type: streamp nil>[/color] [color=#ff0000][/color] Command: Quote
jvillarreal Posted November 9, 2010 Author Posted November 9, 2010 Thanks for the heads up RenderMan. Quote
jvillarreal Posted November 9, 2010 Author Posted November 9, 2010 (edited) I also noticed that after initial use of the program, if from or to was changed, the 'suffix' conversion factor wouldn't update unless a unit was manually selected from the suffix list. The action_tile calls to the convert from and to popup lists (Selection1 and Selection2) were missing this line. (if realconversion2 (setq realconversion2 (* (nth sfx conversionlist)(nth to inverseconversionlist)))) I've updated the post. Edited November 10, 2010 by jvillarreal Quote
BlackBox Posted November 9, 2010 Posted November 9, 2010 Thanks for the heads up RenderMan. You're welcome. Quote
stevesfr Posted November 10, 2010 Posted November 10, 2010 I get the following error when trying to run the lisp: Command: ac > Don't have a clue what to look at in order to fix. Steve Quote
BlackBox Posted November 10, 2010 Posted November 10, 2010 I get the following error when trying to run the lisp: Command: ac > Don't have a clue what to look at in order to fix. Steve Step through the code within the VLIDE line by line to see where it bombs. Quote
stevesfr Posted November 10, 2010 Posted November 10, 2010 Makes no difference invoke lisp before or after selecting object.... running your suggestion at the command.... sheds no light... Command: (defun GetObjectID ( obj doc) (_> (if (vlax-method-applicable-p (vla-get-utility doc) 'Getobjectidstring) ((_> (vlax-invoke-method (vla-get-Utility doc) 'GetObjectIdString obj :vlax-false) ((_> (itoa (vla-get-Objectid obj)) ((_> ) (_> ) GETOBJECTID Quote
jvillarreal Posted November 10, 2010 Author Posted November 10, 2010 Sorry, wouldn't have deleted the message had i known you responded. The selection of objects would have been obvious. Enter "vlide" at the command line. and paste this in (getobjectid (vlax-ename->vla-object (car (entsel))) (vla-get-ActiveDocument (vlax-get-Acad-Object))) after hitting enter, select an object. What does it give you? Quote
stevesfr Posted November 10, 2010 Posted November 10, 2010 gives the following in vlide _$ (getobjectid (vlax-ename->vla-object (car (entsel))) (vla-get-ActiveDocument (vlax-get-Acad-Object))) _1$ no reaction in Acad when selecting object other than above in vlide in a different trial in a new blank dwg, loading and running the lisp does produce the dcl file in the directory where acad.pat resides. Then when invoking the lisp and selecting an object, acad finds the dcl but its on the screen for only a millisecond and then the previous error statement appears. Why the dcl does not remain, is probably the problem to be investigated. S Quote
jvillarreal Posted November 10, 2010 Author Posted November 10, 2010 (edited) That line of code should've produced a string. If not, that's the error. **Edit** Removed code provided to steve as it was for testing purposes only. Edited November 10, 2010 by jvillarreal Quote
stevesfr Posted November 10, 2010 Posted November 10, 2010 That line of code should've produced a string or nil. If not, that's the error. Try this one out in a new drawing: [ATTACH]24514[/ATTACH] Same result as "original" lisp. Tomorrow I'll try diff machine and diff acad version.... stay toooooned. thanks very much for the efforts... help and suggestions. Steve Quote
andyevans Posted July 15, 2011 Posted July 15, 2011 Just found this lisp and it is absolutely perfect for what I need it for, thanks for posting. Question is how easy would it be to modify to place the numerical area underneath the name within the polyline ? Any help would be appreciated,. Andy Quote
stevesfr Posted July 15, 2011 Posted July 15, 2011 too bad it doesn't work all the time, every time Quote
andyevans Posted July 15, 2011 Posted July 15, 2011 Steve, The version I have, 2.1, seems to be fairly robust. So far ! Andy Quote
stevesfr Posted July 15, 2011 Posted July 15, 2011 Steve, The version I have, 2.1, seems to be fairly robust. So far ! Andy Andy, can you provide a link to 2.1 ? ? Steve Quote
andyevans Posted July 15, 2011 Posted July 15, 2011 Andy, can you provide a link to 2.1 ? ?Steve http://http://cadtips.cadalyst.com/tables/summarize-object-areas Quote
Recommended Posts
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.