With so many developers contributing towards Automation, most of the general requirements are available as ready-made software. In spite of the availability of such ready tools many a times there is a requirement for specific automations. There are also solutions available for such requirements.
All the popular CAD Packages and Excel offer a facility to automate the drawing generation and Excel editing with simple programming. There is no need that a full time developer has to work on such requirement. Any one with fair amount of computer knowledge and little bit of training on these subjects will be able to develop small macros for small automation requirements.
All popular applications allow users to develop code in multiple ways. For Example, in AutoCAD Applications can be written in either C++ , Visual Basic, AutoLisp, .Net Etc. Most popular among them being AutoLisp.
Similarly, in Excel Automation can be done with Visual Basic, .Net, Etc. Popular among them is Visual Basic.
Following is a simple AutoLisp program, which can elevate selected texts as per the elevation in the selected Text. In base CAD Package there is no facility to Elevate texts as per the elevations.
Let us say you have 20 Text Entities in your drawing with different elevation say 100,23, 99.67, 101.35 etc. If you require to bring these texts in 3D then you will be required to select each text individually and changing the elevation of each text. This will consume a lot of time while editing a drawing.
Same thing can be done quickly when a Lisp is written specifically for such requirement is available. Few lines of code have to be as given in example below and has to be saved as Lisp file (Plain Text File with .LSP Extension). If this program is loaded in AutoCAD with ‘Appload’ Command then just by Typing ‘ETXT’ at the command prompt and selecting required texts, such texts can be elevated as per the elevation in the text.
(setq txtset(ssget (list (cons 0 “text”))))
(setq setlen(sslength txtset))
(setq ctr 0)
(setq ent(ssname txtset ctr))
(setq entl(entget ent))
(setq txtv(atof (cdr (assoc 1 entl))))
(command “._Change” ent “” “p” “Elev” (rtos txtv 2) “”)
(setq ctr(1+ ctr))
(princ “\ntype \”ETxt\” to change elevation of selected Texts as per Caption in the Text.”) (princ)
Many a time such codes are available freely on Internet. Only important thing about such free lisp is that normally developers won’t take any ownership of such codes and it may not be extensively tested and hence may not work in all the cases.
Similarly, we can also automate Excel with Excel Macro. You may be aware that in Excel, decimal places of given number can be easily changed. If you have a cell value as 3.456 if you set number of decimals to 2, then excel will show the cell as 3.46 where as for all calculation purpose it will consider 3.456 only. To avoid such difference you may have to round the cell value by putting Round Function. Following Example is simple set of code written to convert a number into 2 Decimal places, to avoid using any other function.
Dim curC As Range
For Each curC In Selection
curC.Value = Format$(curC.Text, "0.00")
Other then programming, Popular applications allow you to Customize application as per your requirement. For example, in AutoCAD you can add you own Line type. In Excel you can define your own Style to represent a number. Little bit of effort needs to be put in to understand such flexible tools that your applications have given. One time effort in Learning them, may save a lot of valuable time when working with those applications.