Page 1 of 1

Reading line type

Posted: Thu Oct 04, 2012 10:02 am
by AllanJ
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.

Allan

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

Re: Reading line type

Posted: Thu Oct 04, 2012 2:55 pm
by AllanJ
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

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

Allan

Re: Reading line type

Posted: Thu Oct 04, 2012 4:23 pm
by andrew
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.

Re: Reading line type

Posted: Tue Feb 05, 2013 1:36 pm
by geri
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!