Embed images into DXF file
Moderators: SDS, support, admin
-
- Posts: 5
- Joined: 04 Dec 2013, 14:21
Embed images into DXF file
Hello.
I am using the entitiesTsgDXFImageDef and TsgDXFImageEnt to include images into my code generated DXF file. But when I save the DXF the images are saved as refX (External references) and my clients cannot view this images. (Autocad show only the link)
I need to embed the images into the file. ¿How can i do it?
I am a registered user of CAD Export VCL 9.1.5
Best Regards.
I am using the entitiesTsgDXFImageDef and TsgDXFImageEnt to include images into my code generated DXF file. But when I save the DXF the images are saved as refX (External references) and my clients cannot view this images. (Autocad show only the link)
I need to embed the images into the file. ¿How can i do it?
I am a registered user of CAD Export VCL 9.1.5
Best Regards.
Re: Embed images into DXF file
Hello Jose,
You need to use TsgDXFOle2Frame entity for embedding a raster image into a DXF file. The code below generates TsgDXFOle2Frame entity from the bitmap stored in a file and inserts it at some point with X, Y coordinates.
Mikhail.
You need to use TsgDXFOle2Frame entity for embedding a raster image into a DXF file. The code below generates TsgDXFOle2Frame entity from the bitmap stored in a file and inserts it at some point with X, Y coordinates.
Code: Select all
uses
..., sgOLE;
var
Img: TsgCADImage;
...
procedure AddImageAsOLE(AFileName: string; AX, AY: TsgFloat);
var
vBitmap: TBitmap;
vOLE2Frame: TsgDXFOle2Frame;
begin
vOLE2Frame := TsgDXFOle2Frame.Create;
vBitmap := TBitmap.Create;
try
vBitmap.LoadFromFile(AFileName);
vOLE2Frame.BinaryData := CreateSTGMFromImage(vBitmap, CF_BITMAP);
vOLE2Frame.Point := MakeFPoint(AX, AY, 0);
vOLE2Frame.Point1 := MakeFPoint(vOLE2Frame.Point.X + vBitmap.Width, vOLE2Frame.Point.Y + vBitmap.Height, 0);
finally
vBitmap.Free
end;
Img.CurrentLayout.AddEntity(vOLE2Frame);
if Assigned(Img.Converter.OnCreate) then
Img.Converter.OnCreate(vOLE2Frame);
Img.Converter.Loads(vOLE2Frame);
end;
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
-
- Posts: 5
- Joined: 04 Dec 2013, 14:21
Re: Embed images into DXF file
Perfect!
Works like a charm.
Thanks so much.
Works like a charm.
Thanks so much.
-
- Posts: 9
- Joined: 25 Mar 2010, 10:07
Re: Embed images into DXF file
Hello,
I tried your code snippet within my project loaded a *.stl file, does not work. Is it possible to embedd bmp within a *.stl file?
I tried your code snippet within my project loaded a *.stl file, does not work. Is it possible to embedd bmp within a *.stl file?
Re: Embed images into DXF file
Hello,
It is possible to embed a BMP image into an STL file as the Ole2Frame object. Make sure you reload a CAD image into Tsg3DDrawingNavigator after embedding a BMP image:
Mikhail
It is possible to embed a BMP image into an STL file as the Ole2Frame object. Make sure you reload a CAD image into Tsg3DDrawingNavigator after embedding a BMP image:
Code: Select all
FImg: TsgCADImage;
F3DN: Tsg3DDrawingNavigator;
...
AddImageAsOLE('c:\image.bmp', 0, 0);
F3DN.LoadFromConverter(FImg.Converter, FImg);
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support