Reading line type

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

Moderator: andrew

Reading line type

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

Allan

ps. what a great lib., I've been able to implement a simple DXF import in no time at all.
AllanJ
Registered Member
 
Posts: 2
Joined: Thu Oct 04, 2012 9:40 am

Re: Reading line type

Postby 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
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
AllanJ
Registered Member
 
Posts: 2
Joined: Thu Oct 04, 2012 9:40 am

Re: Reading line type

Postby 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.
User avatar
andrew
Site Admin
 
Posts: 2586
Joined: Fri Mar 30, 2007 6:07 am

Re: Reading line type

Postby 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!
geri
Registered Member
 
Posts: 1
Joined: Sun Feb 03, 2013 3:38 pm


Return to dxflib 'How Do I' Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron