Results 1 to 6 of 6

Thread: Check if a Rectangle is Closed or Open

  1. #1
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Question Check if a Rectangle is Closed or Open

    Hi alls
    If you have a rectangle ,but you didn't know is it closed or open,my question is how to check it.
    I just check with dxf and vla,it can not found,any body know ,please tell me.

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Check if a Rectangle is Closed or Open

    (70 . 1) closed
    (70 . 0) open

  3. #3
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Check if a Rectangle is Closed or Open

    Hi kennet,
    Ah....I made stupid question,it's really easy solution.
    many thanks kennet you was open my lock brain
    here any code to know that,and I confuse last time why close and open always zero value 1

    Code:
    (defun c:opencloserec (/ p1 p2 p3 p4 p5)
      (setq p1 '(0 0 0))
      (setq p2 '(10 0 0))
      (setq p3 '(10 5 0))
      (setq p4 '(0 5 0))
      (setq p5 '(0 0.5 0))
      (command "_pline" p1 p2 p3 p4 p5 "") ; for open rectangle
     ;(command "_pline" p1 p2 p3 p4 "c" "") ; for closed rectangle
      (princ)
    )
    (setq ss (car (entsel "\nSelect a open rectangle ")))
    (setq sse (entget ss))
    (setq recopen (cdr (assoc 70 sse)))

    ((-1 . <Entity name: 7d23e270>)
    (0 . "LWPOLYLINE")
    (330 . <Entity name: 7ef60cf8>)
    (5 . "FE")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "0")
    (100 . "AcDbPolyline")
    (90 . 5)
    (70 . 0)
    (43 . 0.0)
    (38 . 0.0)
    (39 . 0.0)
    (10 0.0 0.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 10.0 0.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 10.0 5.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 0.0 5.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 0.0 0.5)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (210 0.0 0.0 1.0))
    _$

    0
    _$

    (setq ss (car (entsel "\nSelect a open rectangle ")))
    (setq sse (entget ss))
    (setq recclosed (cdr (assoc 70 sse)))
    <Entity name: 7d23e280>
    ((-1 . <Entity name: 7d23e280>)
    (0 . "LWPOLYLINE")
    (330 . <Entity name: 7ef60cf8>)
    (5 . "100")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "0")
    (100 . "AcDbPolyline")
    (90 . 4)
    (70 . 1)
    (43 . 0.0)
    (38 . 0.0)
    (39 . 0.0)
    (10 0.0 0.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 10.0 0.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 10.0 5.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (10 0.0 5.0)
    (40 . 0.0)
    (41 . 0.0)
    (42 . 0.0)
    (210 0.0 0.0 1.0))
    1
    _$

    Code:
    (defun c:test (/ ss sse)
      (setq ss (car (entsel "\nSelect a rectangle")))
      (setq sse (entget ss))
      (if
    	(= (cdr (assoc 70 sse)) 1)
    	 (alert "\nYour choose rectangle is CLOSED")
    	 (alert "\nYour choose rectangle is OPEN")
      )
      (princ)
    )
    Quote Originally Posted by kennet.sjoberg
    (70 . 1) closed
    (70 . 0) open
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Mike.Perry; 2006-04-05 at 08:36 AM. Reason: [CODE] tags added.

  4. #4
    I could stop if I wanted to SRBalliet's Avatar
    Join Date
    2004-06
    Location
    Near Christiansburg, VA Looking for a closer job!
    Posts
    499
    Login to Give a bone
    0

    Default Re: Check if a Rectangle is Closed or Open

    Why not just check in the Properties Dialog Box? Just select it and it will say wether the polyline is opened or closed.
    <><
    Steve Balliet
    Craig Co., VA
    Civil 3D, Mechanical 2012

  5. #5
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Northern California
    Posts
    583
    Login to Give a bone
    0

    Default Re: Check if a Rectangle is Closed or Open

    Quote Originally Posted by srb
    Why not just check in the Properties Dialog Box? Just select it and it will say wether the polyline is opened or closed.
    Because quite often when you have the user in the middle of a routine, your routine really needs to know the answer to this and you usually can't rely on the user to do it for you, so you decide it's probably best to get yourself programatically.


    Jeff

  6. #6
    I could stop if I wanted to SRBalliet's Avatar
    Join Date
    2004-06
    Location
    Near Christiansburg, VA Looking for a closer job!
    Posts
    499
    Login to Give a bone
    0

    Default Re: Check if a Rectangle is Closed or Open

    Thanks,

    I lurk behind the scenes and try to learn a little about lisp & VBA.
    <><
    Steve Balliet
    Craig Co., VA
    Civil 3D, Mechanical 2012

Similar Threads

  1. CP330-4L: From Open Paren to Closed Paren: Basics of AutoLISP® in 60 Minutes - Repeat
    By Autodesk University in forum Customization and Programming
    Replies: 0
    Last Post: 2015-08-07, 05:18 PM
  2. [2010] Check Duct Systems (OPEN)
    By john_hazucha in forum Revit MEP - Wish List
    Replies: 0
    Last Post: 2009-09-18, 03:45 PM
  3. Pop-Up Ribbon Tabs to remain open until closed
    By Civil 3D Wishes in forum Civil 3D Wish List
    Replies: 0
    Last Post: 2009-04-24, 08:02 PM
  4. Replies: 3
    Last Post: 2009-04-15, 07:30 PM
  5. How to check if an "boundary" is closed
    By stefan_ohrn in forum AutoLISP
    Replies: 10
    Last Post: 2008-08-31, 01:24 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
  •