[Jo...] Posted August 17 Share Posted August 17 Hello, I'm trying to read the stage specific keyword the script only gives the value for the first stage. The code I'm using gom.app.project.in_stage[idx].get('user_keyword') To get the index I'm using gom.app.project.stages['stage_name'].index But this give always 0 as result, no matter what I'm doing. I used this https://zeiss.github.io/zeiss-inspect-app-api/2026/howtos/project_keywords/project_keywords.html as reference. What am I doing wrong? Or is it a bug. Zeiss inspect version: 2025.4.0.398 [531c6a7c425a] Thanks for the help. Link to comment Share on other sites More sharing options...
[Ma...] Posted August 18 Share Posted August 18 Are you iterating through stages or you are using fixed stage_name? I think you can also iterate through stages like this for stage in gom.app.project.stages: gom.app.project.in_stage[stage.index].get('user_keyword') #another approach ( hopefully correct ) for i in range(0, len(gom.app.project.stages)): gom.app.project.in_stage[i].get('user_keyword') you can access stages like this ( if there are usefull things ) gom.app.project.stages[1] Link to comment Share on other sites More sharing options...
[Jo...] Posted August 19 Author Share Posted August 19 There is a difference between gom.app.project.in_stage and gom.app.project.stages The first one only takes the enabled stages into account, while the second has all stages. I have to create an index list for the enabled stages and find the index in this list for further usage. Or is there another method available? Johnny Link to comment Share on other sites More sharing options...
[Ma...] Posted August 19 Share Posted August 19 I believe you can see if is this stage enabled, but i'll try to look at it tomorrow at work. So your intent is what? Only reading of enabled stage keyword from report header? Link to comment Share on other sites More sharing options...
[Jo...] Posted August 19 Author Share Posted August 19 in this specific situation I want to use the content of the keyword to create a file name for PDF export of the report. Thanks for your help. Link to comment Share on other sites More sharing options...
[Ma...] Posted August 19 Share Posted August 19 I am using own dialog form in python to fill header, store measured data, make pdf ( ask to store and continue if it's with errors - not calculated and so on ), export qdas. I have in queue a program for 3 parts in one scan - using built-in function for that is not good - seems like you have to copy whole program for every part, which seems bad for changes of a program - so i'll do that with python to separate each scanned part from mesh and make stages. So i'll be doing almost same thing as you 🙂 Link to comment Share on other sites More sharing options...
[Ma...] Posted August 20 Share Posted August 20 (edited) Hi, so to obtain only valid data ( excluding disabled stages ) i use this for stage in gom.app.project.stages: if stage.is_active: try: print(stage, gom.app.project.in_stage[stage.index].get('user_qdas_kk1041')) except: print('Non existent keyword') For assigning keywords there is another approach using gom.script.sys.set_project_keywords ( keywords={ 'qdas_k1041' : '123456', ...}, keywords_description={ 'qdas_k1041' : 'Part drw. number', ...}) Edited August 20 try-except Link to comment Share on other sites More sharing options...
[Jo...] Posted August 20 Author Share Posted August 20 Indeed I do something similar. And could improve my method by storing the index of the active stage in this list. Link to comment Share on other sites More sharing options...
[Ma...] Posted August 20 Share Posted August 20 (edited) If you need a script for active stage and not for enabled/disabled, then change condition # previously getting all from active stages if stage.is_active: #only from selected stage ( clicked ) for stage in gom.app.project.stages: try: if stage.name == gom.app.project.get('stage.name'): print(gom.app.project.in_stage[stage.index].get('user_qdas_k1041')) except Exception as e: print(e) print('Non existent keyword') Edited August 20 tested code Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in