#1
|
|||
|
|||
Lisp Code
I am trying to make a dialog that will facilitate making the Contents ID the same as the part name.
The below code works, but needs refinement. Would someone help me w/: How do I execute the "(sd-call-cmds (change_pa_id a-part new-name)" w/ my 'Next' button and keep the dialog up? I have never written LISP before, so any other suggestions are welcomed. Thanks, (in-package :vicor) (use-package :OLI) (sd-defdialog 'Change_CID :variables '((A-PART :title "Part" :value-type :part-incl-new :after-input (setq new-name (sd-inq-obj-basename a-part))) (NEW-NAME :title "New CID" :value-type :string :initial-value (sd-inq-obj-basename a-part)) (NEXT :toggle-type :grouped-toggle :title "Next" :push-action (display "do IT again"))) :ok-action '(sd-call-cmds (change_pa_id a-part new-name))) |
#2
|
||||
|
||||
Hi, I put the main action into a local function, which is called when pressing NEXT and OK. I only *wrote* it. It's not tested!
Last edited by Wolfgang; 09-19-2003 at 04:05 AM. |
#3
|
|||
|
|||
Thanks Wolfgang! This works great. Anyone interested in making this thing loop thru all of the parts in an assembly???? MikeB VIcor corp Andover, MA USA |
#4
|
|||
|
|||
I have modified it further and made it do a list of renames from a selection recursively top down.
I stole 90% of the code from this forum. The problem w/ it now is it won't handle a list of 1. I cannot select a single part. Also, no error checking. Anyone???? |
#5
|
||||
|
||||
Hi Mike,
use: :value-type :part-incl-new :multiple-items t and then a dolist as you did. use the normal UI for selection then.. instead of first select an assembly and then doing a second selection of the parts itself. If you have selected a single part your (get_selection ... :in_assembly a-part) is empty.. therefore nothing happens. |
#6
|
||||
|
||||
(some-parts
:value-type :part :multiple-items t :modifies :contents .. ) would help to avoid select read-only parts |
#7
|
|||
|
|||
Wolfgang,
Thanks for looking at this again ! When I try to implement your suggestions I get an error when I OK the dialog. "input contains element of wront type" I get this erro w/ a single part or a list. Prior to these last changes the script would allow me to select an assy (push the dialog part button and double click the assy in the struct browser) and it would put the parts of the assy into a list and modify each. The proplem there was I could not only select a single part or select a list of parts, it needed to be an assy. I would like to be able to pick an assy or make a list of parts or pick 1 part. Is that possible? Is that what you have suggested? Am I confused? probably yes to all of these. Thanks, Mikeb |
#8
|
||||
|
||||
Modified Lisp code
Hi,
I've changed it again, it now allows you to select an assembly or a single part. Also when a part is read-only it is being skipped. Goodluck with it |
#9
|
||||
|
||||
Hi,
When uploading the my first change to your lisp file. I start reading what you wrote. I should have done that first :-) So, I forgot to build in that you would like to select multiple assemblies and/or parts. So the attached lisp file is now taking care of this. Goodluck again. John |
#10
|
|||
|
|||
Thanks John,
I'll give it a try. |
#11
|
|||
|
|||
YUP thats it.
Thanks Wolfgang / John. That was a lot of help. Mike Boswell Vicor Corp Andover MA ps John do you remember doing some consult here? ~4 yrs ago, BIG snow storm? |
#12
|
||||
|
||||
Hi Mike,
How could I forget? No power for more than a day, dark cold and candles in the Hotel. This was one of the trips a tell about at parties ;-) Any way, I hope the lisp file is of any use for you and if you need more help just drop me an email. Cheers, John |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|