Results 1 to 2 of 2

Thread: Polyline Area

  1. #1
    AUGI Addict .chad's Avatar
    Join Date
    2006-04
    Location
    is it lunch time yet?
    Posts
    1,129
    Login to Give a bone
    0

    Default Polyline Area

    i have this fantastic lisp that will add up the area's of selected polylines. i want to make a copy of it that will subtract areas. i looked at the lisp itself, and at the sticky in the forum - and it might as well be written in cuneiform. im sure its a simple fix in one place, i just dont know what the fix is.

    thanks
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: Polyline Area

    Do you mean somthing like this?
    Code:
    (defun c:plarea (/ selset_start selset_minus area_start area_minus)
      (vl-load-com)
      (if (and ((lambda ()
                  (prompt "\nSelect polylines for start summary areas <Cancel> : ")
                  (= (type (setq selset_start
                                  (vl-catch-all-apply
                                    '(lambda () (ssget '((0 . "*POLYLINE,SPLINE"))))
                                    ) ;_ end of vl-catch-all-apply
                                 ) ;_ end of setq
                           ) ;_ end of type
                     'pickset
                     ) ;_ end of =
                  ) ;_ end of lambda
                )
               ((lambda ()
                  (prompt "\nSelect polylines for subtract areas <Cancel> : ")
                  (= (type (setq selset_minus
                                  (vl-catch-all-apply
                                    '(lambda () (ssget '((0 . "*POLYLINE,SPLINE"))))
                                    ) ;_ end of vl-catch-all-apply
                                 ) ;_ end of setq
                           ) ;_ end of type
                     'pickset
                     ) ;_ end of =
                  ) ;_ end of lambda
                )
               ) ;_ end of and
        (progn
          (setq selset_start (vl-remove-if-not
                               '(lambda (x)
                                  (and (vlax-curve-isplanar x)
                                       (or (equal (vla-get-closed x) :vlax-true)
                                           (equal (vlax-curve-getstartpoint x)
                                                  (vlax-curve-getendpoint x)
                                                  ) ;_ end of equal
                                           ) ;_ end of or
                                       ) ;_ end of and
                                  ) ;_ end of lambda
                               (mapcar 'vlax-ename->vla-object
                                       (vl-remove-if
                                         'listp
                                         (mapcar 'cadr (ssnamex selset_start))
                                         ) ;_ end of vl-remove-if
                                       ) ;_ end of mapcar
                               ) ;_ end of vl-remove-if-not
                selset_minus (vl-remove-if-not
                               '(lambda (x)
                                  (and (vlax-curve-isplanar x)
                                       (or (equal (vla-get-closed x) :vlax-true)
                                           (equal (vlax-curve-getstartpoint x)
                                                  (vlax-curve-getendpoint x)
                                                  ) ;_ end of equal
                                           ) ;_ end of or
                                       ) ;_ end of and
                                  ) ;_ end of lambda
                               (mapcar 'vlax-ename->vla-object
                                       (vl-remove-if
                                         'listp
                                         (mapcar 'cadr (ssnamex selset_minus))
                                         ) ;_ end of vl-remove-if
                                       ) ;_ end of mapcar
                               ) ;_ end of vl-remove-if-not
                area_start   (apply '+ (mapcar 'vla-get-area selset_start))
                area_minus   (apply '+ (mapcar 'vla-get-area selset_minus))
                ) ;_ end of setq
          (alert (strcat "Start area is : "
                         (rtos (/ area_start 144.) 2 1)
                         "Sq.Ft"
                         "\nSubtract area is : "
                         (rtos (/ area_minus 144.) 2 1)
                         "Sq.Ft"
                         "\nResult area is : "
                         (rtos (/ (- area_start area_minus) 144.) 2 1)
                         "Sq.Ft"
                         ) ;_ end of strcat
                 ) ;_ end of alert
          ) ;_ end of progn
        ) ;_ end of if
      ) ;_ end of defun

Similar Threads

  1. Area without a closed polyline
    By Wish List System in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2014-02-11, 03:07 PM
  2. 2010: why does polyline have area?
    By mcdonough.80122419 in forum AutoCAD General
    Replies: 2
    Last Post: 2013-02-21, 09:51 PM
  3. 3d polyline area
    By pennygreg in forum AutoLISP
    Replies: 9
    Last Post: 2009-01-18, 10:36 PM
  4. Area of Polyline or Hatch
    By robert.1.hall72202 in forum AutoCAD General
    Replies: 3
    Last Post: 2006-08-08, 05:25 PM
  5. I need the area of a polyline in sq. ft, not sq. in.
    By jtaylor.82814 in forum AutoLISP
    Replies: 29
    Last Post: 2006-03-13, 11:57 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
  •