I am preparing to do a project of mass data migration. The customer is about to send us some drawing files for us to use while we build a program to automate the migration process. Now, I am trying to figure out a way to automate the process of opening the drawing file, exporting the strings/tabular note cell/ title block or whatever you might call it as well as any additional data. I can then use this information to mass import as datasets under their respective item types. Honestly, I dont even know if this is possibe. Any thoughts or words of encouragement on the subject would be much apprecieted.
It should be possible, the issue will be "how difficult will it be"
- If all the info you are looking for is in "titleblock" objects, it should not be too hard. (or if it has specific entity names or attributes)
- If the info is scattered all over the drawing, and on different places on each drawing, it will be much more difficult.
But you can read every piece of text on a drawing (including dimensions, note, labels, tabular notes, etc.) without too much trouble. There are even calls to get the "displayed" text e.g. if expresions or attributes are referenced in the text) - search for examples in the Solutions Database:
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
To get the text as shown on the drawing, rather than a reference to an attribute or expression, use the .GetEvaluatedText method. An example can be found here:
A while back I wrote some code to find the titles of our old drawings. The title blocks on these drawings were made with lines (as opposed to using tabular notes) and the title note was located somewhere within the area dedicated for it. Fortunately for me, the title block remained pretty consistent over the years. What I did was open an old drawing of each sheet size and noted the size/location of the drawing title entry area. Then in my code, I queried the sheet size and iterated through all the note objects; if the annotation origin was within the rectangular title area, I assumed that I had my title note. There were a few oddballs that I had to open and inspect manually, but by and large it worked pretty well.