Skip to content

How get DXF Dimension #14

@SkilyFrance

Description

@SkilyFrance

Hello,
First of all, thanks for this package.

Our DXF file represents a land and we want to retrieve this land's dimension through a calculation of the DXF file values.
After reading Autodesk documentation about DXF's variables, INSUNITS specifies a drawing-units value for automatic scaling of blocks, images, or xrefs when inserted or attached to a drawing. The value for my case is 9 (corresponding to mils).

So in my mind, i just have to sum of distance between each AcDbLine's points and convert it from mils to square meters. But it does not work.

For now, that's the function making this calculation.

/// Get utile surface.
double getUtileSurface(List<AcDbLine> lines) {
  // Result
  double surface = 0.0;
  // Distance between each point
  final List<double> pListDistance = <double>[];
  // Loop inside lined
  for (final AcDbLine l in lines) {
    // Line
    final Point<double> xPoint = Point<double>(l.x, l.y);
    final Point<double> x1Point = Point<double>(l.x1, l.y1);
    // Add distance in list for this two points
    pListDistance.add(xPoint.distanceTo(x1Point));
  }
  // Sum of all point list distance
  for (final double d in pListDistance) {
    surface += d;
  }
  surface = double.parse(surface.toStringAsFixed(2));
  return surface;
}

The result is 39.99 (what?) but our client gave us dimension is 91,71 m2 (square meters).

Do you have any idea what goes wrong in this case ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions