Results 1 to 3 of 3

Thread: edit attribute angle (flip)

  1. #1
    I could stop if I wanted to aaronic_abacus's Avatar
    Join Date
    2006-04
    Posts
    384
    Login to Give a bone
    0

    Default edit attribute angle (flip)

    This program will flip block nested attributes between a greater and less than range



    Code:
    (DEFUN C:EAR5 ()
     (PROMPT "\n*EDIT ATTRIBUTE ROTATION 5 (FLIP)* ")
     (PROMPT "\nSelect blocks with attributes to edit ")
     (SETQ BS (SSGET '((-4 . "<AND") (0 . "INSERT") (66 . 1) (-4 . "AND>")) ))
     (SETQ BSL (SSLENGTH BS))
     (SETQ CT (- BSL 1))
     (SETQ NEARGA (GETANGLE "\nEnter greater than angle: "))
     (SETQ NEARLA (GETANGLE "\nEnter less than angle: "))
     (SETQ LP 1)
     (WHILE LP
      (SETQ NE (SSNAME BS CT))
      (SETQ CT2 0)
      (SETQ LP2 1)
      (WHILE LP2
       (SETQ NE (ENTNEXT NE))
       (SETQ NEL (ENTGET NE))
       (SETQ NEAET (CDR (ASSOC 0 NEL)))
       (SETQ NEA (ASSOC 50 NEL))
       (SETQ NEAV (CDR NEA))
       (SETQ NNEAV NIL)
       (IF (> NEAV (* 2 PI)) (SETQ NEAV (- NEAV (/ NEAV (* 2 PI)))))
       (IF (AND (> NEAV NEARGA ) (< NEAV NEARLA)) (SETQ NNEAV (+ NEAV PI)))
       (IF (/= NNEAV NIL)
        (PROGN
         (SETQ NOFNU (CONS 50 NNEAV))
         (IF (= NEAET "ATTRIB")
          (PROGN
           (IF (/= NEA NIL)
            (PROGN
             (SETQ OFNU NEA)
             (SETQ NNEL (SUBST NOFNU OFNU NEL))
             (ENTMOD NNEL)
             (ENTUPD NE)
           ));END PROGN/IF NEA
         ));END PROGN/IF NEAET
       ));END PROGN/IF NNEAV
       (IF (= NEAET "SEQEND") (SETQ LP2 NIL))
      );END WHILE LP2
      (SETQ CT (- CT 1))
      (IF (< CT 0) (SETQ LP NIL))
     );END WHILE LP
     (PRINC)
    );END EAR5
    Attached Files Attached Files
    Last edited by aaronic_abacus; 2018-12-27 at 05:57 AM.

    http://www.watsonlisp.com

    Artificial Intelligence for AutoCAD
    Find detail drawings by text and attribute content!
    6000 lines of code and and in development since 1997.

  2. #2
    I could stop if I wanted to aaronic_abacus's Avatar
    Join Date
    2006-04
    Posts
    384
    Login to Give a bone
    0

    Default Re: edit attribute angle (flip)

    line 20 looks weird

    (IF (> NEAV (* 2 PI)) (SETQ NEAV (- NEAV (/ NEAV (* 2 PI)))))

    trying to bring the angle in radians to a range below 2 PI

    (IF (> NEAV (* 2 PI)) (SETQ NEAV (- NEAV (* (* 2 PI) (- (/ NEAV (* 2 PI)) 1)))))

    Code:
    (DEFUN C:EAR5 ()
     (PROMPT "\n*EDIT ATTRIBUTE ROTATION 5 (FLIP)* ")
     (PROMPT "\nSelect blocks with attributes to edit ")
     (SETQ BS (SSGET '((-4 . "<AND") (0 . "INSERT") (66 . 1) (-4 . "AND>")) ))
     (SETQ BSL (SSLENGTH BS))
     (SETQ CT (- BSL 1))
     (SETQ NEARGA (GETANGLE "\nEnter greater than angle: "))
     (SETQ NEARLA (GETANGLE "\nEnter less than angle: "))
     (SETQ LP 1)
     (WHILE LP
      (SETQ NE (SSNAME BS CT))
      (SETQ CT2 0)
      (SETQ LP2 1)
      (WHILE LP2
       (SETQ NE (ENTNEXT NE))
       (SETQ NEL (ENTGET NE))
       (SETQ NEAET (CDR (ASSOC 0 NEL)))
       (SETQ NEA (ASSOC 50 NEL))
       (SETQ NEAV (CDR NEA))
       (SETQ NNEAV NIL)
       (IF (> NEAV (* 2 PI)) (SETQ NEAV (- NEAV (* (* 2 PI) (- (/ NEAV (* 2 PI)) 1)))))
       (IF (AND (> NEAV NEARGA ) (< NEAV NEARLA)) (SETQ NNEAV (+ NEAV PI)))
       (IF (/= NNEAV NIL)
        (PROGN
         (SETQ NOFNU (CONS 50 NNEAV))
         (IF (= NEAET "ATTRIB")
          (PROGN
           (IF (/= NEA NIL)
            (PROGN
             (SETQ OFNU NEA)
             (SETQ NNEL (SUBST NOFNU OFNU NEL))
             (ENTMOD NNEL)
             (ENTUPD NE)
           ));END PROGN/IF NEA
         ));END PROGN/IF NEAET
       ));END PROGN/IF NNEAV
       (IF (= NEAET "SEQEND") (SETQ LP2 NIL))
      );END WHILE LP2
      (SETQ CT (- CT 1))
      (IF (< CT 0) (SETQ LP NIL))
     );END WHILE LP
     (PRINC)
    );END EAR5
    Attached Files Attached Files
    Last edited by aaronic_abacus; 2019-02-14 at 10:12 PM.

    http://www.watsonlisp.com

    Artificial Intelligence for AutoCAD
    Find detail drawings by text and attribute content!
    6000 lines of code and and in development since 1997.

  3. #3
    I could stop if I wanted to aaronic_abacus's Avatar
    Join Date
    2006-04
    Posts
    384
    Login to Give a bone
    0

    Default Re: edit attribute angle (flip)

    is it even possible to have more than 2PI in radians?

    http://www.watsonlisp.com

    Artificial Intelligence for AutoCAD
    Find detail drawings by text and attribute content!
    6000 lines of code and and in development since 1997.

Similar Threads

  1. 2015: Flip state name in an attribute field
    By MMccall in forum Dynamic Blocks - Technical
    Replies: 0
    Last Post: 2017-03-07, 10:17 PM
  2. How to best rotate/flip symbol with block attribute
    By kknauss in forum Dynamic Blocks - Technical
    Replies: 6
    Last Post: 2013-11-11, 01:28 PM
  3. Rotating a tag, flip attribute in 2nd & 3rd quadrants
    By RobertB in forum Dynamic Blocks - Technical
    Replies: 6
    Last Post: 2008-09-29, 05:57 PM
  4. Replies: 3
    Last Post: 2007-03-08, 10:06 PM
  5. Replies: 2
    Last Post: 2006-08-15, 04:18 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
  •