maker.js
maker.js copied to clipboard
fix color code for black in dxf
AutoCAD does not accept files with color code 0.
Thanks! Can we find a link that is not using ftp:// ?
I looked at several options, but unfortunately as with almost anything dxf, everything is shitty.
- its not in the reference
- there is some odd php page that lists 0 as legit and 0 and 255 are listed as beeing rgb(0,0,0) but one is displayed as white and one as black.
- there is a AutoDesk Knowledge Base Article Colors for DWG/DXF Export, but nothing about the codes in there
- there is tons of forum threads, but after the fifth without any info about the actual colors I said to myself, why not ftp? ftp is great!
@DerKorb - do you have a sample DXF that demonstrates the black working? I was able to recreate the error on 0
: Improper color number 0 for Layer on line 46.
I have not been able to get 255
to work though. I also tried 250
because that is the AutoCad Color Index that the application appears to use, but that doesn't seem to work either.
I did not try it in AutoCAD yet, as I have to switch to windows each time. I was assuming it would work, as it appears to be a very simple fix and it was shown in two of the color tables. I managed to get it to work by replacing all occurences of 62\n0 by 62\n1 before though. (everything was red then) So in principal it should work, maybe 255 is invalid as well.
Looking at the reference link and did a search for 62
, I saw that:
0 = BYBLOCK; 256 = BYLAYER
so, perhaps it needs to be 256 ?
Also, maybe you can open the Index Color Tab in AutoCAD.
I think it is 250
. I am not sure why it didn't work the first time I tried it, but I was able to get that value to work when I retried it.
I think 250 is a very dark charcoal gray.
I think the screenshot states RGB 0, 0, 0
QCad seems to use 7 as black.
Yeah. There’s no documentation from Autocad, but if you search then there are some contributions of color lists. I found a couple of complete lists (and converted) for use in JSCAD.
https://github.com/jscad/io/blob/V2/packages/dxf-deserializer/autocad.js
Perhaps we can make this an option which you can specify when calling exporter.toDXF(model, options)
Perhaps we can make this an option which you can specify when calling
exporter.toDXF(model, options)
That’s probably a good choice as the color list changes based the version of AutoCad.
I'm going to close this, until we have better definition.