#1
|
|||
|
|||
While and loop
Hi,
I would like to use the loop "while". Is it possible with LISP language ? I have several parts to "punch" into a plate. The name are "---.1", "---.2". I suppose I can do a loop to do machining Code:
.... (emetteurs :title "Emitter per row" :value-type :integer :prompt-text "Quantity ?" );;emetteurs .... (setf drill 1) (while (<= nb_percage emetteurs) (setq nom_decoup (format nil "~A~A" "/part." drill )) (display nom_decoup) (paste_dia :tool nom_decoup ) (setq drill (+ drill 1)) );;while Quote:
Thanks in advance |
#2
|
|||
|
|||
Re: While and loop
Hi!
I believe that for what you want to do, the "dotimes" function will work very well (but note that it starts counting with zero, so we'll need to address that). The following code should do what you want: Code:
.... (emetteurs :title "Emitter per row" :value-type :integer :prompt-text "Quantity ?" );;emetteurs .... (dotimes (i emetteurs) ;; since "dotimes" starts counting with zero, add one to its value ;; when using it for the name (note: we don't actually change i ) (setq nom_decoup (format nil "~A~A" "/part." (1+ i))) (display nom_decoup) (paste_dia :tool nom_decoup) ) .... I hope this helps! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#3
|
|||
|
|||
Re: While and loop
Hi!
Thansks for your help. Yesterday, I found a solution : Code:
(let ((i 1)) (loop while (<= i emetteurs) do (setq nom_decoup (format nil "~A~A" "/part." i)) (paste_dia :tool nom_decoup) (incf i) );end loop ) ; end let |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|