copy layer from DXF to DXF
Moderators: SDS, support, admin
copy layer from DXF to DXF
Hello, Sergey!
I would like to be able to import a second DXF and copy one layer, and paste this layer( with the entities) on my first DXF all entities.
I have try a lot of exemple in this forum, but i have not find any solution.
have you an exemple for me please?.
I would like to be able to import a second DXF and copy one layer, and paste this layer( with the entities) on my first DXF all entities.
I have try a lot of exemple in this forum, but i have not find any solution.
have you an exemple for me please?.
Re: copy layer from DXF to DXF
hello!
can you explain to me ,how create a new layer please?
can you explain to me ,how create a new layer please?
Re: copy layer from DXF to DXF
Hello,
Please try the following code:
Sergey.
Please try the following code:
Code: Select all
CADLayer lay1 = new CADLayer();
lay1.Name = "MyLayer";
lay1.Color = Color.RoyalBlue;
lay1.Visibility = true;
this.cadImage.Converter.Layers.Add(lay1);
this.cadImage.Converter.OnCreate(lay1);
this.cadImage.Converter.Loads(lay1);
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
thanks you, it works perfectly.
but i use the viewer form and when in click to show the layer form, my new layer, isn't in the list although my polyline is on the screen! have you an idea?
but i use the viewer form and when in click to show the layer form, my new layer, isn't in the list although my polyline is on the screen! have you an idea?
Re: copy layer from DXF to DXF
It is necessary to use private void AddRecordToLayerList(string name, Color color, bool visible, bool freeze) available in the demo.
In general copying entities of some layer from one file to another could be implemented "manually". Please check a code below:
Sergey.
In general copying entities of some layer from one file to another could be implemented "manually". Please check a code below:
Code: Select all
private void AddEnt(CADConverter Conv, CADEntity ent)
{
Conv.Entities.Add(ent);
Conv.OnCreate(ent);
Conv.Loads(ent);
}
private void button2_Click(object sender, System.EventArgs e)
{
if(cadImage == null)
return;
cadImage.Converter.PointDisplayMode = 0;
cadImage.UseDoubleBuffering = false;
CADLayer entExtLayer = new CADLayer();
entExtLayer.Name = "Extended Layer";
entExtLayer.Color = Color.RoyalBlue;
entExtLayer.Visibility = true;
this.cadImage.Converter.Layers.Add(entExtLayer);
this.cadImage.Converter.OnCreate(entExtLayer);
this.cadImage.Converter.Loads(entExtLayer);
this.AddRecordToLayerList(entExtLayer.Name, entExtLayer.Color, true, false);
CADImage xRefcadImage = new CADImage();
xRefcadImage = CADImage.CreateImageByExtension(@"d:\LinesInTheBlock.dxf");
xRefcadImage.LoadFromFile(@"c:\LayerToBeCopied.dxf");
for (int i=0; i<xRefcadImage.Converter.GetCounts(CADImport.FaceModule.ConvSection.Entities);i++)
{
CADEntity ent = xRefcadImage.Converter.GetSection(CADImport.FaceModule.ConvSection.Entities).Entities[i];
if (ent.Layer.Name == "0")
{
switch(ent.EntType)
{
case CADImport.EntityType.Point:
CADPoint tmpPoint = ent as CADPoint;
CADPoint entPoint = new CADPoint();
entPoint.Point = tmpPoint.Point;
entPoint.Point1 = tmpPoint.Point1;
entPoint.Color = tmpPoint.Color;
this.AddEnt(this.cadImage.Converter, entPoint);
break;
case CADImport.EntityType.Line:
CADLine tmpLine = ent as CADLine;
CADLine entLine = new CADLine();
entLine.Point = tmpLine.Point;
entLine.Point1 = tmpLine.Point1;
entLine.Color = tmpLine.Color;
this.AddEnt(this.cadImage.Converter,entLine);
break;
case CADImport.EntityType.Circle:
CADCircle tmpCircle = ent as CADCircle;
CADCircle entCircle = new CADCircle();
entCircle.Point = tmpCircle.Point;
entCircle.Radius = tmpCircle.Radius;
entCircle.Color = tmpCircle.Color;
this.AddEnt(this.cadImage.Converter,entCircle);
break;
default:
break;
}
}
}
this.cadImage.GetExtents();
this.cadPictBox.Invalidate();
}
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
thank you , for your reply.
i have an other question,
With the viewer i can't use any event ,like "mouseclick"etc... how can i do , for use it??
thank.
i have an other question,
With the viewer i can't use any event ,like "mouseclick"etc... how can i do , for use it??
thank.
Re: copy layer from DXF to DXF
Hello,
Viewer demo contains:
private void cadPictBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
private void cadPictBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
where mouse button clicks are processed.
Sergey.
Viewer demo contains:
private void cadPictBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
private void cadPictBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
where mouse button clicks are processed.
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
Thank you, for your help.
I have found un Bug with the "CADViewerControl" class.
I use the GetRealPoint(x,y) method to determinate where i click, but when the scale is more than 100%, coordinates in the "StatusBarPanel" is wrong, i can't explain this.
i have the same trouble with this code:
before 100% the origine of my DXF file is on the left bottom, and after 100% this origine move to the center of the plan.
i enclose screenshots.



