Reading line type

Use this forum to ask questions about how to do things in dxflib.

Moderator: andrew

Post Reply
Registered Member
Posts: 2
Joined: Thu Oct 04, 2012 9:40 am

Reading line type

Post by AllanJ » Thu Oct 04, 2012 10:02 am

I might be missing something, but I can't see how to read LTYPE information. Looking at dll_dxf.cpp, processDXFGroup() doesn't include a check for "LTYPE".

I'm just about to upgrade to the latest version so I could use the new function processCodeValuePair() to pull out the data and process it myself, but I'm suprised that the function isn't in place already as it seems line type is quite a fundemental thing to need.


ps. what a great lib., I've been able to implement a simple DXF import in no time at all.

Registered Member
Posts: 2
Joined: Thu Oct 04, 2012 9:40 am

Re: Reading line type

Post by AllanJ » Thu Oct 04, 2012 2:55 pm

OK, thought about adding code for parsing LTYPE ie. implement a void addLineType(DL_CreationInterface* creationInterface) function etc. but it seems like there may be a fundamental problem: data is store in the array 'char values[DL_DXF_MAXGROUPCODE][DL_DXF_MAXLINE+1];' but I think this is assuming that an index will only occur once for an item. With a line type the there may be several '49's ie. Dash, dot or space length (one entry per element).

in this example

Code: Select all

READS2WHIT_170912_WITH_MOV       name
     0				flag
ISO dash __ __ __ __ __ __ __ __ __ __ __ __ __     description
     2			number of elements
 40			total length
 49			dash
 49			dot or space
values[49] = "-3.0" so it looks like values[49] = "12.0" entry has been overwritten and lost.


User avatar
Site Admin
Posts: 6165
Joined: Fri Mar 30, 2007 6:07 am

Re: Reading line type

Post by andrew » Thu Oct 04, 2012 4:23 pm

Parsing content with multiple code / value pairs for the same code is a bit more complex.
For an example how this is done in dxflib, please have a look at how MTEXT entities are parsed. The key part is the function "handleMTextData" which calls addMTextChunk of your interface for each (additional) chunk of text that is parsed.

Registered Member
Posts: 1
Joined: Sun Feb 03, 2013 3:38 pm

Re: Reading line type

Post by geri » Tue Feb 05, 2013 1:36 pm

So what method is recommended to collect linestyles and text styles ?
Should I parse code/value pairs after recognizing an LTYPE or STYLE entity?
And the same parsing method for getting LAYER / BLOCK linestyles?

And for the drawing entities like LINE, POLYLINE,TEXT etc. how do I get the actual linetype/style ?
Should I modify dxflib to provide the values for 6 or 7 group code or can I get it somehow already?

BIg thanks for this library!

Post Reply

Return to “dxflib 'How Do I' Questions”