Page 1 of 1

Save as DXF cadimport V7

Posted: 15 Jun 2009, 11:51
by corentin
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?

Re: Save as DXF cadimport V7

Posted: 15 Jun 2009, 18:11
by support
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.

Re: Save as DXF cadimport V7

Posted: 18 Jun 2009, 12:25
by corentin
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

Re: Save as DXF cadimport V7

Posted: 23 Jun 2009, 13:28
by support
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.