MergeFiles Problem

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

MergeFiles Problem

Post by Anderson » 09 Dec 2008, 10:21

Dear Sir,

I use the “MergeFilesDemoSite” program to merge 3 dxf files and save as a new .dxf file, but when I open the new .dxf file with “ViewerControlDemo “ program, I got nothing (cann’t see anything), could you tell me the cause?

Anderson

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

Re: MergeFiles Problem

Post by support » 09 Dec 2008, 12:00

Dear Anderson,

We have found this problem. We will inform you when it is solved.

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

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

Re: MergeFiles Problem

Post by support » 24 Dec 2008, 16:19

Hello!

The problem has been solved.
Please contact us via e-mail to support@cadsofttools.com accordingly the question of getting updated beta version of the library.

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

Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

Re: MergeFiles Problem

Post by Anderson » 25 Dec 2008, 05:45

Dear Sergey,

Now I can see the merged dxf file. Thank You!
But the "Hatch" entity in each dxf file disappeared. How can I to obtain the original Hatch entity in my merged file?

Merry X'mas,
Anderson

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

Re: MergeFiles Problem

Post by support » 25 Dec 2008, 09:33

Dear Anderson,

Can you please send us to support@cadsofttools.com your file with hatch? We need to test it.

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

Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

Re: MergeFiles Problem

Post by Anderson » 16 Jan 2009, 17:39

Hi sergey,
Have you found any solution for my problem? I am urge to finish my project and looking forward to your reply soon.

Anderson

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

Re: MergeFiles Problem

Post by support » 19 Jan 2009, 10:20

Hello Mr. Anderson,

Unfortunately the problem is still under construction. We will inform you when it is solved.

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

Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

Re: MergeFiles Problem

Post by Anderson » 25 Feb 2009, 06:26

Dear Sergey:

My problem with program were sent to you last Dec. 25. It has been 2 months. Do you still work on my problem? Due to this problem, my project was forced to delay. Can this problem be solved? Would you please let me know the status of solving this problem? Thanks.

Best regards,

Anderson

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

Re: MergeFiles Problem

Post by support » 26 Feb 2009, 10:36

Hello Mr. Anderson,

The code you sent us with a demo application would not work. Why? It is used AddScaledDXF method which adds XRef to a file. "XRef" means extended reference to a file, i.e. file container contains just a reference to a file. It does not take the whole data of the extended files for further storing inside. That is why it is necessary to resave a file added by AddScaledDXF method if he makes some changes to it. We made a simple example describing these state. Please try it:

Code: Select all

       private void button1_Click(object sender, EventArgs e)
        {
            CADImage cadImg = new CADImage();
            cadImg.InitialNewImage();
            cadImg.UseDoubleBuffering = false;

            CADImage cadImg_XREF = new CADImage();

            cadImg_XREF.LoadFromFile(@"c:\body.dxf");


            for (int i = 0; i < cadImg_XREF.Converter.GetCounts(CADImport.FaceModule.ConvSection.Entities); i++)
            {
                if (cadImg_XREF.Converter.GetSection(CADImport.FaceModule.ConvSection.Entities).Entities[i] is CADPolyLine)
                {
                    CADPolyLine entPolyline = (CADPolyLine)cadImg_XREF.Converter.GetSection(CADImport.FaceModule.ConvSection.Entities).Entities[i];

                    CADHatch Hatch = new CADHatch();

                    Hatch.HatchName = "ANSI31";
                    CAD2DBoundaryList v2DBList = new CAD2DBoundaryList();
                    v2DBList.BoundaryType = 2;// Polyline type
                    Hatch.BoundaryData.Add(v2DBList);
                    CAD2DPolyline v2DPolyline = new CAD2DPolyline();
                    v2DBList.Add(v2DPolyline);

                    CAD2DPoint entPoint;

                    CADVertex entVertex;
                    for (int j = 0; j < entPolyline.Entities.Count; j++)
                    {
                        entVertex = (CADVertex)entPolyline.Entities[j];
                        entPoint = new CAD2DPoint(entVertex.Point.X, entVertex.Point.Y);
                        v2DPolyline.Vertexes.Add(entPoint);
                    }

                    v2DPolyline.Closed = true;

                    Hatch.Color = Color.Red;
                    HatchPatternData vHPData = new HatchPatternData();

                    vHPData.baseP = new DPoint(0, 0, 0);
                    vHPData.offset = new DPoint(20, 20, 0);
                    vHPData.lineAngle = 40.0f;
                    vHPData.isDash = false;
                    vHPData.lines = null;
                    vHPData.dashNum = 0;
                    Hatch.HatchPatternData.Add(vHPData);
                    Hatch.Loaded(cadImg_XREF.Converter);
                    cadImg_XREF.CurrentLayout.Entities.Add(Hatch);
                    cadImg_XREF.Converter.OnCreate(Hatch);
                }
            }
            cadImg_XREF.GetExtents();
            CADtoDXF vExp = new CADtoDXF(cadImg_XREF);
            vExp.SaveToFile(@"c:\body.dxf");

            DPoint APos = new DPoint(0, 0, 0);
            DPoint AScale = new DPoint(1, 1, 1);
            float Rotation = 0;
            cadImg.AddScaledDXF(cadImg_XREF, @"c:\body.dxf", APos, AScale, Rotation);

            vExp = new CADtoDXF(cadImg);
            vExp.SaveToFile(@"c:\test.dxf");
        }
Important: this code works with CAD Import .NET v.7 beta. He have sent you a download link via e-mail.

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

Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

Re: MergeFiles Problem

Post by Anderson » 10 Mar 2009, 06:51

Dear Sir,

I copyed the sample code to my program and got two files (body.dxf, test.dxf)
They can be seen in "CADImport.Net - Editor", but when I opened them using AutoCAD 2009 I got the error message

ERROR:
something wrong in reading HATCH (from 840 line)
expected group code 98
DXF invalid input or incomplete - file has been discarded

The two DXF files had been sent to support@cadsofttools.com
Please help me to check this error ?

Best Regards,
Anderson

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

Re: MergeFiles Problem

Post by support » 11 Mar 2009, 10:49

Hello Mr. Anderson,

It is necessary to replace the following lines:

Code: Select all

v2DBList.BoundaryType = 2;
by

Code: Select all

v2DBList.BoundaryType = 7;
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply