Jump to content

Use the result of a dialog box


---
 Share

Recommended Posts

Hello,

I'm looking for a solution to collect a value entered in a dialog box to use it in another line. Despite my searches in the forum and my knowledge of python not being good enough, I didn't find the solution. I can create a dialog box but not use its result.

Concretely, I want to display a dialog box which asks to enter the temperature of the room and a dialog box which asks for the reference of the part to be scanned and insert its values later in lines.

Concerning the requested temperature, I'd like to use it in the "measurement_temperature=20" line and replace the 20, for example, with the value entered in the dialog box:

gom.script.atos.set_project_settings (
    cut_out_background_points_automatically=True, 
    measurement_temperature= 20, 
    part_scanning_mode='single_part', 
    use_automatic_exposure_time_by_matrix=False, 
    use_gpu_acceleration=True)

Concerning the request for the part reference, I'd like to use it to export the STL and save the project automatically and change its name in the folder path by the reference entered in the dialog box. Here are the commands affected:

NAME TO CHANGE in red is the name I want to change from the value in the dialog box

gom.script.sys.save_project_as (file_name='C:/Users/user/AFFAIRES/AF231037/2 - Mesures/GOM/W1000720498-01/NAME TO CHANGE.ginspect')

gom.script.sys.export_stl (
    bgr_coding=False, 
    binary=True, 
    color=False, 
    elements=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts['Pièce'], 'explorer_category', 'actual_part']}), 
    export_in_one_file=True, 
    export_stages_mode='current', 
    file='C:/Users/user/AFFAIRES/AF231037/4 - Exports/MY/W1000720498_01/NAME TO CHANGE.stl', 
    length_unit='default', 
    set_stl_color_bit=False)

Attached you can find part of the script I'd like to use.

THANKS ! I hope I was clear enough!

Script test.txt

Link to comment
Share on other sites

Thanks! I missed this part !

So I had to use print(RESULT) and print(RESULT.whatisneeded) and use RESULT.whatisneeded where I need it and It works.

Link to comment
Share on other sites

 Share

×
×
  • Create New...