Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with exporting layer lineweight in dxf

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
Bica.Bogdan
1350 Views, 22 Replies

Help with exporting layer lineweight in dxf

Hello,

Recently we tried adding layer lineweight to our DXF 2000 export. The original programmer is no longer working with us, and this is my  first time working with DXF so stupid questions may be asked.

We are exporting layers and everything seems to be working fine when we import it into Autocad 2015, except the layer lineweight, which always gets set on Default, instead of a value.

I'll post what we get when we export 

TABLE
  2
LAYER
  5
A61483
100
AcDbSymbolTable
 70
2
  0
LAYER
  5
A61441
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
0
 62
7
  6
CONTINUOUS
370
18
  0
LAYER
  5
A61475
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
Plankopf
 70
0
 62
7
  6
CONTINUOUS
370
18
  0
ENDTAB

 I've tried exporting the same thing from autocad, and compare the results. I've copy-pasted parts of the DXF file, mainly up the chain of dependencies codes 330 and 390, but it still would not work. If i went far enough, it wouldn't even load anymore.

Any ideas?

Thanks a lot

 

22 REPLIES 22
Message 2 of 23
kakt00z
in reply to: Bica.Bogdan

try to change
...
370
[lineweight_you_need * 100]
...
Message 3 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

No, i dont think it's that. I exported fron Autocad to DXF 2000, and that code was 370 and 18 not 1800. I didn't spot any mistake when comparing. But ill give it a try when i go to work
Message 4 of 23
dgorsman
in reply to: Bica.Bogdan

Does the 2000 file format support a layer lineweight entry?

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 5 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

I believe so, the code 370 is present in the dxf 2000 documentation. Plus lineweight by layer seems to be a pretty basic and important feature.
Maybe theres some master switch i am missing and i just can't find it.
Message 6 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

What i mean is if an Entity has lineweight by layer, the layer has to have lineweight, and i think the guys at Autocad implemented this from the first dxf version ever. At least i would have.
Message 7 of 23
dgorsman
in reply to: Bica.Bogdan

If you can, get ahold of AutoCAD 2000 program documentation and see if there is a lineweight property listed for drawing entities and the layer dialog.  If not, then you could be out of luck.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 8 of 23
Gary_J_Orr
in reply to: Bica.Bogdan

It's kind of hard to sit here and shoot possibilities at you since we have absolutely no clue as to the process that you are using to create the dxf files nor of the process of importing the same... even just the snippet for the layer table import/export... but...

A quick test process:
Use autocad to generate a dxf 2000 file, then use autocad to import (open) that dxf file... if everything makes the roundtrip then it isn't the file format...

nest step (if the above test passes):
Use your utility to create the dxf 2000 file, then use autocad to import (open) the file... if everything passes then you are exporting the required information and your problem is with your importer, otherwise your exporter still needs work.

-Gary
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 9 of 23
dgorsman
in reply to: Gary_J_Orr

Have to be careful doing that though.  Data for newer features can be left in the DXF file such that they are ignored by earlier versions.  If you save-as-DXF from AutoCAD 2014 and then re-open the exact same file with AutoCAD 2014, it won't be the same as if the DXF was produced by or opened with AutoCAD 2000i.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 10 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

Ok. Thanks for all the posts. Our format is the problem. I forgot to mention i did use autocad to export a dxf 2000 file and then imported it back in and the lineweight was correct. Do you know of any dependencies regarding lineweight for layers?
Message 11 of 23
Gary_J_Orr
in reply to: dgorsman

dgorsman,
such items are stored in "roundtrip" dictionaries appended to the file so they can find and return values for version dependant features... anything stored directly in the entity's definition list is fully compatible with the version of DXF that was created by ACAD.
-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 12 of 23
Gary_J_Orr
in reply to: Bica.Bogdan

Bica.Bogdan,

I exported two versions from within Acad, one in which I had the lineweights listed as mm's and another in which I had the listed as Inches.

The dxf file remains the same for both exports in terms of how they are stored in the layer table record... A value of 18 will translate to 0.18mm with the display set to mm and will translate to 0.007" when the display is set to Inches... So it becomes more of an Index value when in a DXF file and the AutoCAD function that controls the display of such converts that "index" by applying math to it (a bit of division with your acad environment variables deciding which value it needs to be devided by...

