(defun c:Cvm ()
(setvar "cmdecho" 0)
(vl-load-com)
(initget "Auto Man")
(if (= Design_System nil)
(setq Design_System (getkword "\nEnter the Program Operation...<Auto/Man>..."))
)
(if (= Design_System "Auto")
(AutoCV)
)
(if (= Design_System "Man")
(cord)
)
)
(defun AutoCV()
(setq n 0)
(while (< n 500)
(getpoint )
)
)
(defun Man()
(setq n 0)
(while (< n 500)
(getpoint)
)
)
I need to break the while loop and go back to the orignal program c:CVM and again enter my desire program how can i do that.
Thanks
@Kulfi wrote:
....
I need to break the while loop and go back to the orignal program c:CVM and again enter my desire program how can i do that.
....
Rather than go all the way back to re-start the whole CVM routine, you can have the option to switch to the other System within each System's sub-routine. [There may be a better way to run the function named for the chosen System option than (vl-catch-all-apply) that I don't know of.] Minimally tested:
(defun c:Cvm ()
(setvar "cmdecho" 0)
(vl-load-com)
(initget "Auto Man")
(if (not Design_System)
(setq Design_System (getkword "\nEnter the Program Operation...<Auto/Man>..."))
); if
;; (if (= Design_System "Auto")
;; (AutoCV)
;; )
;; (if (= Design_System "Man")
;; (Man)
;; )
;; instead of above two (if) functions [or a (cond) function], the following will read whatever option in and run that function:
(vl-catch-all-apply (read Design_System) nil)
)
(defun Auto (/ done pt);; changed from AutoCV to match option word above
(while
(and
(not done)
(not (initget "Man")); inside (not) because (initget) returns nil
(setq pt (getpoint "Pick Auto point or [Man] <exit>: "))
); and
(cond
((listp pt); User picked a point
;; (... do whatever you do with it ...)
); picked-a-point condition
((= pt "Man"); User entered option letter
(setq done T)
(Man)
); other-option condition
((not pt) (setq done T)); User hit Enter/space for done default
); cond
)
)
(defun Man (/ done pt);;;;; changed from AutoCV to match option word above
(while
(and
(not done)
(not (initget "Auto")); inside (not) because (initget) returns nil
(setq pt (getpoint "Pick Manual point or [Auto] <exit>: "))
); and
(cond
((listp pt); User picked a point
;; (... do whatever you do with it ...)
); picked-a-point condition
((= pt "Auto"); User entered option letter
(setq done T)
(Auto)
); other-option condition
((not pt) (setq done T)); User hit Enter/space for done default
); cond
)
)
>(defun AutoCV()
> (setq n 0)
> (while (< n 500)
> (getpoint )
> )
>)
(defun AutoCV (/)
(setq b "Specify first point: ")
(while (setq a (getpoint b))
(setq b "\nSpecify next point: ")
[process "a"]
);while
)
That way, if the user right-clicks or keyboard [Enter], the loop is broken.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
(initget "Auto Man")
(if (not Design_System)
(setq Design_System (getkword "\nEnter the Program Operation...<Auto/Man>..."))
)
(setq Pt1 (getpoint "\nPick the Starting identification Point : "))
;;;; How will i pass the PT1 value from here to another function if i use your advice, little change there.
(vl-catch-all-apply (read Design_System) nil)
)
@Kulfi wrote:
....
(setq Pt1 (getpoint "\nPick the Starting identification Point : "))
;;;; How will i pass the PT1 value from here to another function if i use your advice, little change there.
....
I'm not sure I understand the question. If you've saved Pt1 as a variable, as long as it is not localized within this routine, you can use it in other functions. Maybe it would be clearer if we saw what you would be doing with the points in your (Auto) and (Man) functions.