4.0.0029

There appears to be aproblem with the "getangle" command in lisp files. Several of my lisp scripts no longer work as expected. For reference, following is a lisp I use a lot that no longer works correctly.;Angle array routine.(defun C:AAR ( / ss ang bp cnt dist d) (cond ( (setq ss (ssget)) (initget 1) (setq bp (getpoint "\nBase point: ")) (initget 1) (setq ang (getangle bp "\nArray direction: ")) (initget 7) (setq dist (getdist "\nDistance between objects: ")) (initget 7) (setq cnt (getint "\nNumber of objects: ")) (setq d 0.0) (setvar "cmdecho" 0) (command ".undo" "_g" ".copy" ss "" "m" bp) (repeat (1- cnt) (command (polar bp ang (setq d (+ d dist))))) (command "" ".undo" "_e") ) ) (princ))

Comments

  • Are you sure it isn't the cond that is giving you trouble. By deleteing it, things seem to work as I would expect it. Without deleting the cond statement, I have to select the entities twice, then it works. Below is what works as expected here.(defun C:AAR ( / ss ang bp cnt dist d)(setq ss (ssget))(initget 1)(setq bp (getpoint "\nBase point: "))(initget 1)(setq ang(getangle bp "\nArray direction: "))(initget 7)(setq dist(getdist "\nDistance between objects: "))(initget 7)(setq cnt (getint "\nNumber of objects: "))(setq d 0.0)(setvar "cmdecho" 0)(command ".undo" "_g"".copy" ss "" "m" bp)(repeat (1- cnt)(command(polar bp ang (setq d (+ d dist)))))(command "" ".undo" "_e")(princ))

  • It also seems to work with if and progn rather than cond.(defun C:AAR ( / ss ang bp cnt dist d)(setq ss (ssget))(if ss(progn(initget 1)(setq bp (getpoint "\nBase point: "))(initget 1)(setq ang(getangle bp "\nArray direction: "))(initget 7)(setq dist(getdist "\nDistance between objects: "))(initget 7)(setq cnt (getint "\nNumber of objects: "))(setq d 0.0)(setvar "cmdecho" 0)(command ".undo" "_g"".copy" ss "" "m" bp)(repeat (1- cnt)(command(polar bp ang (setq d (+ d dist)))))(command "" ".undo" "_e")))(princ))

  • The revised lisp files fix the need to reselect the items, however the array still goes off in the wrong direction. This only happens when working on existing drawings. The lisp works fine with a "new" drawing created with 4.0. It appears that the array goes off at a mirror image of the direction selected based on the X axis. In other words if the array direction is selected using a line going dow to the right at a 30 degree angle, the actual array created will be draw going up at a 30 degrees angle. Is there is some setting in Icad 4.0 that would cause this type of behavior?

  • I found the problem. I have always set my angles to be measured clockwise using the "units" command. This did not cause a problem in previous Icad versions. However with 4.0 apparently the direction must be set to counterclockwise, at least for this lisp. I changed my default setup script to set the angles for counterclockwise and the angle array lisp works great now. Thank you for the assistance and the revised lisp code, it actually works much better than before!

  • How about using getorient instead of getangle? That way it doesn't matter how you set angular direction or angle base.(getorient bp "\nArray direction: "))The second routine I posted is the only one of the two that disallows a nil selection set.Cheers,Bryan

This discussion has been closed.