+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Full Member
    Computer Details
    djw's Computer Details
    Operating System:
    Windows XP Professional 32 bit Service Pack 3
    Computer:
    Dell Precision WorkStation T3400
    CPU:
    Intell Core 2 Duo CPU
    RAM:
    3.25
    Graphics:
    NVIDIA Quadro FX 1700 512 MB
    Monitor:
    Dell P2210 & Vo22L HDTV10A
    Using
    AutoCAD 2007
    Join Date
    Aug 2007
    Posts
    38

    Default new to lispsss, need a rewrite

    Registered forum members do not see this ad.

    This works good but, I would like to have the 2 objects rotate clockwise..not Counter clockwise

    (defun c:90R( / e f p a b c i)
    (vl-load-com)
    (setvar "cmdecho" 1)
    (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: "))))
    (setq f (vlax-ename->vla-object (car (entsel "\nSelect object: "))))
    (setq p (getpoint "\nSelect rotation point: "))
    (setq a 1 ; Number of revolutions
    b 1 ; Degrees per increment (must be a factor of 90)
    c 01 ; Delay between incremental rotation
    i 0) ;
    (if (= 0 (rem (setq d (/ 90 b)) -1))
    (while (< i a)
    (repeat d
    (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b))
    (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b))
    (vl-cmdf "delay" c "regen")
    )
    (setq i (1+ i))
    )
    )
    )

  2. #2
    Super Moderator Cad64's Avatar
    Computer Details
    Cad64's Computer Details
    Operating System:
    Windows 7 Profesional x64
    Computer:
    XI Computers
    Motherboard:
    Asus P8Z77-V Pro
    CPU:
    Intel Core I7 3770K 4.1 Ghz Quad Core 3rd Gen
    RAM:
    8GB DDR3 @ 1333MHz
    Graphics:
    Nvidia GeForce GTX 570 1280MB GDDR5
    Primary Storage:
    SATAII 500GB 7200 RPM
    Secondary Storage:
    Western Digital My Book Studio Edition II - 2TB capacity
    Monitor:
    HPf2105 21" LCD Widescreen & Cintiq 21ux
    Discipline
    Multi-disciplinary
    Cad64's Discipline Details
    Occupation
    Freelance Digital Artist
    Discipline
    Multi-disciplinary
    Details
    In a nutshell, I create 3D models from the client's CAD files or design sketches, which I then use to produce high quality rendered images. Click on the link in my signature to view my portfolio. I'm always looking for work, so let me know if you need any renders. :)
    Using
    3ds Max 2011
    Join Date
    Feb 2006
    Location
    Southern California
    Posts
    8,433

    Default

    You will get a better and faster response if you post in the correct area of the forum.

    Question moved to the Lisp section.
    "Work Smart, Not Hard"

    Click to View My Portfolio ( Updated 05/21/2013 ) --->
    http://www.rdeweese.com/

  3. #3
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Just change your angle to a negative number. Hell, make 180. -180.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  4. #4
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    djw
    Try to use # button to paste your code to be readable as a code

    Code:
    LIKE THIS
    Sorry for my English.

  5. #5
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,631

    Default

    Hi
    Here it goes,
    Code:
    (defun c:90R( / e f p a b c i)
    (vl-load-com)
    (setvar "angdir" 1)
    (setvar "cmdecho" 1)
    (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: "))))
    (setq f (vlax-ename->vla-object (car (entsel "\nSelect object: "))))
    (setq p (getpoint "\nSelect rotation point: "))
    (setq a 1 ; Number of revolutions
    b 1 ; Degrees per increment (must be a factor of 90)
    c 01 ; Delay between incremental rotation
    i 0) ; 
    (if (= 0 (rem (setq d (/ 90 b)) -1))
    (while (< i a)
    (repeat d
    (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b))
    (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b))
    (vl-cmdf "delay" c "regen")
    )
    (setq i (1+ i))
    ))
    (setvar "angdir" 0)
    )
    Regards
    Tharwat

  6. #6
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Check Red code
    Why did you select object 2 times (e and f)
    Code:
    (defun c:90R( / e f p a b c i)
      (vl-load-com)
      (defun *error* (msg)
       (and uFlag (vla-EndUndoMark doc))
       (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
           (princ (strcat "\n** Error: " msg " **")))
       (princ)
    )
    (setq OldCMDEcho (getvar "cmdecho") ; Save System Variable
      (setvar "cmdecho" 1)
      (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: ")))
              f (vlax-ename->vla-object (car (entsel "\nSelect object: ")))
              p (getpoint "\nSelect rotation point: ")
              a 1 ; Number of revolutions
              b 1 ; Degrees per increment (must be a factor of 90)
              c 01 ; Delay between incremental rotation
              i 0) ;
      (if (= 0 (rem (setq d (/ 90 b)) -1))
        (while (< i a)
          (repeat d
            (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b))
            (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b))
            (vl-cmdf "delay" c "regen")
            )
         (setq i (1+ i))
          )
        )
           (setvar "cmdecho" OldCMDEcho) ; restore System Variable
          (princ)
      )
    Sorry for my English.

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Why this?

    Code:
    (and uFlag (vla-EndUndoMark doc))
    Or was it just a copy/paste job from my code?
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  8. #8
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Seems like that but there was a code line I didnt paste.

    Code:
    (setq uFlag (vla-EndUndoMark doc))
    Any way welcome back
    Sorry for my English.

  9. #9
    Full Member
    Computer Details
    djw's Computer Details
    Operating System:
    Windows XP Professional 32 bit Service Pack 3
    Computer:
    Dell Precision WorkStation T3400
    CPU:
    Intell Core 2 Duo CPU
    RAM:
    3.25
    Graphics:
    NVIDIA Quadro FX 1700 512 MB
    Monitor:
    Dell P2210 & Vo22L HDTV10A
    Using
    AutoCAD 2007
    Join Date
    Aug 2007
    Posts
    38

    Default

    Thought I was post’n in the correct place? AutoCAD Forums> AutoCAD Customization> AutoLISP, Visual LISP & DCL
    Anyhow think U-all for the reply’s.. Alanjt (–180) seems to work,
    just try’n to learn, could you translate to plane English?
    (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b))


    “(vla-rotate e” =Selected object
    e



    “(vlax-3d-point p)”=get 3D x y z of Selected object
    e, what doses the “p” do?



    “(* (/ pi 180.0) b))”= ???? 180 = Counter clockwise
    -180 clockwise ??????

    ya I know just try’n to learn..

    Asos2000, object 2? Rotating two objects @ the same time..
    thanks again…

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by djw View Post
    “(vlax-3d-point p)”=get 3D x y z of Selected object
    e, what doses the “p” do?
    Read the help file on vlax-3D-point, it creates a variant ( 3-element array of doubles ) from the point 'p'.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Bookmarks

Posting Permissions

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