Results 1 to 5 of 5

Thread: Get the top most left corner & bottom right corner point of a closed Polyline

  1. #1
    Member KHADREE_SHARIFF's Avatar
    Join Date
    2007-03
    Posts
    4
    Login to Give a bone
    0

    Question Get the top most left corner & bottom right corner point of a closed Polyline

    how to get the top most left corner & bottom right corner point of a closed polyline
    created by using boundary command,
    how to get the values form the entget
    list and that gave me another ? if i want to use the assoc 10 value of a
    polyline how do i repeat so that the list will give me the second assoc 10 value

    Command: !ed2 ((-1 . <Entity name: 7dda44d0>) (0 . "LWPOLYLINE") (330 . <Entity
    name: 7dde6cf8>) (5 . "332A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8
    . "S-Rein") (100 . "AcDbPolyline") (90 . 11) (70 . 1) (43 . 0.0) (38 . 0.0) (39
    . 0.0) (10 5311.13 5828.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 5311.13
    6128.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 646.43 6128.44) (40 . 0.0) (41 .
    0.0) (42 . 0.0) (10 646.43 5828.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10
    646.583 2298.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 646.43 2298.44) (40 .
    0.0) (41 . 0.0) (42 . 0.0) (10 646.43 1998.44) (40 . 0.0) (41 . 0.0) (42 . 0.0)
    (10 5310.41 1998.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 5310.41 2298.44) (40
    . 0.0) (41 . 0.0) (42 . 0.0) (10 5310.43 2298.44) (40 . 0.0) (41 . 0.0) (42 .
    0.0) (10 5310.43 5828.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))

    as you can see there are more 10 values listed so my question is
    would be how do you use the first 10 and then the second 10 and then the third 10
    ( see image file)
    Attached Images Attached Images

  2. #2
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Get the top most left corner & bottom right corner point of a closed Polyline

    Code:
      ;following by Tony Tanzillo
      (list
        (apply 'mapcar (cons 'min ptlst))
        (apply 'mapcar (cons 'max ptlst))
      )

  3. #3
    Member
    Join Date
    2006-01
    Posts
    29
    Login to Give a bone
    0

    Default Re: Get the top most left corner & bottom right corner point of a closed Polyline

    Even I am finding it difficult to get the 2nd, 3rd, etc... points i.e. I tried CAB2k suggestion, but not able to understand working.
    Ravish

  4. #4
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Get the top most left corner & bottom right corner point of a closed Polyline

    I thought you wanted the Lower left & uper right of the point. That was part od the solution.
    But if its the bounding box you want use this:
    Code:
    (defun c:test (/ ent obj ll lr ur ul)
      (setq ent (car (entsel)))
      (setq obj (vlax-ename->vla-object ent))
      (vla-getboundingbox obj 'll 'ur)
      (setq ll (vlax-safearray->list ll))
      (setq ur (vlax-safearray->list ur))
      (setq ul (list (car ur)(cadr ll)))
      (setq lr (list (car ll)(cadr ur)))
      (grvecs (list -256 ll lr lr ur ur ul ul ll))
      (princ)
    )

  5. #5
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Get the top most left corner & bottom right corner point of a closed Polyline

    If its the point list you want to work with, perhaps this will do:
    Code:
    (defun c:test (/ elst ll lr ur ul)
    
      (setq elst
            '((-1 . <Entityname:7dda44d0>) (0 . "LWPOLYLINE") (330 . <Entityname:7dde6cf8>)
               (5 . "332A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "S-Rein")
               (100 . "AcDbPolyline") (90 . 11) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0)
               (10 5311.13 5828.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 5311.13 6128.44)
               (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 646.43 6128.44) (40 . 0.0) (41 . 0.0)
               (42 . 0.0) (10 646.43 5828.44) (40 . 0.0) (41 . 0.0) (42 . 0.0)
               (10 646.583 2298.44)(40 . 0.0) (41 . 0.0) (42 . 0.0) (10 646.43 2298.44)
               (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 646.43 1998.44) (40 . 0.0) (41 . 0.0)
               (42 . 0.0) (10 5310.41 1998.44) (40 . 0.0) (41 . 0.0) (42 . 0.0)
               (10 5310.41 2298.44) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 5310.43 2298.44)
               (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 5310.43 5828.44) (40 . 0.0) (41 . 0.0)
               (42 . 0.0) (210 0.0 0.0 1.0))
      )
    
      (setq ptlst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst)))
      
      (setq ll (apply 'mapcar (cons 'min ptlst))
            ur (apply 'mapcar (cons 'max ptlst))
            ul (list (car ur)(cadr ll))
            lr (list (car ll)(cadr ur))
       )
    
      (mapcar 'print (list ll lr ur ul))
      (princ)
    )

Similar Threads

  1. 2013: Icon - rectangle with flag on top left corner?
    By dtamplen in forum AutoCAD General
    Replies: 2
    Last Post: 2012-07-24, 12:33 PM
  2. Lower Left and Upper Right Corner
    By avinash patil in forum VBA/COM Interop
    Replies: 1
    Last Post: 2011-08-31, 11:10 AM
  3. 2008: page setup not 0,0 in lower left corner
    By jledgewood in forum AutoCAD General
    Replies: 7
    Last Post: 2011-07-19, 01:57 PM
  4. SSG Curtain Wall Corner, different bottom
    By 3dway in forum Revit Architecture - General
    Replies: 5
    Last Post: 2009-10-17, 02:10 AM
  5. Find the lower left corner of polyline rectangle
    By avinash00002002 in forum AutoLISP
    Replies: 5
    Last Post: 2007-04-28, 08:52 AM

Posting Permissions

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