If you are storing the values of 0.18mm as 18 (as your original post seems to show that you are) then it will come down to how you are creating the layers from the dxf values. If using entmake it should translate cleanly I believe as the entget for the layer table returns the same values, but if you are using a command function or something that does a deeper processing to create the layer then... it all depends on the function as to what you may need to do (a bit of long division perhaps 😉

Again, without a snippet of the code that is collecting the data and writing the table record in the DXF file and a snippet of the code that is creating the layer within the drawing... it's all just guesswork on our end

_Gary.

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 13 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

So, to conclude, as far as you guys know, is there anything else to do besides adding the 370 code and a value from the lineweight enum?
Message 14 of 23
kakt00z
in reply to: Bica.Bogdan


@Bica.Bogdan wrote:
No, i dont think it's that. I exported fron Autocad to DXF 2000, and that code was 370 and 18 not 1800. I didn't spot any mistake when comparing. But ill give it a try when i go to work

Do you really need 18 mm lineweight? I mean 370 18 is 0.18 mm lineweight.

The DEFAULT value is set by the LWDEFAULT system variable

also, here is possivle values from acad help

 

-1 acLnWtByLayer

-2 acLnWtByBlock

-3 acLnWtByLwDefault

0 acLnWt000

5 acLnWt005

acLnWt009

acLnWt013

acLnWt015

acLnWt018

acLnWt020

acLnWt025

acLnWt030

acLnWt035

acLnWt040

acLnWt050

acLnWt053

acLnWt060

acLnWt070

acLnWt080

acLnWt090

acLnWt100

acLnWt106

acLnWt120

acLnWt140

acLnWt158

acLnWt200

acLnWt211

Message 15 of 23
Bica.Bogdan
in reply to: kakt00z

18, 211, 9, 53.....i don't care i just want it to work. And it doesn't and i have no idea why.

I found this post. And our export is R14 (DXF2000).  

We get:

$ACADVER
1
AC1014

Saving with Autocad 2015 to a DXF 2000 (it is not called R14 in the menu) i get AC1015.

Interchanging the codes causes the DXF to fail loading.

So i might well be a version problem. Anyone from Autodesk to confirm maybe?

Thanks

 

Message 16 of 23
Gary_J_Orr
in reply to: Bica.Bogdan

sorry, tried to reply twice yesterday and the DG never put it up, even though it claimed that it did...

As far as I can tell from exporting a couple of different versions w/ different units and settings, yes you should simply be able to store it that way. 18 for the correllating 0.18 mm lw, etc... you do seem to be storing it correctly.

But applying that when reading the dxf and creating the dwg is going to depend upon how you are creating the layer in ACAD... without a snippet or some kind of idea as to how that is being performed there isn't much else to suggest.
-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 17 of 23
Gary_J_Orr
in reply to: dgorsman

dgorsman,
All such information is stored in "roundtrip" dictionaries appended to the DXF file, not within the association codes themselves, otherwise an older version would crash when trying to read a code that doesn't exist for that version.

Therefore the test sequence is valid for determining where the error might be happening since ACAD does create the required code when it exports to the same version and the OP will be able to test both his exporter and importer as well as the validity of the originating file from which the export was created to determine the source of the problem.

The OP seems to be capable of (and seems to have done so since the original post was a snip from a dxf file) manually comparing the exports... all it takes is notepad and the time to do so.
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 18 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

I'll add the dxf file. It's as minimal as possible. If anyone has the time to give it a go, i'll be very thankful. 

Message 19 of 23
Gary_J_Orr
in reply to: Bica.Bogdan

If you could also post the section of code in which you collect the values for the layer from the dxf file, and then write those values to the dwg file....

This would help immensely... I have no idea if you are collecting the values into an association list and using entmake, or if you are using ActiveX methods through VLisp, or if you are trying to use command functions... are you even using Vlisp or some other programming interface for the work?
These are the things that will make all the difference in why it might be failing to correctly produce the required results.
-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 20 of 23
Bica.Bogdan
in reply to: Bica.Bogdan

Gmt + 2 here, i'm off work already. We have a standalone C++ program, i'm afraid i am not at liberty to post our code. As far as i can tell we iterate through the layer table, add it all up into buffers and then into a dxf file. The source is our own program and entities/layers/etc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost