[Hu...] Posted October 30 Share Posted October 30 Hello, I'm actually making a quick python script. I made a loop in the report pages to restore the 3D view. I need to create a list of elements which are visible in 3D view and only in the 3D view, of the restored report page. Then export the file. But When I record my script and press the list filter button, there is no way I can get the list of elements visible on the 3D view. This list should be a variable in my script like : gom.script.table.export_table_contents ( cell_separator=',', codec='utf-8', decimal_separator='.', elements= LIST OF ELEMENTS OF THE ACTUAL 3D VIEW INSIDE THE LOOP, file= 'D:/tmp/Sation/Pour_test/JOB173-24/Overview' + str(j) + '.csv', header_export=True, line_feed='\r\n', sort_column=0, sort_order='ascending', template_name='Overview', text_quoting='', write_one_line_per_element=False) Is there a function that gives the list of elements (surface deviation, min or max labels,...) visible in the 3D view ? Many thanks for your help and feedback. Kind Regards Hugues Link to comment Share on other sites More sharing options...
[Ti...] Posted November 7 Share Posted November 7 gom.script.table.export_table_contents ( cell_separator=',', codec='utf-8', decimal_separator='.', elements=[gom.app.project.inspection['100_PROF'], gom.app.project.inspection['101_TP'], gom.app.project.inspection['102_DIST']], file='C:/REPORT.csv', header_export=True, line_feed='\r', sort_column=0, sort_order='ascending', template_name='my_template', text_quoting='', write_one_line_per_element=False) I tried to do what you are doing and the problem with the above code is you need to replace all those features with a list. So how do you create a list from ONLY active features. I don't think you can. What we do is create separate report pages. For instance, our first piece will have all 100 dimensions on a report, then our in process will have only 60 dimensions on a separate report page. We tag the report pages differently....in the report page environment you can use the hotkey 'T' to tag it. I don't know you level of python knowledge, but you can then develop a script to pull the pdf tabled data into an excel file using pdfpumber(python library) and then export that data to a csv with the native csv library in python. Here is a link to my post about this...let me know if this interests you and I can elaborate more on how we export csv files for our first piece vs in process dimensions. https://qualityforum.zeiss.com/topic/3258-loop-to-capture-all-inspection-elements-in-a-list/?do=findComment&comment=8960 Link to comment Share on other sites More sharing options...
[Ju...] Posted November 11 Share Posted November 11 You can create a list of visible elements and export those elements with this code: import gom list_visible_elements=[] for element in gom.ElementSelection ({'category': ['key', 'elements', 'explorer_category', 'inspection']}): if element.is_visible: list_visible_elements.append(element) gom.script.table.export_table_contents ( cell_separator=';', codec='iso 8859-1', decimal_separator=',', elements=list_visible_elements, file='C:/Test.csv', header_export=True, line_feed='\n', sort_column=0, sort_order='descending', template_name='Overview', text_quoting='', write_one_line_per_element=False) Link to comment Share on other sites More sharing options...
[Ti...] Posted November 11 Share Posted November 11 Please sign in to view this username. Thanks for showing that...I don't need it anymore, but good to know you can get a python list of the visible elements. Might find a use for it in the future. Link to comment Share on other sites More sharing options...
[Hu...] Posted November 13 Author Share Posted November 13 Thanks all for your reply. Please sign in to view this username. Thanks for the link and your response. What I finally did, was a csv export for each report page. Made a script to concat everything in one file, then manage to avoid any duplicates elements into the final exports. But I'll look also the use of pdfpumber, to see how fast it is. Please sign in to view this username. Thanks also for your response. This is actually what I did in my script. But I had an issue : when you restore a 3D view from a report page, you can have elements that are active in the explorer but not seen in the 3D view, by a zoom for example. Thanks again for you help !!! Link to comment Share on other sites More sharing options...
[Ti...] Posted November 15 Share Posted November 15 (edited) Please sign in to view this quote. I just spent an hour trying to work thru this workflow, and realized I ran across this workflow before, but I stopped b/c the template_name we are using in many reports are different. When we began we were trying new things and maybe 20% of our programs are not using the same template name...that said, I may be able to make this work using the 'Overview' default template, b/c I can just rearrange the columns to my liking in the script. At the moment I am extracting the csv from the pdf, but my code is much longer than I like to accomodate variations in the pdf template outputs, column or row sizing and the occasional problem with a graph exporting into the template. I think I've got to the point where all the errors are handled, but I'd prefer getting some code in place to take me from 99% comfortable to 99.9%. For now, I'm extracting with pdfplumber, and as I said it seems to be working well, but I may try to to use the native csv export function soon. Appreciate the discussion. Edited November 15 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