Save as DXF cadimport V7

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
corentin
Posts: 11
Joined: 06 Apr 2009, 12:40

Save as DXF cadimport V7

Post by corentin » 15 Jun 2009, 11:51

Hello Sergey.

The library CadImport V7 has resolved all my troubles, but today a new problem appeared.

using the fallowwing code:

Code: Select all

private: void create_DXF(String^ pathTXT,String^ pathDXF,int W,int H)
		{
			CADImport::CADImage^ img = gcnew CADImport::CADImage();
			CADImport::DRect size = CADImport::DRect(0,H,W,0); 
			img->Extents = size;

			CADLayer^ cadLayer = gcnew CADLayer();
			cadLayer->Name = "Textes";
			cadLayer->LineWeight=-1;
			cadLayer->Visibility=true;
			cadLayer->Visible= true;

                       CADPolyLine^ entPolyline = gcnew CADPolyLine();
			entPolyline->Color = Color::White;
			CADVertex^ entVert = gcnew CADVertex();
			entVert->Point = DPoint(0,0,0);
			entPolyline->AddEntity(entVert);
			entVert = gcnew CADVertex();
			entVert->Point = DPoint(0,H,0);
			entPolyline->AddEntity(entVert);
			entVert = gcnew CADVertex();
			entVert->Point = DPoint(W,H,0);
			entPolyline->AddEntity(entVert);
			entVert = gcnew CADVertex();
			entVert->Point = DPoint(W,0,0);
			entPolyline->AddEntity(entVert);
			entVert = gcnew CADVertex();
			entVert->Point = DPoint(0,0,0);
			entPolyline->AddEntity(entVert);
			entPolyline->Layer = cadLayercadre;


			img->Converter->Loads(entPolyline);
			img->Converter->OnCreate(entPolyline);
			img->Converter->Entities->Add(entPolyline);


			img->GetExtents();         
			CADImport::Export::DirectCADtoDXF::CADtoDXF^ cadexp = gcnew CADImport::Export::DirectCADtoDXF::CADtoDXF(img);
			cadexp->SaveToFile(pathDXF);
The part that saves as DXF, works perfectly with the CadImport V6.3 but when I use it With CadImport V7, no file is created!!

How can I do please?

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Save as DXF cadimport V7

Post by support » 15 Jun 2009, 18:11

Hello.
In CAD Import .NET 7 you must call function img->InitialNewImage() after image creation:

Code: Select all

    CADImage^ img = gcnew CADImage();
    img->InitialNewImage();
otherwise you will receive exception and file doesn't created.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

corentin
Posts: 11
Joined: 06 Apr 2009, 12:40

Re: Save as DXF cadimport V7

Post by corentin » 18 Jun 2009, 12:25

Thank you Sergey, no file is created.

But I have two new trouble:

with library V7, when I try to create a "CadMText" , if I open the file created and I see the "TreeView" in "CADImport.NET EDITOR"
the CadMText entity is became a CadText.
Moreover I would like to use different Fonts for this CadMText, but I don't know how can I change it.

I use the Code to create CadMText:

Code: Select all

CADMText^ entMText = gcnew CADMText();
				entMText->Layer=cadLayer;
				entMText->Text = texte;
				entMText->Color = Color::FromArgb(R,G,B);
				entMText->Point = DPoint(posX,posY,0);
				entMText->Height = taille;                  
				entMText->Loaded(img->Converter);                  
				img->Converter->OnCreate(entMText);  
				img->Converter->Entities->Add(entMText);
thanks

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Save as DXF cadimport V7

Post by support » 23 Jun 2009, 13:28

Hello.
All entities of the image are represented In "TreeView" window of the Editor. CADMText includes one or more CADText entities, what is why you will see them in "TreeView" as branches from MText node. And if you want to choose font for CADMText, use CADMText.Style.FontName property.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply