See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Area in metric from English units drawing

  1. #1
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Area in metric from English units drawing

    I need a lisp routine that:

    Selects an object (polyline, hatch, etc.)
    that is drawn in english untis

    and

    Returns the area in metric units mm^2


    Anybody know how to do this?

  2. #2
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    You can supply the selection & area portions, this will convert the area to mm^2:

    (cvunit 60.0 "feet^2" "mm^2")
    (cvunit 60.0 "inch^2" "mm^2")

  3. #3
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    Here is a quick and dirty that should work for hatch or polyline entities for getting the raw area, but I didn't try it on lines, arcs, etc.:

    Code:
    (defun c:getarea (/ e vlaobj)
       (setq e (entget (car (entsel))))
       (setq vlaobj (vlax-ename->vla-object (dxf -1 e)))
       (vlax-get-property vlaobj 'Area)
    );defun
    It should at least get you started.

    Take care,
    Tim
    Last edited by Opie; 2006-01-23 at 02:12 PM. Reason: [CODE] tags added

  4. #4
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    Ok, that is giving me:

    Select object: ; error: no function definition: DXF

  5. #5
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,118
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    Quote Originally Posted by Robert.Hall
    Ok, that is giving me:

    Select object: ; error: no function definition: DXF
    Robert,

    Try this function. It appears Tim has a routine to extract some data from an entity's group code data.

    Code:
    (defun DXF (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity
    Tim, If the above code is not right, please let Robert know. Just trying to help out.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  6. #6
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    that solves the dxf error

    however............

    ; error: ActiveX Server returned the error: unknown name: AREA

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,118
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    Quote Originally Posted by Robert.Hall
    that solves the dxf error

    however............

    ; error: ActiveX Server returned the error: unknown name: AREA
    I can't fix everything.

    I'll see what I can come up with after lunch, if I have time.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,118
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    Just a quick thought. Have you tried adding (vl-load-com) to the beginning of the routine?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #9
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    1

    Default Re: Area in metric from English units drawing

    Oops, sorry,

    In my haste, I forgot to give you the dxf function:

    (defun dxf (code elist)
    (cdr (assoc code elist))
    );defun

    Also, it looks like it only returns the area for those items that have area (i.e. hatch and polylines).

    I hope this helps.

    By the way, from personal experience, it is possible to golf in the snow. It's pretty frustrating when the ball turns into a snowball and won't fit in the hole, though.

    Tim

  10. #10
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Area in metric from English units drawing

    So I have an area returned, however, it isn't converted.
    I have been messing around with converting the output
    and I have not had any success. Where in this code do
    I add the conversion?

    Code:
    (defun c:aw (/ e vlaobj)
    (setq e (entget (car (entsel))))
    (setq vlaobj (vlax-ename->vla-object (dxf -1 e)))
    (vlax-get-property vlaobj 'Area)
    );defun
    (defun dxf (code elist)
    (cdr (assoc code elist))
    );defun
    )

Page 1 of 3 123 LastLast

Similar Threads

  1. Grid in English units, CL elevation in Metric?
    By SRBalliet in forum AutoCAD Civil 3D - Sections
    Replies: 1
    Last Post: 2008-06-17, 03:18 PM
  2. Change the units of dimensions from Metric to English
    By robert.1.hall72202 in forum AutoLISP
    Replies: 2
    Last Post: 2007-02-21, 01:36 PM
  3. Scale drawing from metric to english
    By andycrox in forum AutoCAD General
    Replies: 14
    Last Post: 2007-01-23, 03:35 AM
  4. AEC dims showing metric in an english drawing
    By jonesb33145 in forum ACA General
    Replies: 1
    Last Post: 2005-03-28, 06:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •