Jump to content

ASCII import template extension


Recommended Posts

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
https://qualityforum.zeiss.com/topic/500-ascii-import-template-extension/
Share on other sites

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

×
×
  • Create New...