Changing line and font colors in DXF

Changing line and font colors in DXF

Anonymous
Not applicable
6,993 Views
7 Replies
Message 1 of 8

Changing line and font colors in DXF

Anonymous
Not applicable

We have a nesting program that determines layers by colors.  We have over 54,000 DXF files that I need to see if I could change the text color to a particular color and the line drawing to a different color.  Since I don't want to have to pull up every one of the 54,000 DXF files separately to make the change, I was hoping somebody could give me some insight on how I could set the colors inside an ASCII DXF.  I have some programming knowledge and I also have WinGrep that could do a global search and replace.  I have attached an example of one of my DXFs that hasn't been changed and one DXF that has been brought into AutoCAD LT 2020 and the changes made.  Any ideas would be appreciated.  Thanks!

0 Likes
Accepted solutions (1)
6,994 Views
7 Replies
Replies (7)
Message 2 of 8

h_s_walker
Mentor
Mentor

I'm not sure but I would create a simple drawing with one line in it. I would then save that as a dxf. Next I would change the color of that line and save it as a new dxf. I would then compare the two files to see what has changed to give me a heads up of what to look for in other dxfs to change the colour

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 3 of 8

steven-g
Mentor
Mentor

dxf.jpgCan you spot the difference, these are your two .dxf files just change the extension to .txt

The drawing data starts in the Entities Section can you see it (hint color red is '1' and when you scroll down to the Text items you see the number '2') does this get you started 🤔

0 Likes
Message 4 of 8

Anonymous
Not applicable

Yes I was able to find the AcDbEntity right before the AcDbText when I was looking to change the text color.  I was able to manually insert the 62 and 1 to change the color.  There appears to be the value of 100 right after the 1.  So if I were to right a program to change all the text, I think I would have to look for the AcDbText, check to see if there is a AcDbEntity right above it, and insert the 62  and 1 before the 100 value.  I don't know if all cases for my DXF would fit this scenario so I'll have to check further.  Thanks for the help. 

0 Likes
Message 5 of 8

steven-g
Mentor
Mentor
Accepted solution

Just a tip, do this on a copy of ALL the files you work on, just imagine that you find a problem after changing 100's of dxf  files, AcDbText comes up in lots of places not related to the text items in your drawing.

0 Likes
Message 6 of 8

Anonymous
Not applicable

Oh yeah, I will be working with a copy of the data to begin with.  Thanks!

0 Likes
Message 7 of 8

3DAli
Collaborator
Collaborator

This could be an amazing help when it comes to tweaking DXF files, hope you find it resourceful

 

Best,

Ali

Message 8 of 8

cadffm
Consultant
Consultant

Valid, for dxf12 files perfect, but for R12 only.

R12 is quite old,  more than three decades old now and dxf12 doesn't know about LWPOLY (which is the problem here with the 2004-format file), truecolors and so on.

If someone need a PDF of a newer dxf format version, one sample here - DXF Reference for R2012 <click!>

(note, 270 pages instead 59 for R12 DXF Format)

 

If you want to check the DXF Reference for newer Version, enter the online help,

press [F1] or enter the url by searching in www

2015 for example, what uses the same file format as all version 2013-2017: dxf2013

https://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3

 

or the newest one, dxf 2018 (2018-2024)

https://help.autodesk.com/view/ACD/2024/ENU/

-> Developer Documentation

     https://help.autodesk.com/view/OARX/2024/ENU/

   --> DXF Reference

           https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3

 

Sebastian