CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 08-10-2009, 03:27 PM
HomeBrew_Nation HomeBrew_Nation is offline
Registered User
 
Join Date: Mar 2009
Posts: 25
Continue Dialog after action

Thanks for the help on my first lisp routine. Today a coworker of mine asked me "boy it would be great if there was a tool that had all of our material codes in a drop down list, so you could pick one and then assign the density for that material code, so that everyone would be using the same density, I replied, I programm lisp sehr gut und kann das, dass. An hour later, my second lisp program. My questions are:
1) How do I have the sd-defdialog continue after the O.K. button is pressed, deleting the set variables, but not terminating (grab my hand! ; arhhh ; I’ll be back) the command.
2) How do I set the units prior to the function, so that my density values in cubic inches are not applied to a model in mm/kg
Reply With Quote
  #2  
Old 08-11-2009, 12:37 AM
Michael Kahle's Avatar
Michael Kahle Michael Kahle is offline
Registered User
 
Join Date: Oct 2002
Posts: 121
Re: Continue Dialog after action

Maybe a construction with: ok-action-next-variable & sd-return-from-ok-action helps? Like this:
Code:
(oli::sd-defdialog 'test_ok_action
 :variables 
 '(
   (ok-action-done :initial-value nil)
   (Num1 :value-type :number)
   (Num2 :value-type :number  
            :toggle-type :invisible 
            :next-variable (when ok-action-done (sd-accept-dialog))
   )
 )
 :ok-action-next-variable 'Num2	
 :ok-action 
 '(progn
     (print (list Num1 Num2))
     (unless Num2 
	   (setq ok-action-done T)
	   (oli::sd-return-from-ok-action)
	 )
  )
)
__________________
Best regards,
Michael

--

Spam goes nospam@ptc.com and spam@postini.com

Last edited by Michael Kahle; 08-11-2009 at 10:53 PM.
Reply With Quote
  #3  
Old 08-11-2009, 12:39 AM
Michael Kahle's Avatar
Michael Kahle Michael Kahle is offline
Registered User
 
Join Date: Oct 2002
Posts: 121
Re: Continue Dialog after action

Does oli::sd-user-to-sys-units help? See ikit-documentation...

:length {NUMBER}
:area {NUMBER}
:volume {NUMBER}
:angle {NUMBER}
:mass {NUMBER}
:density {NUMBER}
__________________
Best regards,
Michael

--

Spam goes nospam@ptc.com and spam@postini.com
Reply With Quote
  #4  
Old 08-11-2009, 02:39 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
Re: Continue Dialog after action

Hi Michael,

don't you know about the BB code called [ code ] to post code? - edit your code posting and make it more readable, please!

BTW: you should not use oli::, with 2 : , and s_docu... is not supported!

Code:
(in-package :my-tools)
(use-package :oli)
(sd-defdialog 'test_ok_action
  :variables
  '(
    (ok-action-done :initial-value nil)
    (test1  :selection *sd-anno-view-seltype*)....
And why using an Annotation view here at all? That's confusing IMHO.
Reply With Quote
  #5  
Old 08-11-2009, 01:08 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Continue Dialog after action

Quote:
Originally Posted by HomeBrew_Nation View Post
Thanks for the help on my first lisp routine. Today a coworker of mine asked me "boy it would be great if there was a tool that had all of our material codes in a drop down list, so you could pick one and then assign the density for that material code, so that everyone would be using the same density, I replied, I programm lisp sehr gut und kann das, dass. An hour later, my second lisp program. My questions are:
1) How do I have the sd-defdialog continue after the O.K. button is pressed, deleting the set variables, but not terminating (grab my hand! ; arhhh ; I’ll be back) the command.
2) How do I set the units prior to the function, so that my density values in cubic inches are not applied to a model in mm/kg
In addition to the other suggestions already presented, you might consider having a "Next" button that will do what you need (NOTE -- code incomplete and untested!):
Code:
(in-package :my-tools)
(use-package :oli)
(sd-defdialog 'next-test
  :variables
  '(
    (mypart :value-type :part)
    (myvar1 :value-type :number)
    (myvar2 :value-type :number)
    ("-") ;; separator to make dialog look nice!
    (next :push-action
           (progn
             (function-to-process-vars)
             (setq myvar1 nil)
             (setq myvar2 nil))
          :next-variable mypart
        )
    ) ;; end of variables section
  :local-functions
  '(
    (function-to-process-vars ()
      ....
      )  
     ) ;; end of local-functions section
  ) ;; end of sd-defdialog
  :ok-action '(function-to-process-vars)
This method allows the user to input data, click "Next" and continue with the next part and/or values. If the user clicks OK, the function still does what it's supposed to do and then exits.

