Results 1 to 4 of 4

Thread: By Picking Rectangle Cross Window,Display Instant Area at Command line.

  1. #1
    Member
    Join Date
    2016-10
    Posts
    31
    Login to Give a bone
    0

    Question By Picking Rectangle Cross Window,Display Instant Area at Command line.

    Hi All..

    I need lisp routine by Clicking Two Diagonal corners like Rectangle, After finished picking need to display that rectangle area result at Command line. and disappear the drawn rectangle.

    Procedure for executing lisp is 1. Pick point 1
    2.Pick at Final corner point 2
    3. And Displays the Rectangle area result at Command line & Disappear drawn the rectangle.

    Kindly help me. i have to check the areas between different points.
    Attached Images Attached Images

  2. #2
    Member
    Join Date
    2015-12
    Posts
    31
    Login to Give a bone
    0

    Default Re: By Picking Rectangle Cross Window,Display Instant Area at Command line.

    Are these "points" random or are you selecting a point object (node)?

  3. #3
    100 Club
    Join Date
    2002-08
    Posts
    189
    Login to Give a bone
    0

    Default Re: By Picking Rectangle Cross Window,Display Instant Area at Command line.

    This for exemple?

    Code:
    (defun C:Q?point ( / pt1 pt2 surf ss n dxf_ent)
      (initget 9)
      (setq pt1 (getpoint "\nFirst corner?: "))
      (initget 9)
      (setq pt2 (getcorner pt1 "\nSecond corner?: "))
      (setq surf
        (*
          (- (max (car pt1) (car pt2)) (min (car pt1) (car pt2)))
          (- (max (cadr pt1) (cadr pt2)) (min (cadr pt1) (cadr pt2)))
        )
      )
      (cond
        ((setq ss (ssget "_C" pt1 pt2 '((0 . "POINT"))))
          (princ (strcat "\n" (itoa (setq n (sslength ss))) " POINTS in the select box for an area of " (rtos surf 2 2)))
          (initget "Yes No")
          (cond
            ((eq (getkword "\nDo you want more information of this selection [Yes/No]? <No>: ") "Yes")
              (repeat n
                (setq dxf_ent (entget (ssname ss (setq n (1- n)))))
                (princ
                  (strcat
                    "\nPOINT"
                    "\tLayer:"
                    (cdr (assoc 8 dxf_ent))
                    "\tPosition X:"
                    (rtos (cadr (assoc 10 dxf_ent)) 2 2)
                    "\tPosition Y:"
                    (rtos (caddr (assoc 10 dxf_ent)) 2 2)
                    (if (assoc 62 dxf_ent)
                      (strcat "\tColor:" (itoa (cdr (assoc 62 dxf_ent))))
                      ""
                    )
                  )
                )
              )
              (textscr)
            )
          )
        )
        (T (princ (strcat "\nSelection is empty for the select box for an area of " (rtos surf 2 2))))
      )
      (prin1)
    )
    Last edited by Bruno.Valsecchi; 2020-06-30 at 08:25 AM.

  4. #4
    I could stop if I wanted to
    Join Date
    2003-07
    Posts
    392
    Login to Give a bone
    0

    Default Re: By Picking Rectangle Cross Window,Display Instant Area at Command line.

    Much shorter version at Cadtutor just uses X * Y 3 lines all up. Uses list and car cadr of points. But no visual.
    Code:
    (defun c:2ptarea ( / obj )
    (command "rectang" (getpoint "pick p1 then drag") pause)
    (setq obj (vlax-ename->vla-object (entlast)))
    (alert (strcat "area is " (rtos (vla-get-area obj))))
    (command "erase" "l" "")
    (princ)
    )

Similar Threads

  1. 2017: forgot instant readout of feature line command
    By tadthurston725387 in forum AutoCAD Civil 3D - General
    Replies: 3
    Last Post: 2019-08-19, 02:39 PM
  2. Replies: 2
    Last Post: 2012-07-13, 09:04 PM
  3. Replies: 2
    Last Post: 2011-07-22, 05:32 AM
  4. Replies: 3
    Last Post: 2009-04-15, 07:30 PM
  5. Rectangle command returns - unknown command
    By rhayes.99001 in forum AutoCAD General
    Replies: 5
    Last Post: 2006-11-27, 02:33 PM

Tags for this Thread

Posting Permissions

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