maker.js icon indicating copy to clipboard operation
maker.js copied to clipboard

fix color code for black in dxf

Open DerKorb opened this issue 5 years ago • 13 comments

AutoCAD does not accept files with color code 0.

DerKorb avatar Aug 20 '19 18:08 DerKorb

Thanks! Can we find a link that is not using ftp:// ?

danmarshall avatar Aug 20 '19 18:08 danmarshall

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 avatar Aug 20 '19 18:08 DerKorb

@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.

boomer196 avatar Aug 20 '19 19:08 boomer196

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.

DerKorb avatar Aug 20 '19 19:08 DerKorb

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 ?

danmarshall avatar Aug 20 '19 19:08 danmarshall

Also, maybe you can open the Index Color Tab in AutoCAD.

danmarshall avatar Aug 20 '19 19:08 danmarshall

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.

image

image

boomer196 avatar Aug 20 '19 20:08 boomer196

I think 250 is a very dark charcoal gray.

danmarshall avatar Aug 20 '19 20:08 danmarshall

I think the screenshot states RGB 0, 0, 0

DerKorb avatar Aug 20 '19 20:08 DerKorb

QCad seems to use 7 as black.

DerKorb avatar Aug 20 '19 20:08 DerKorb

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

z3dev avatar Aug 20 '19 21:08 z3dev

Perhaps we can make this an option which you can specify when calling exporter.toDXF(model, options)

danmarshall avatar Jan 12 '21 03:01 danmarshall

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.

z3dev avatar Jan 12 '21 04:01 z3dev

I'm going to close this, until we have better definition.

danmarshall avatar Feb 01 '23 05:02 danmarshall