Need help in removing entity in cad drawing
Moderators: SDS, support, admin
Need help in removing entity in cad drawing
I had tried remove entity of a cad drawing using the method CADImage.RemoveEntity(). Unfortunately, it seem only could work under the evaluation copy, but not in registered copy. Below are the same code that I try to remove all the entities that belongs to layer with name "green", by taking off the registration code, it work as expected. But it doesn't when we turn on the registration code. Please kindly point me out if I had missed out anything. Thanks a lot.
Code: Select all
using System;
using CADImport;
using CADImport.Export.DirectCADtoDXF;
namespace DeleteEntity
{
class Program
{
static void Main(string[] args)
{
#region CAD Import .NET Registration
<font color="green">// Enter the registration information for CAD Import .NET </font id="green">library.
System.Collections.ArrayList regDat = new System.Collections.ArrayList();
regDat.Add("xxxxx");
regDat.Add("xxxxx@objectiveworld.com");
CADImport.Protection.Register("XXXXXXXXX", regDat, false);
#endregion
<font color="green">// Load the cad drawing from file.</font id="green">
CADImage cadDrawing = new CADImage();
cadDrawing.LoadFromFile("input.dxf");
cadDrawing.SelectionMode = SelectionEntityMode.Disabled;
cadDrawing.UseDoubleBuffering = true;
<font color="green">// The name of the layer that we wish to remove.</font id="green">
string layerName = "green";
foreach (string entityKey in cadDrawing.Converter.Entities.AllKeys)
{
CADEntity entity = (CADEntity)cadDrawing.Converter.Entities[entityKey];
<font color="green">// Remove the entity if it belongs to the layer that we want to remove.</font id="green">
if (entity.Layer.Name == layerName)
{
cadDrawing.RemoveEntity(entity);
}
}
<font color="green">// Save result to output.dxf.</font id="green">
CADtoDXF exportImage = new CADtoDXF(cadDrawing);
exportImage.SaveToFile("output.dxf");
}
}
}
Hello!
We suppose that you use beta version of <b>CAD Import .NET Pro</b> with registration data for <b>CAD Import .NET</b>: http://www.cadsofttools.com/en/products ... _.net.html
Method <b>RemoveEntity</b> is a part of <b>CAD Import .NET Pro</b>. That is why it does not work with registration data for previous version of the library.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
We suppose that you use beta version of <b>CAD Import .NET Pro</b> with registration data for <b>CAD Import .NET</b>: http://www.cadsofttools.com/en/products ... _.net.html
Method <b>RemoveEntity</b> is a part of <b>CAD Import .NET Pro</b>. That is why it does not work with registration data for previous version of the library.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com