wujianming / acronymMaker

Python script for making acronyms from a dxf file using a python dictionary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

This project is one the beauties in the world that saved me a lot of time. The story is that when you want to program a controller or in other words an industrial cpu (PLC) you should map each variable on it. For mapping the variables you should use a framework (in my case) that's called Niagara NX @tridium and you should write the register address and its name. For example you might want to map the DO1 (which stands for the pin digital output 1) as a Heat pump comand. Sometimes those names are too long and it's not standard to write all of the name. Because on a long term period it may create anomalies for saving the historical data on the local and cloud databases. As an example we might have a variable whose name is "Scattato Termico Pompa Scambiatore Preparatore ACS 2 (QECI+ACS) ". In this case it's inappropriate to save a pin as this long name.

So what will you do ?
YOU WILL MAKE AN ACRONYM FOR EACH NAME

So you should look at the original electrical scheme, think about acronyms for each name and write it manually on the framework. As an example, for that long name above, you should think about an acronym like : QECIACS_ACS2_PmpScambPrep_ScatTerm and write it on the specific register as its name. It's notable that these acronyms have an standard and each company has its own standard. But the problem is that you should pick each name from the electrical scheme manually, think about its acronym and write that manually on the program. This takes so much time and time means money for a company 😄.

As you can see that's an algorithmic problem and it might be resolvable by a computer. So what i've done recently is that I made a program which takes an electrical scheme as a dxf (a CAD format) file and gives a list of acronyms for each pin name.

Implementation

It reads a dxf file with ezdxf library, searches for a specific style format (in this case ROMANS style) and format each word. Then it looks on a predefined python dictionary and gets acronyms for each word. In the end it concatenates each word for making the acronym of the original word. Every word which is not in the dictionary file, gets shortened by a prefixed length. One thing that you should do before running the program is to change the wanted words style to the ROMANS style on the dxf file (You can do it with Autocad).

On the picture above you can see the highlighted words that need to have ROMANS style in order to be selected.

Contribution

You might want to see the issues if you'd like to contribute to this project but I'll be happy if you have any ideas and you'd like to contribute.
Feel free to ask any questions that you might have on this project.

About

Python script for making acronyms from a dxf file using a python dictionary


Languages

Language:Python 100.0%