CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-15-2012, 01:15 AM
Maximus172 Maximus172 is offline
Registered User
 
Join Date: May 2007
Location: France
Posts: 52
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
but I have a error message

Quote:
Erreur LISP:
The function DEFINITIVE::WHILE is undefined.
Could you help me ?

Thanks in advance
Reply With Quote
  #2  
Old 10-15-2012, 08:45 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
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)
     )
....
You will also need to use "(sd-call-cmds ... " when doing any modeling operations, or the dialog will terminate.

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!
Reply With Quote
  #3  
Old 10-15-2012, 10:44 PM
Maximus172 Maximus172 is offline
Registered User
 
Join Date: May 2007
Location: France
Posts: 52
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
and it works well...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:33 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.