Clipping of features by extent

Dubai Municipality
6/22/2014 10:17 AM


I am using CADLib 4.0 for .NET programming. I am looking for any API which does the following thing

1. Clipping the features by passing the extents during and/ after/ before DxfWriter.

Waiting for your reply.

Praveen E

6/23/2014 11:16 AM

There is no entity clipping behavior available in CadLib.

But you can either use layouts (viewports) or spatial filters to achieve what you want.

For the first I refer to the documentation, for the latter you'll need the latest CadLib release and can find an example of usage in this thread.

- Rammi

Dubai Municipality
6/24/2014 6:50 AM

Thanks for the information.

I am using List<Polygon2D> result = Polygon2D.GetIntersection method which is throwing "Could not find connecting segment."

What might be the problem. Find the below code.

DxfLwPolyline polyline = new DxfLwPolyline();
polyline.Vertices.Add(new Point2D(499274.173, 2798082.325));
polyline.Vertices.Add(new Point2D(499285.274, 2798067.793));
polyline.Vertices.Add(new Point2D(499275.532, 2798060.462));
polyline.Vertices.Add(new Point2D(499264.431, 2798074.994));
polyline.Closed = true;
polyline.Color = EntityColors.Blue;

DxfLwPolyline polyline1 = new DxfLwPolyline();
polyline1.Vertices.Add(new Point2D(499271.1251, 2798020.0316));
polyline1.Vertices.Add(new Point2D(499342.5612, 2798020.0316));
polyline1.Vertices.Add(new Point2D(499342.5612, 2798065.2832));
polyline1.Vertices.Add(new Point2D(499271.1251, 2798065.2832));
polyline1.Closed = true;
polyline1.Color = EntityColors.Brown;

DxfModel model = new DxfModel(DxfVersion.Dxf24);
DxfWriter.Write(ConfigurationManager.AppSettings["DWGPATH_CURRENT"].ToString() + "1" + ".dxf", model);

// Two polygons where two edges overlap, and two edges intersect.
Polygon2D p1 = new Polygon2D(
new Point2D(499274.173, 2798082.325),
new Point2D(499285.274, 2798067.793),
new Point2D(499275.532, 2798060.462),
new Point2D(499264.431, 2798074.994)
Polygon2D p2 = new Polygon2D(new Point2D(499271.1251, 2798020.0316),
new Point2D(499342.5612, 2798020.0316),
new Point2D(499342.5612, 2798065.2832),
new Point2D(499271.1251, 2798065.2832));

//List<Polygon2D> result = new List<Polygon2D>();
List<Polygon2D> result = Polygon2D.GetIntersection(new Polygon2D[] { p2 }, new Polygon2D[] { p1 });//This line is giving the error

Waiting for your reply.