[Jo...] Posted October 27, 2021 Share Posted October 27, 2021 Hello, Is it possible to extend the ASCII import template? I have a CSV file with the nominal data of point (element identifier, name, x-coor, y-coor, z-coor, x-tol, y-tol, z-tol, (other options for other elements), description, page_nr, ...) The description and page_nr I would like to save in element keywords. Would it be possible to do this by extending the ASCII import template? Are there some leads which might help me doing this in python? Thanks in advance. Link to comment Share on other sites More sharing options...
[Da...] Posted October 27, 2021 Share Posted October 27, 2021 Hello Johnny Geling, I would suggest to first import the elements without the keywords with a normal ascii import. Then you could use the csv module (https://docs.python.org/3/library/csv.html) and read in the file with for example csv.DictReader. Now get the keyword values from the csv file and use "gom.script.cad.edit_element_keywords" to add the keyword to the element. Everything above can be bundled in a single script. You could even use our dialog tool to ask for the file path in the beginning. For this right click in the script editor -> Insert -> Dialog.... Does this help or do you need a more in depth python example. Regards Daniel Schrein Link to comment Share on other sites More sharing options...
[Jo...] Posted October 27, 2021 Author Share Posted October 27, 2021 Dear Daniel, I have a script like this. Maybe I can update that one with your suggestion of the csv.DictReader. Wouldn't it be possible to merge this into the ascii import, by extending the import class. Regards Johnny Link to comment Share on other sites More sharing options...
[Da...] Posted October 27, 2021 Share Posted October 27, 2021 Dear Johnny, right now there is no plan to integrate keywords to the ascii import. But I will create an Issue for future improvements. Regards Daniel Schrein 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