Nuget References

Nuget: AutoCAD.NET.Interop

AutoCAD-2016.Net.Base

Traversing a 3D solid’s brep using AutoCAD 2009’s new .NET API

Brep

Boundary Representation (BRep) is the most mature and unambiguous representation method in geometric modeling. The boundary of a solid is usually represented by the union of faces, and each face is represented by the surface it lies on plus its boundaries. The boundaries of a face are the union of edges, and edges are represented by vertices.

Brep Structure in CAD

  • Brep
    • Complex
      • Shell
        • Faces
          • Vertex

Notes

Conventional API graphic operations in CAD are in Geometry, but strictly for 2D expressions or simple 3D expressions, such as creating 3D lines, Boolean operations, etc. If more complex calculations are needed, the functions in the Brep module must be used. If developing with C++, you can directly find AcadRegion and read the data. If developing with .NET, you need to reference the Interop package mentioned above and cast the object to the Acad structure to read it.

dbRegion.AcadObject as AcadRegion;

API

Entity[] ProjectOnToSurface(Entity entityToProject, Vector3d projectionDirection)

Code

1
2
3
4
5
var dbRegion = entity as Region;
var acadRegion = dbRegion.AcadObject as AcadRegion;
var brep = new Brep(dbRegion);
var target = brep.Surf.ProjectOnToSurface(line, new Vector3d(0, 0, 1));
var trueTarget = target[0] as Line;