+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: simple area

  1. #1
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Location
    Quebec, Canada
    Posts
    11

    Question simple area

    Registered forum members do not see this ad.

    i'm looking for a simple area routine base on the dimension not the line.
    i want to be able to click on 2 cotation that i got from the dimlinear command and have the area "print" in a text format where i want to.
    I know a routine with a lot of visual lisp routine in it, but i'm looking a version with a standard/ basic lisp.

    thank you.

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,225

    Default

    Hi,

    Is it something like select the 1st dimlinear then the 2nd one then specify a point to place the area as a text object which supposed to be produced from multiplying of dim text1 and dim text2 ?

  3. #3
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,225

    Default

    This?
    Code:
    (defun c:Test ( / dm1 dm2 en1 en2 obj get hgt ins )
      (and
        (setq dm1 (car (entsel "\nSelect 1st dimlineaer :")))
        (or (member '(100 . "AcDbAlignedDimension") (setq en1 (entget dm1)))
            (alert "Invalid object.<!>")
            )
        (setq dm2 (car (entsel "\nSelect 2nd dimlineaer :")))
        (or (member '(100 . "AcDbAlignedDimension") (setq en2 (entget dm2)))
            (alert "Invalid object.<!>")
            )
        (setq obj (tblobjname "BLOCK" (cdr (assoc 2 en1))))
        (while (and (not hgt) (setq obj (entnext obj)))
          (and (= (cdr (assoc 0 (setq get (entget obj)))) "MTEXT")
               (setq hgt (assoc 40 get))
               )
          )
        (setq ins (getpoint "\nSpecify location of text area :"))
        (entmake (list '(0 . "TEXT") (cons 10 (trans ins 0 1)) (cons 11 (trans ins 0 1)) hgt
                       (cons 1 (rtos (* (cdr (assoc 42 en1)) (cdr (assoc 42 en2))) 2))
                       )
                 )
        )
      (princ)
      )

  4. #4
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Location
    Quebec, Canada
    Posts
    11

    Default

    exactly. i'll try your code.

  5. #5
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Location
    Quebec, Canada
    Posts
    11

    Default

    work perfectly thank...

    If i can ask you an other issue.
    if i have a few area measurement and i want to have the total, what would be the routine/formula?

    thank

  6. #6
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,225

    Default

    You're welcome.

    Quote Originally Posted by bogeymen77 View Post
    if i have a few area measurement and i want to have the total, what would be the routine/formula?
    Do you mean that you would like to sum texts with numerical values to new text as total areas?

  7. #7
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Location
    Quebec, Canada
    Posts
    11

    Default

    yes. for exemple i got 4 piece of counter top ,i got the area for each one. After i would like to have the sum of all 4 pieces.

    thank you

  8. #8
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,225

    Default

    What do you mean by counter top?
    Can you upload a sample drawing showing the outcome of the process that you looking forward?

  9. #9
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    May 2018
    Location
    Quebec, Canada
    Posts
    11

    Default counter top

    i'm drawing counter top. here'S an example
    Attached Files

  10. #10
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,585

    Default

    Registered forum members do not see this ad.

    I am sure Tharwat will continue to answer there are a few different ways to do this.

    1 Pick text and add up.
    2 Select text on one layer, your dwg its on layer 0 needs to be something different, like table-area.
    3 Make a block and have an attribute then just total all attributes.
    4 like 3 but make an Autocad table of the areas with common table top styles.

    It would be good at this point to suggest which method you want so its not a case of multiple changes.

    Could not resist suggestion 1, this is real basic no error checking.
    Code:
    (defun c:test ( / tot ent obj)
    (setq tot 0.0)
    (while (setq ent (entsel "\nPick text Enter to stop"))
    (setq obj (vlax-ename->vla-object (car ent)))
    (setq tot (+ (atof (vla-get-textstring obj)) tot))
    )
    (alert (strcat "The total area is = " (rtos tot 2 3 )))
    )
    A man who never made mistakes never made anything

Similar Threads

  1. Simple question, so apologies if it's too simple!
    By dueingx4 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 11
    Last Post: 2nd Jan 2015, 11:58 am
  2. simple simple... connecting to 2006 via interop
    By btraemoore in forum .NET, ObjectARX & VBA
    Replies: 2
    Last Post: 29th Apr 2013, 03:39 pm
  3. simple area macro
    By cproudfoot in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 3rd Apr 2008, 12:22 pm
  4. Quick & simple work area setup tips needed
    By JamFam in forum AutoCAD Beginners' Area
    Replies: 9
    Last Post: 17th Mar 2006, 05:46 am

Tags for this Thread

Bookmarks

Posting Permissions

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