Is there a way to link text in a .txt file into a note on a drawing?


(Other Bruce) #1

Our G-code is pretty simple, and we put it on the face of the drawing so the machinist can scan for issues and generally criticize as he finds appropriate. I write the code in NotePad++ and save it as a .TXT or .PGM file. What sorcery would it take to populate my note with this live info (that would magically update when the program is updated)?

Thanks in advance!
OB


(Ben Haycraft) #2

Hello,

You could use the following Python script to either read or write to a file while interfacing with the notes in a 3dm file.

This will read a text file and then combine append whatever is in the txt file to the current notes of the 3dm. It will then write the combined notes to a new file.

You will need to edit the following paths and point them to your files.

with open(r'C:\Users\Ben Haycraft\Desktop\sfdg.txt', 'r') as myfile:

with open(r'C:\Users\Ben Haycraft\Desktop\new text file.txt', 'a') as myfile:

FileToNotes.py (528 Bytes)
(updated error that occurred if current 3dm didn’t contain any notes)

You could also bind it to a shortcut key to run it on the fly.

-RunPythonScript "C:\Users\Ben Haycraft\Desktop\FileToNotes.py"

If you only wanted to only read or only write, you could remove the parts of the code that read or write.

Hope this helps.

-Ben


(Other Bruce) #3

WOW! Thanks Ben! I am anxious to give this a try!