Page 1 of 2
How to join two files?
Posted: 23 Feb 2009, 12:33
by DarkEternal
How can I join , for example two cgm files, from one point?
Re: How to join two files?
Posted: 24 Feb 2009, 16:07
by support
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.
Re: How to join two files?
Posted: 24 Feb 2009, 18:31
by DarkEternal
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?
Re: How to join two files?
Posted: 25 Feb 2009, 17:14
by support
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.
Re: How to join two files?
Posted: 14 Apr 2009, 13:08
by DarkEternal
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?
Re: How to join two files?
Posted: 14 Apr 2009, 13:49
by support
Hello,
It is necessary to use AddScaledDXF method. Please take a look at the examples in previouse posts.
Sergey.
Re: How to join two files?
Posted: 14 Apr 2009, 14:13
by DarkEternal
How Can I find intersection of red lines points and join?
Re: How to join two files?
Posted: 14 Apr 2009, 16:07
by support
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.
Re: How to join two files?
Posted: 14 Apr 2009, 16:41
by DarkEternal
Do you have any example for me?
I want to find just X and Y of point?
Re: How to join two files?
Posted: 14 Apr 2009, 17:01
by support
Could you please send us your file example to
support@cadsofttools.com? Please make a reference to this topic in the e-mail.
Sergey.
Re: How to join two files?
Posted: 15 Apr 2009, 11:58
by DarkEternal
I have send files...
Re: How to join two files?
Posted: 15 Apr 2009, 12:35
by support
We work on this question. We will answer you soon.
Sergey.
Re: How to join two files?
Posted: 15 Apr 2009, 17:42
by support
Here goes a description how to fulfill the describe task:
- open file container
- search for lines to be intersected; in your file examples they are TsgDXFPolylines with Red color;
- 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;
- open file to be stored in the file container;
- 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:
- AddScaledDXFEx returns TsgDXFInsert object, vXRefIns, for instance;
- TsgDXFInsert contains TsgDXFBlock;
- create new TsgDXFInsert object;
- equate vXRefIns.Block to the new TsgDXFInsert.Block;
- set new insert point to TsgDXFInsert.Point (next intersection point);
- 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.
- get CADImage object from vXRefIns: TsgDXFInsert->TsgDXFBlock->TsgDXFXref->TsgCADImage.
- open next file to be stored in the file container;
- repeat steps from 2 to 5;
- repeat steps 6 and 7 if it is necessary.
Sergey.
Re: How to join two files?
Posted: 16 Apr 2009, 10:12
by DarkEternal
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?
Re: How to join two files?
Posted: 16 Apr 2009, 10:42
by support
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.