Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello!
We have a very large quantity of .mi files that have been created with Direct Modeling over the last years which contain tables with information about the drawn part. We would like to read this information to e.g. find all parts that share certain entries to find similar parts.
One idea was to parse the .mi file which contains all text in the file, but we don't know where this text is positioned on the drawing, so we can't interpret all these text-fields again as table where the relative position of the strings is crucial.
Is there a parser for mi-files that we could use? We found python-implementations for dxf or dwg, but so far nothing for .mi. It does not have to be python, any implementation would be great. If such a thing does not exist, is there a format-description so that we could implement it ourself?
Solved! Go to Solution.
Hello,
I do not know any MI parser and I think that solving your requirement should lead to a foundamental choice.
Basically, there are two ways to retreive informations from entities (texts, in your case) from MI drawings.
The first is with Drafting macros.
There are functions and commands which can give the text itself and other attributes such as position, colour, etc.
It is very easy to use and very safe as the reader is Drafting itself with the macros.
The second is, as you mentionned, an MI parser. The parser will be faster but more complicated to write.
And also, there can be changes in the MI format from one version of Drafting to the other, be aware of that. But the changes are compatible ascendant and very very rare as the MI format is very robust and very well organized (therefore not a big thing, but to be kept in mind).
The MI format description can be found from Drafting : Help > Mi In terface
Another way can be a mixt of both: retreive the text and attributes with macro and process them with any other language.
Finally, the choice between macros and MI parser depends mainly on the speed and ease of maintenance.
Examples can be seen on my web site http://kotom.eng.free.fr :
- Creating a csv file from a table of text is made with macros as it is quick (but there is no processing of the csv file afterwards as you require)
- cse: removing small elements can take hours if made by macros. This is why I made a MI parser and processor in C.
Hello,
I do not know any MI parser and I think that solving your requirement should lead to a foundamental choice.
Basically, there are two ways to retreive informations from entities (texts, in your case) from MI drawings.
The first is with Drafting macros.
There are functions and commands which can give the text itself and other attributes such as position, colour, etc.
It is very easy to use and very safe as the reader is Drafting itself with the macros.
The second is, as you mentionned, an MI parser. The parser will be faster but more complicated to write.
And also, there can be changes in the MI format from one version of Drafting to the other, be aware of that. But the changes are compatible ascendant and very very rare as the MI format is very robust and very well organized (therefore not a big thing, but to be kept in mind).
The MI format description can be found from Drafting : Help > Mi In terface
Another way can be a mixt of both: retreive the text and attributes with macro and process them with any other language.
Finally, the choice between macros and MI parser depends mainly on the speed and ease of maintenance.
Examples can be seen on my web site http://kotom.eng.free.fr :
- Creating a csv file from a table of text is made with macros as it is quick (but there is no processing of the csv file afterwards as you require)
- cse: removing small elements can take hours if made by macros. This is why I made a MI parser and processor in C.