BlackBox Posted May 25, 2012 Share Posted May 25, 2012 For fun: (defun c:FOO ( / *error* _GetAngle _Nomutt ) (vl-load-com) (defun *error* (msg) (and oldNomutt (setvar 'nomutt oldNomutt)) (and oldOsmode (setvar 'osmode oldOsmode)) (if acDoc (vla-endundomark acDoc)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it (princ)) (defun _GetAngle ( basePoint / opt ) (initget 128 "Point") (if (or (setq opt (getkword "\nEnter an angle in degrees [Point] <Point>: ")) (setq opt "Point")) (cond ((= "Point" opt) (if (and (not (initget 32)) (setq anchorPoint (getpoint basePoint "\nSpecify angle by point: "))) (* 180.0 (/ (angle basePoint anchorPoint) pi)))) ((atof opt))))) (defun _Nomutt ( on / ) (if on (setvar 'nomutt 0) (setvar 'nomutt 1))) ((lambda ( acDoc oldNomutt oldOsmode / ss basePoint ang ) (if (and (setvar 'osmode 5) (princ "\nSelect object(s): ") (_Nomutt nil) (setq ss (ssget "_:L")) (_Nomutt T) (setq basePoint (getpoint "\nSpecify base point: ")) (setq ang (_GetAngle basePoint))) (progn (_Nomutt nil) (vla-startundomark acDoc) (terpri) (initcommandversion 1) (vl-cmdf "._array" ss "" "C" basePoint ang "-360" "Y") (*error* nil)) (cond (basePoint (*error* "No angle specified")) (ss (*error* "No base point specified")) ((*error* nil))))) (vla-get-activedocument (vlax-get-acad-object)) (getvar 'nomutt) (getvar 'osmode))) Quote Link to comment Share on other sites More sharing options...
pBe Posted May 26, 2012 Share Posted May 26, 2012 It is working excellent thanq verymuch,i have onemore doubt if i want the input as only number of lines and not the angle,what i have to do??Thanks You are welcome aswini: (defun c:FunArray (/ ss bp op) (setq val (mapcar '(lambda (v) (getvar v)) (list 'Cmdecho 'Osmode))) (cond ((and (princ "\mSelect Objects to array: ") (setq ss (ssget)) (setvar 'osmode 5)(setvar 'cmdecho 0) (setq bp (getpoint "\nPick Base point:")) (setq ang (cond ((getangle (strcat "\nEnter Angle <" (angtos (setq ang (cond ( ang ) ( 0.0 ))))">: " )))( ang )) )) (initcommandversion 1) (command "_array" ss "" "C" bp (/ (* ang 180.0) pi)(progn (setq op (getint "\nNumber of Items: [Enter for 360 fill]: ")) (if op op "-360")) "Y") )) (mapcar '(lambda (v y) (setvar v y)) (list 'Cmdecho 'Osmode) val) (princ) ) @pBe , You are changing the OP osmode settings without re-set them back with (setvar 'osmode 5) I'm lazy that way tharwat. For fun: Its giving odd results when using "point" option. me thinks Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 26, 2012 Share Posted May 26, 2012 Its giving odd results when using "point" option. me thinks Hrmmm... That must be due to my only testing the routine in WCS, with Plan=World. I also neglected to TRANSlate the point(s). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.