Trouble in rotate

Discussion in 'AutoCAD' started by Adesu, Oct 27, 2004.

  1. Adesu

    Adesu Guest

    Hi Alls,my question I think easy for solve,but for me not yet find to fix
    it,the problem at "rotate",can you check what wrong in my code?

    ; a2z is stand for edit angle line to zero
    ; Design by Ade Suharna <>
    ; 27 October 2004
    ; Program no.125/10/2004
    ; Edit by
    (defun rtd (a)
    (* 180.0 (/ a pi)))
    (defun c:a2z (/)
    (setq oldangdir (getvar "angdir"))
    (setvar "angdir" 1)
    (setq ent (entget (car (entsel "\nSELECT A LINE: ")))
    info10 (cdr (assoc 10 ent))
    info11 (cdr (assoc 11 ent))
    ang (rtd (angle info10 info11)))
    (command "_rotate" ent "" info10 "" "r" ang 0 "")
    (setvar "angdir" oldangdir)
    (princ)
    )
     
    Adesu, Oct 27, 2004
    #1
  2. Adesu

    moshe Guest

    Adesu, hi

    Your problem is the vairables name, No space is allowed!

    Good Luck

    Moshe
     
    moshe, Oct 27, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi moshe,
    Command: 'VLIDE
    SELECT A LINE: Unknown command "VLIDE". Press F1 for help.
    Unknown command "R". Press F1 for help.
    51.336952
    after this compu hang (as like wait).
     
    Adesu, Oct 27, 2004
    #3
  4. Adesu

    moshe Guest

    Hi

    I don't get this, which AutoCAD version you got?
    your code is pure AutoLISP (not VisualLisp) you don't need VLIDE at all.

    Moshe
     
    moshe, Oct 27, 2004
    #4
  5. Adesu

    moshe Guest

    Hi

    Here is the correction to your code, it's now working prefect

    (defun c:a2z (/ oldangdir ent e info10 info11 ang) ; corrected
    (setq oldangdir (getvar "angdir"))
    (setvar "angdir" 1)
    (setq ent (car (entsel "\nSELECT A LINE: ")) ; corrected
    e (entget ent) ;
    added
    info10 (cdr (assoc 10 e)) ; corrected
    info11 (cdr (assoc 11 e)) ; corrected
    ang (rtd (angle info10 info11)))
    (command "rotate" ent "" info10 "r" ang 0) ; corrected
    (setvar "angdir" oldangdir)
    (princ)
    )

    Good Luck

    Moshe
     
    moshe, Oct 27, 2004
    #5
  6. Adesu

    BillZ Guest

    As far as I can tell you don't need to mess with the angidr:

    (defun rtd (a)
    (* 180.0 (/ a pi)))

    (defun c:a2z (/)

    (setq ent (car (entsel "\nSELECT A LINE: "))
    info10 (cdr (assoc 10 (entget ent)))
    info11 (cdr (assoc 11 (entget ent)))
    ang (rtd (angle info10 info11))
    )
    (command "_rotate" ent "" info10 "r" ang 0)
    (princ)
    )


    Bill
     
    BillZ, Oct 27, 2004
    #6
  7. Adesu

    Jimmy D Guest

    Hi Adesu,
    I think you've got some things confused. Here's how it should be:

    (defun rtd (a)
    (* 180.0 (/ a pi)))
    (defun c:a2z (/)
    (setq oldangdir (getvar "angdir"))
    (setvar "angdir" 1)
    (setq EE (entsel "\nSELECT A LINE: ") <-------------
    ent (entget (car ee))
    info10 (cdr (assoc 10 ent))
    info11 (cdr (assoc 11 ent))
    ang (rtd (angle info10 info11)))
    (command "_rotate" EE "" info10 "r" ang 0 "") <-----------
    (setvar "angdir" oldangdir)
    (princ)
    )
     
    Jimmy D, Oct 27, 2004
    #7
  8. Adesu

    Adesu Guest

    HI moshe,BillZ and Jimmy D,thanks a lot for your advice and help,I think the
    problem on
    "(setq ent (entget (car (entsel "\nSELECT A LINE: ")))",select object for
    rotate command only work if user use "(setq ee (entsel "\nSELECT A LINE: ")
    ",my question is why "(setq ent (entget (car (entsel "\nSELECT A LINE:
    ")))"not valid for input object? any expert help to inform this issue.
     
    Adesu, Oct 28, 2004
    #8
  9. Four left parentheses, three right parentheses.

    --
    Kent Cooper, AIA


    ...
    .....
     
    Kent Cooper, AIA, Oct 28, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.