Do you use the 'Copy And Paste' functionality in the software you use? Obviously, everybody does that! But that is not the real question.
When you copy something from a document and paste it into another document of same type, you expect it to be exact copy of the original. Now the real question - Have you ever encountered a situation when the copy is not the same (that too by the look) as the original?
Well, I did recently, in one of my projects. When I copied an AutoCAD table from one drawing to another, the text in the table visually looked different from the original.
As you may be aware, every CAD software controls display of its contents by 'styles'. And there are many of them like Dimension Style, Table Style. Text Styles, that control the display of text (font / size / formatting), are common across all CAD softwares - 2D or 3D.
AutoCAD provides default styles for each category of styles (And it is no different for Inventer / SolidEdge / SolidWorks / ProE - Creo / CATIA). It is a good practice not to tamper with any of the default styles. If you need any change, even a minor one, create a new style of your own. But leave the default styles untouched. I learned this message loud and clear. Here is how it happened all.
This particular project required me to create an AutoCAD table in the Customer's existing drawing, collect some information from that drawing and fill the table, using VisualLISP code, with that information.
For a trial, I created a new drawing, created a table in it and played with the table until it looked perfect. Then I opened the Customer's drawing and copy-pasted the table in that drawing. The result (shown below) was unexpected. It seemed as if these were two different tables.
The Source Table |
Its obvious from the first look that there seems to be some mismatch with fonts. The fonts, in AutoCAD, are controlled by the Text Style.
In this particular case, I had made no changes to any of the settings that control the fonts nor had I changed any default settings while creating the table.
So, after some thoughtful moments, I decided to first compare the settings related to table in both the drawings. In both the the drawings, Table Style (that controls the formatting of tables) & Text Style (that controls the formatting of text) user were 'Standard' - the default styles. With these settings, the look and size of the text in table should theoretically be the exactly similar. But it wasn't. And that meant something was wrong somewhere.
On further detailed investigations, I found out that the Customer had modified the font in the 'Standard' text style - from default 'Arial' to 'txt'.
The situation was ideal to throw the ball back into Customer's court and ask them to 'repair' and restore the 'Standard' text style in their drawing. But that might create another set of problems for the Customer (... not good, you see!). And who am I to advise the Customer to change their default settings?
So, taking matter into my own hands instead, I created a new text style in my drawing that was exact copy of the 'Standard' text style (in my drawing). I applied the new text style to text inside all the cells in the table. This did not make any difference to the text formatting in my drawing and the table displayed exactly as it appeared before.
When I copied the modified table in the Customer's drawing, the new text style was copied and applied to the text in the table automatically (This is the default AutoCAD behavior).
The table with new text style |
Copy in Customer Drawing Displays correctly |
I was then able to run my VisualLISP code successfully to populate 10 rows of data.
This done, my next step would be to educate and cajole the Customer to repair & restore the "Standard" text style.
Till then, the Customer maintains his own 'Standard' text style, me my own. And we live happily ever after.
So, ... till the next cAdventure in APIs ..... have a nice time and don't ever modify your default styles ....