суббота, 28 мая 2016 г.

Week 1 Report.

Weekly report: week 1

To begin with, I'd like to say I've done before May 23, and to end up with this week report.

Libopencad (which will be used in OGR DWG Driver as a DWG reader) now has a variety of capabilities:
1. Reading of layers and layers attributes, such as name, state (frozen/locked, etc).
2. Reading of geometries which are attached to a concrete layer.
3. Reading of CAD Variables, but it's presented as raw data and I am not completely sure how to use it for now.

Supported geometries/objects, which libopencad can extract from a .DWG file are:
  • Point
  • Circle
  • Ellipse
  • Arc
  • Text
  • Solid
  • Spline
  • Line
  • Polyline 2D
  • Polyline 3D
  • LWPolyline
  • Ray
  • Raster (Images)
  • MText
  • MLine
  • XLine
  • Polyface Mesh
  • 3DFace
Missing geometries, and why they are not supported yet can be seen here.

Library architecture was made to make it possible to extend supported formats just by adding support to a new one. It can be done by writing a new class which will be a derived class of CADFile, and implement "version/format dependent" functions, like GetGeometry, GetObject.

Libopencad uses googletest for testing, and now it has tests:
1. Of internal reading of CAD datatypes, such as Bitcoded long, Bitcoded short, etc.
2. Of reading geometries, such as polyline, circle, ellipse, arc (but not all geometries has tests).

What is missed in the library, and will be implemented during next month:
  1. By-block reading, by providing a function GetBlock, same functional as GetLayer, but attached to a block.
  2. LineTypes reading, Extented Entity Data reading, Attributes (they can be read, but library does not “make a connection” between attribute and an object, which it is associated with).

  1. This week I've done:
1. Added support to geometries: Ray, MText, MLine, Raster, XLine, 3DFace, Polyline Pface, and added reading of Dimensions (7 types) on internal level (libopencad cad read it, but doesnot provide 'access' to it by its API).
2. Tested reading of Raster Images.
3. Code refactoring.

2. Plan on doing next week:
  • Write google tests for correct opening of large files with big amount of geometries and layers.
  • Start implementing reading of LineTypes and by-block reading.
  • Extend supported geometries list with new ones.

3. Blocking:
I am not really stucked on anything, except I recently tried to add CRC calculation to the library, and did not get a correctly working feature.
I am getting stucked from time-to-time because of mistakes/mistypes in ODA DWG Specification, because some of them can be found by bruteforce of possible variants what they have wanted to say.

воскресенье, 22 мая 2016 г.

Current state of libopencad

Hello.

Recently I've added SOLID geometry support, solved problem with deleted entities, and a lot of refactoring were done too. Updated tests.

Up on the list now:
1. Add reading of blocks (now only layers are supported).
2. Add reading of attributes/line types for geometries.

понедельник, 16 мая 2016 г.

ODA LWPolyline huge mistype

ODA LWPolyline geometry structure should be as follows (corrections made are bold).

Common Entity Data
       Flag
if (flag & 4) {
constwidth
}
if (flag & 8) {
elevation
}
if (flag & 2) {
thickness
}
if (flag & 1) {
}
BS 70 BD 43
BD 38
BD 39
normal
numpoints BL 90
3BD 210


if (flag & 16) {
numbulges BL
}
R2010+:
If (flag & 1024) {
vertexIdCount BL
}

R2000 | R2010+:
if (flag & 32) { // This flag presents in R2000, possible earlier and after.
numwidths BL
}
R13-R14 Only:
repeat numpoints times
pt0 2RD end repeat
R2000+:
pt0 2RD repeat numpoints-1 times
xDD
yDD end repeat
Common:
repeat numbulges times
bulge BD end repeat
repeat vertexIdCount times vertex id BL
end repeat
repeat numwidths times // So, Widths can also be presented there.
widths 2BD 
end repeat
Common Entity Handle Data

пятница, 13 мая 2016 г.

Added 3D Polyline reading support.

Greetings devs,

I have successfully implemented reading of 3D Polyline, it was not that easy because it's a 'complex' CAD object (its presented in file not like a single structure, like Circle or LWPolyline), but now it works properly (including vertexes order).

Some optimizations were done, the main unsolved problem is connected with 'deleted' entities, but I am working on it.

Best regards,
sandyre

суббота, 7 мая 2016 г.

Current state of libopencad

Hello devs,

I just have started writing handling functions for all the CAD objects, just like "Layer control" object, and others. It will help to implement writing function to the library, and to understand DWG internal structure way better.

Now, library can work with a big files (tested on 13600 geometries), but it has a few limitations - not all the returned geometries are actually drawn , because DWG stores some info about deleted objects. The only way to handle it - is to compare each object connection to one of the layers, which will be added soon.

Now supported geometries without problems:
- Line, Point, LWPolyline, Circle, Ellipse, Arc (LWPolyline with 'arced' lines also works), Text.

Best regards,
Alexandr.