A different approach, but might work well for you...

Good luck!

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
  #6  
Old 08-12-2009, 06:30 AM
HomeBrew_Nation HomeBrew_Nation is offline
Registered User
 
Join Date: Mar 2009
Posts: 25
Re: Continue Dialog after action

I still cannot get it to work, the next button would be perfect, but it just ends the action.
here is what I have so far:


(in-package :my-package)
(use-package :oli)
(sd-defdialog 'JAD2-MATERIAL-DIALOG
:dialog-title "ASSIGN DENSITY"
:variables
'(
("SET UNITS TO INCH & LB")
("PART")
(vpart :value-type :part
:prompt-text "SELECT PART TO ASSIGN DENSITY"
:title "PART")
("MATERIAL")
(vmat :range (
;; update with spreadsheet
(0.264 :label "100 CAST IRON") ;; Engr Std
;; list continues with other values
)
:title "MATERIAL"
)
("-") ;; separator to make dialog look nice!
(next :push-action
(progn
(JAD2-MATERIAL-ACTION)
(setq vmat nil)
:next-variable vpart
))
) ;; end of variables section
:local-functions
'((JAD2-MATERIAL-ACTION) ()
(part_prop :the_part :start vpart :select_done
:display_ui :the_part
:base_density vmat )
) ;; end of local-functions section
:ok-action
'( JAD2-MATERIAL-ACTION)
)
Reply With Quote
  #7  
Old 08-12-2009, 06:52 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Continue Dialog after action

Just hint -- to make your code easier to read, wrap code tags around it...
Quote:
Originally Posted by HomeBrew_Nation View Post
I still cannot get it to work, the next button would be perfect, but it just ends the action.
here is what I have so far:
Code:
[snip]

    :local-functions
  '((JAD2-MATERIAL-ACTION) ()
    (part_prop :the_part :start vpart :select_done
               :display_ui :the_part
               :base_density vmat )
     ) ;; end of local-functions section
  :ok-action  '( JAD2-MATERIAL-ACTION)
 )
AHA! Here's where your problem is -- any time you call a modeling function (such as one you've recorded), you need to wrap the command in sd-call-cmds. Otherwise it will act as if you called the dialog by running it (which cancels any current commands). As a side note, you don't need the select start and end options when calling from a function. So in this case, you could use something like:
Code:
     :local-functions
    '((JAD2-MATERIAL-ACTION) ()
       (sd-call-cmds 
        (part_prop :the_part vpart 
                   :display_ui :the_part
                  :base_density vmat ))
     ) ;; end of local-functions section
However, you don't need the part_prop ui since you don't have any user interaction -- so in this case you can just use the function set_part_base_density like this:
Code:
     :local-functions
    '((JAD2-MATERIAL-ACTION) ()
       (sd-call-cmds 
        (set_part_base_density :parts vpart 
                               :dens (sd-user-to-sys-units :density vmat ))))
     ) ;; end of local-functions section
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
  #8  
Old 08-12-2009, 08:47 AM
HomeBrew_Nation HomeBrew_Nation is offline
Registered User
 
Join Date: Mar 2009
Posts: 25
Re: Continue Dialog after action

Thanks for the help, everything works just like it should.......
and now my next question.......which will start in a new thread,
thanks again.
Reply With Quote
  #9  
Old 08-13-2009, 05:11 AM
HomeBrew_Nation HomeBrew_Nation is offline
Registered User
 
Join Date: Mar 2009
Posts: 25
Re: Continue Dialog after action

I was a little premature in saying that my lisp works, in fact it doesent. I have two version, one I made with the recorder works fine V1, the other made with assistance from this forum, it runs, but does not change the part density. I could use some help debuging the lisp. I've included both of them for any assistance you can offer, thanks.
Attached Files
File Type: lsp MATERIALV1.lsp (1.7 KB, 274 views)
File Type: lsp MATERIALV2.lsp (2.1 KB, 286 views)
Reply With Quote
  #10  
Old 08-23-2009, 07:42 AM
MichaelA MichaelA is offline
Registered User
 
Join Date: Feb 2006
Location: Vancouver, WA USA
Posts: 40
Re: Continue Dialog after action

here is a dialog that does what you are looking for plus a little more. I've used it for years, does density, color (base or instance), and transparency. It doesn't have a next button but that would be nice, if you add it and get it working post it back please. Also if you have a bigger list of materials, please share.
Attached Files
File Type: lsp set_part_properties.lsp (5.3 KB, 320 views)
Reply With Quote
Reply

Tags
sd-defdialog


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

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 09:08 PM.



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.