How to join two files?

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

How to join two files?

Post by DarkEternal » 23 Feb 2009, 12:33

How can I join , for example two cgm files, from one point?

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

Re: How to join two files?

Post by support » 24 Feb 2009, 16:07

Hello!
Please try the following code:

Code: Select all

uses
  ..., SGDrawingNavigator, sgConsts, CADImage, DXFConv, CGM;
...

procedure TForm1.btnAddScaledDXFClick(Sender: TObject);
var
  vInsImg, vImg: TsgCGMImage;
begin
  vImg := TsgCGMImage.Create;
  vInsImg := TsgCGMImage.Create;
  try
    vImg.LoadFromFile('c:\first.cgm');
    vInsImg.LoadFromFile('c:\second.cgm');

    vImg.AddScaledDXFEx(vInsImg, 'c:\second.cgm',
      MakeFPoint(0,0,0),
      MakeFPoint(1,1,1),0.0);
  vImg.GetExtents;

  finally
    vImg.Free;
    vInsImg.Free;
  end;
end;
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 24 Feb 2009, 18:31

So thanks but I did it. But my problem is now : Second file doesnt be shown on X:200 Y:200,
my code is here :

Code: Select all

var
vGlobalCADFile: TsgDXFImage;
vCADFiles: array [0..1] of TObject;
begin
  vGlobalCADFile := TsgDXFImage.Create;
  vCADFiles[0] := TsgCGMImage.Create;

  TsgDXFImage(vCADFiles[0]).LoadFromFile('D:\dw\52699.cgm');

  vGlobalCADFile.AddScaledDXF(
    vCADFiles[0],
    '52699',
    MakeFPoint(0, 0, 0),
    MakeFPoint(1, 1, 1),
    0.0);

  vCADFiles[1] := TsgCGMImage.Create;

  TsgDXFImage(vCADFiles[1]).LoadFromFile('D:\dw\54599.cgm');

  vGlobalCADFile.AddScaledDXF(
    vCADFiles[1],
    '54599',
    MakeFPoint(200, 200, 0),  // ***  Same as MakeFPoint(0, 0, 0) ***
                              //It doesnt be drawn on X:200,Y:200
    MakeFPoint(1, 1, 1),
    0.0);

    vGlobalCADFile.GetExtents;
    sgPaintBox.Picture.Graphic := vGlobalCADFile;
end;


Am I wrong?

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

Re: How to join two files?

Post by support » 25 Feb 2009, 17:14

Hello!

We tested your code. It worked. We would recommend to use MakeFPoint(2000, 2000, 0) or MakeFPoint(20000, 20000, 0) in the second call of AddScaledDXF. It would make changes visible.

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

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 14 Apr 2009, 13:08

Image

Image

As a result, I want to merge two files from intersection of red lines which user pick. And then one. And then one.
How can I do that?
Last edited by DarkEternal on 14 Apr 2009, 14:11, edited 1 time in total.

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

Re: How to join two files?

Post by support » 14 Apr 2009, 13:49

Hello,

It is necessary to use AddScaledDXF method. Please take a look at the examples in previouse posts.

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

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 14 Apr 2009, 14:13

How Can I find intersection of red lines points and join?

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

Re: How to join two files?

Post by support » 14 Apr 2009, 16:07

CAD Import VCL contains a set of special functions which allow determining intersection point between different objects such as lines, arcs etc.
First of all it is necessary to determine what exactly objects create necessary intersection.

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

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 14 Apr 2009, 16:41

Do you have any example for me?

I want to find just X and Y of point?

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

Re: How to join two files?

Post by support » 14 Apr 2009, 17:01

Could you please send us your file example to support@cadsofttools.com? Please make a reference to this topic in the e-mail.

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

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 15 Apr 2009, 11:58

I have send files...

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

Re: How to join two files?

Post by support » 15 Apr 2009, 12:35

We work on this question. We will answer you soon.

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: How to join two files?

Post by support » 15 Apr 2009, 17:42

Here goes a description how to fulfill the describe task:
  1. open file container
  2. search for lines to be intersected; in your file examples they are TsgDXFPolylines with Red color;
  3. search for intersections between lines found in the previous step; we recommend to use IsCrossSegmentsPts which is available in CAD Import VCL v.7 beta;
  4. open file to be stored in the file container;
  5. insert file to every found intersection points; function AddScaledDXFEx has to be used. If a number of intersection points are more then one, the following algorithm should be used:
    1. AddScaledDXFEx returns TsgDXFInsert object, vXRefIns, for instance;
    2. TsgDXFInsert contains TsgDXFBlock;
    3. create new TsgDXFInsert object;
    4. equate vXRefIns.Block to the new TsgDXFInsert.Block;
    5. set new insert point to TsgDXFInsert.Point (next intersection point);
    6. add new TsgDXFInsert object to the file contaner.
    It is very important: once loaded external file should not be added more then one time using AddScaledDXFEx.
  6. get CADImage object from vXRefIns: TsgDXFInsert->TsgDXFBlock->TsgDXFXref->TsgCADImage.
  7. open next file to be stored in the file container;
  8. repeat steps from 2 to 5;
  9. repeat steps 6 and 7 if it is necessary.
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

DarkEternal
Posts: 26
Joined: 23 Feb 2009, 12:30

Re: How to join two files?

Post by DarkEternal » 16 Apr 2009, 10:12

Is there any more easy way?
Can I put signs on points from autoCad and can I find them with Cad Import Vcl 6.1? First I think that.
Or do you have any easy way suggest?

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

Re: How to join two files?

Post by support » 16 Apr 2009, 10:42

You sent us CGM files. This is not AutoCAD file format. So we suppose it is impossible to make changes to CGM files with AutoCAD.
Accordingly to AutoCAD files and sings on points. It is possible to find anyone object in a drawing if it exists by CAD Import VCL. Please send us (to support@cadsofttools.com) file example to study it and to prepare detailed answer.

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

Post Reply