i have a two other question:
is it possible , in the "CADViewerControl", to disable the zoom by box selection (left click)??
in order to buy Cadimport.NET , what is the difference between programmatic entities creating and programmatic editing??
thanks
I have found un Bug with the "CADViewerControl" class.
I use the GetRealPoint(x,y) method to determinate where i click, but when the scale is more than 100%, coordinates in the "StatusBarPanel" is wrong, i can't explain this.
i have the same trouble with this code:
Code: Select all
int x =viewer->CurrentXClickPosition;
int y =viewer->CurrentXClickPosition;
CADImport::DPoint point = viewer->GetRealPoint(x,y);
i enclose screenshots.
i have a two other question:
is it possible , in the "CADViewerControl", to disable the zoom by box selection (left click)??
in order to buy Cadimport.NET , what is the difference between programmatic entities creating and programmatic editing??
thanks
Re: copy layer from DXF to DXF
Hell,
Sergey.
We have doubtes that there is a bug. CurrentXClickPosition shouldn't be used for such purposes. It surves for determining drawing's offset among inner cadPicture space. Could you please send us to support@cadsofttools.com your file and the whole demo to test the problem?corentin wrote:Thank you, for your help.
I have found un Bug with the "CADViewerControl" class.
I use the GetRealPoint(x,y) method to determinate where i click, but when the scale is more than 100%, coordinates in the "StatusBarPanel" is wrong, i can't explain this.
i have the same trouble with this code:before 100% the origine of my DXF file is on the left bottom, and after 100% this origine move to the center of the plan.Code: Select all
int x =viewer->CurrentXClickPosition; int y =viewer->CurrentXClickPosition; CADImport::DPoint point = viewer->GetRealPoint(x,y);
Such functionality is unavailable.corentin wrote: i have a two other question:
is it possible , in the "CADViewerControl", to disable the zoom by box selection (left click)??
There is no difference between programmatic entities creating and programmatic editing. The difference is between Standard and Professional versions. Editor demo contains visual means of adding and editing entities with Professional version. Trial version works like Professional.corentin wrote:in order to buy Cadimport.NET , what is the difference between programmatic entities creating and programmatic editing??
thanks
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
Hello Sergey!
I have bought a professional licence.
I always have the same trouble with coordinates, i will send you an example.
i have register my licence:
I have a second trouble, I want to save my dfx file with :
i enter a name to my file , but i have not any file on my save repertory.
I have bought a professional licence.
I always have the same trouble with coordinates, i will send you an example.
i have register my licence:
Code: Select all
ArrayList^ regDat = gcnew ArrayList();
regDat->Add("xxxxxx");
regDat->Add("xxxxxxx");
String^ Key = "xxxxxxxx";
Protection::Register(Key, regDat, false);
viewer->Invalidate();
Code: Select all
MyCADviewerControl->SaveAsDXF();
Re: copy layer from DXF to DXF
Hello Corentin,
It works.
Sergey.
Do you have a problem with coordinates or with the registration process?corentin wrote: I always have the same trouble with coordinates, i will send you an example.
i have register my licence:Code: Select all
ArrayList^ regDat = gcnew ArrayList(); regDat->Add("xxxxxx"); regDat->Add("xxxxxxx"); String^ Key = "xxxxxxxx"; Protection::Register(Key, regDat, false); viewer->Invalidate();
We tested the following code on a ViewerControlDemo from the CAD Import .NET package:corentin wrote: I have a second trouble, I want to save my dfx file with :i enter a name to my file , but i have not any file on my save repertory.Code: Select all
MyCADviewerControl->SaveAsDXF();
Code: Select all
this.cadViewerControl1.SaveAsDXF(@"c:\test.dxf");
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
hello Sergey.
today i have two troubles:
1) save my new DXF.
2) coordinates in the plan.
For save my plan , i have test your code:
but unfortunately save don't works. the file isn't create. have you an idea?
For coodinates in the plan i will send you a example.
today i have two troubles:
1) save my new DXF.
2) coordinates in the plan.
For save my plan , i have test your code:
Code: Select all
this.cadViewerControl1.SaveAsDXF(@"c:\test.dxf");
For coodinates in the plan i will send you a example.
Re: copy layer from DXF to DXF
Can you please send us to support@cadsofttools.com your file which can't be saved?corentin wrote:hello Sergey.
For save my plan , i have test your code:but unfortunately save don't works. the file isn't create. have you an idea?Code: Select all
this.cadViewerControl1.SaveAsDXF(@"c:\test.dxf");
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: copy layer from DXF to DXF
hello sergey,
can you explain to me , how can i delete a layer (with the entities) in a DXF file , when i use the cad viewer in the library cadimport.net ???
thanks you
can you explain to me , how can i delete a layer (with the entities) in a DXF file , when i use the cad viewer in the library cadimport.net ???
thanks you
Re: copy layer from DXF to DXF
Hello,
Here goes a code example how to delete a layer with entities:
Sergey.
Here goes a code example how to delete a layer with entities:
Code: Select all
private void mmiDeleteLayer_Click(object sender, EventArgs e)
{
if (this.cadImage == null)
return;
this.cadImage.UseDoubleBuffering = false;
for (int i = this.cadImage.Converter.GetCounts(ConvSection.Entities)-1; i>=0; i--)
{
CADEntity ent = (CADEntity)this.cadImage.Converter.GetSection(ConvSection.Entities).Entities[i];
if (ent.Layer.Name == "LayerToBeDeleted")
this.cadImage.Converter.Entities.Remove(i);
}
CADGroup layersSection = this.cadImage.Converter.GetSection(ConvSection.Layers);
for (int i = layersSection.Entities.Count - 1; i >=0 ; i--)
{
CADLayer entLayer = (CADLayer)layersSection.Entities[i];
if (entLayer.Name == "LayerToBeDeleted")
layersSection.Entities.Remove(i);
}
this.DoResize();
}
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support