First of all: welcome on CAD.DE Miquel

When reading your post I thought somehow the UI of your dialog does not do what you expect and is loosing, e.g. it's ranges.
But based on the part of the code you marked (!!! great idea and thanks for that !!!) it looks the dialog's UI is fine, but attaching the material is somehow failing.
Basically you are using 'oli::sha_basic_attach_material' . How to know the correct syntax?
Pointer1: use the online reference. Start Modeling and your Modules. Type into the Modeling command line:
Code:
(oli::sd-online-reference)
=> there will be new button in the toolbox showing a on-the-fly-generated HTML page with a lot of details on dialogs.
if you like to use your prefered browser look in your %TEMP% dir for the file 'online_reference.html'. The file still exist, even when ending your modeling session.
'sha_basic_attach_material' is pointing to a subaction 'sha_attach_material_subdialog'. That one does the real job.
Pointer2: TRACE the function you like to 'debug'. Best: start Modeling with the start-parameter '-v' to open the console directly. After starting your modules, type into the Modeling command line::
Code:
(oli::sd-show-console-window) ;; if not started with '-v'
(trace
oli::sha_basic_attach_material
oli::sha_attach_material_subdialog)
...before the action you like to do. That way you can watch which kind of Parameters a function gets as input and what it does return. Use your own add on with just one part selected.
e.g.
Code:
(trace oli:sd-num-to-string)
(oli:sd-num-to-string pi)
(oli:sd-num-to-string (/ 1 7.0))
(untrace oli:sd-num-to-string)
Output will look like
Code:
1> (OLI:SD-NUM-TO-STRING 3.1415926535897931)
<1 (OLI:SD-NUM-TO-STRING "3.141593")
Pointer3: by tracing you can see what the actions get. What does happen when you call it directly, or e.g. via copy and paste into the command line?
Code:
(oli::sha_basic_attach_material :sheet_part (oli:sd-inq-curr-part) :yes
:material "AL083" :yes :thickness 2.5 :yes)
I am quite in doubt about all the :YES in your code. They are normally for confirmations popping up.
Remove those one by one.
The material does not have a check at all (and therefore no confirmation). I would shoot on that one.
Code:
(oli::sha_basic_attach_material :sheet_part (oli:sd-inq-curr-part) :yes
:material "AL083" :thickness 2.5 :yes)
Pointer4: sd-call-cmds does have some good options! Specially for error handling!
We recently have had that topic => https://ww3.cad.de/foren/ubb/Forum29/HTML/004994.shtml#000003 Have a look also to the demo-case I created https://ww3.cad.de/foren/ubb/uploads/der_Wolfgang/cadde-29-004994.lsp.
In the failure case the error is inquired with '(sd-inq-error-obj :all)' and printed to console.
means: extend your sd-call-cmds construct:
Code:
(sd-call-cmds (oli::sha_basic_attach_material :sheet_part part :yes
:material test_real_code :yes
:thickness test_thickness :yes
)
:failure (progn ;; Achtung! mal ohne quote hier! ;; new code
(pprint "my-risky-function call: HOUSTEN we have a Problem") ;; new code
(format T "~&~{~%* [[~S]]~%~%~}" (sd-inq-error-obj :all)) ;; new code
(setq call-result :housten-there-is-a-problem) ;; new code
:bad ;; new code
) ;; new code
)
Please help:
Zitat:
Original erstellt von mike100X:
the part — and the whole session's material list for new parts — always falls back to a generic default, until Creo is restarted.
That's the part I hardly understand. "the whole session's material list for new parts"
Sorry I don't get it . Explain! Please use six short clear sentences instead of one long one.
Where it the list, what kind of default, how does it look like?
BTW: if, for understanding the problem the logical table's content is needed. Create a small one with just 3 hardcoded lines inside. A display-table is not needed at all (for that).
==================================================
and for increasing your LISP skills here is a variant of one of your local functions:
Code:
(rbt_test_families ()
(if (sd-logical-table-p "COMPANY-SHEET_METALS")
(let (all-families one-fam)
(dotimes (row-num (sd-get-logical-table-number-of-rows "COMPANY-SHEET_METALS"))
(when (setq one-fam (getf (sd-read-logical-table-row "COMPANY-SHEET_METALS" :row row-num) :MAT_ID))
(pushnew one-fam all-families :test 'equal) ;; test if its already in the list, if not add it
)
)
(sort all-families #'string-lessp)
)
nil
)
)
at least the 'pushnew' you might wanna take over
------------------
● Firefox ESR ● Java Forum Stuttgart JUGS ● OSD Hilfeseite (de) / help page (en) ● NotePad++ ● BuFDi ●
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP