Results 1 to 4 of 4

Thread: simple "if" "and" "or" question

  1. #1
    Member
    Join Date
    2006-05
    Posts
    48
    Login to Give a bone
    0

    Wink simple "if" "and" "or" question

    Sorry to ask such a trivial question but its hard to search for "if" "and" and "or". I need to write an if or statement. I need to perform a task if an entity is a lwpolyline or a circle. Thanks in advance.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: simple "if" "and" "or" question

    No need to apologise ... we all needed to learn from somewhere
    If you have the entity data as you would after an entget, then this might do (assume edata is the list returned from entget):
    Code:
    (if (or (= (cdr (assoc 0 edata)) "LWPOLYLINE")
            (= (cdr (assoc 0 edata)) "CIRCLE")
       ) ;end of or
      (progn
        ;; Do what needs done with the PL or Circ
      ) ;end of progn
      (progn
        ;; Do what needs done if not a PL or Circ
      ) ;end of progn
    ) ;end of if
    Another simpler way (no or needed - implied with comma "," in wcmatch):
    Code:
    (if (wcmatch (cdr (assoc 0 edata)) "LWPOLYLINE,CIRCLE")
    ;; continue as usual

  3. #3
    Member
    Join Date
    2006-05
    Posts
    48
    Login to Give a bone
    0

    Thumbs up Re: simple "if" "and" "or" question

    Thanks, thats great. Very easy to do, but very hard to find out how to do it.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: simple "if" "and" "or" question

    If you're doing LISP programming, what editor do you use? I'd advise using AutoCAD's built-in VLIDE. One nice thing here is, if the cursor's on a function name (such as if / or) you can press Ctrl+F1 and the developer help opens for that function.

    This is one of the minor reasons I use VLIDE (instead of anything else), the major reasons:
    • Automatic formatting & tabs
    • Colouring code
    • ***Most Important*** debugging code directly in AutoCAD

Similar Threads

  1. Replies: 8
    Last Post: 2012-08-18, 01:31 AM
  2. Replies: 0
    Last Post: 2012-06-06, 11:54 AM
  3. Replies: 5
    Last Post: 2009-04-17, 10:10 AM
  4. ENTIDADES EN ALIGNMENT COMO "FIXED", "FLOTING" y "FREE"
    By cadia in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2009-02-01, 04:21 AM
  5. Replies: 1
    Last Post: 2006-06-13, 06:36 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
  •