Skip to main content

I have a workspace that I've published out as a server app. This allows users to select an area on a map, select layers that they would like and exports it out to a CAD file that is then emailed to the user as an attachment.

 

Part of the export is a clipped, georeferenced ortho image.

 

After the dwg is emailed and opened, the image does not show up. You can see a frame and basically a broken reference.

 

I'm assuming that this is part of a CAD limitation in how images are managed, but figured I'd ask, in case someone has figured out how to do this.

 

Is there a way to successfully include an image inside of a CAD drawing and email that drawing without losing the image?

 

Hopefully this makes sense...

 

Thanks!

 

Eugene D.

It depends on the CAD format. If it's MicroStation, then I think the answer is no. But for AutoCAD, the Readers and Writers manual says that raster is supported.

In fact, this question suggests that what you want is possible. It looks like all you need to do is write the raster straight to the DWG file and it will be fine. I don't see any parameters in the writer or feature type that controls or sets raster writing.

So give it a try, and if it fails, then do let us know, with whatever warnings or errors the log file provides.


Thank you for the quick response @mark2atsafe​. I am using Autocad (DWG/DXF) writer and am able to get it to work when the drawing is saved on the network someplace. However, what I'm really after is, the ability to send that .dwg with the image, so that when the end user opens it, the image is still with the CAD file. What I'm experiencing is the image is converted to a .png, then the reference is broken.


AutoCAD will only reference other files such as images. Not imbed them. That’s why the reference is breaking. I’m curious what the end goal is. Why not simply send the image on its own? An image is no more use to a CAD user referenced or included on its own for the user to reference at their own discretion. That said there is a way of making the reference retain its link to the image during file transfers. The path type of the reference must be set to ‘relative’ or ‘no path’. This means provided the AutoCAD file is opened from the same location as the image the link will be retained. I’m unsure though if you can specify this setting in the FME dwg writer. Have not tried this myself.


Thank you for the quick response @mark2atsafe​. I am using Autocad (DWG/DXF) writer and am able to get it to work when the drawing is saved on the network someplace. However, what I'm really after is, the ability to send that .dwg with the image, so that when the end user opens it, the image is still with the CAD file. What I'm experiencing is the image is converted to a .png, then the reference is broken.

Can you write the output to a zip file? Then it might include the raster in the content that is delivered. If - as I assume - the DWG writer is writing the raster as a file, then that should work. But I'll do a bit of a test here too, to see what happens.


Thank you for the quick response @mark2atsafe​. I am using Autocad (DWG/DXF) writer and am able to get it to work when the drawing is saved on the network someplace. However, what I'm really after is, the ability to send that .dwg with the image, so that when the end user opens it, the image is still with the CAD file. What I'm experiencing is the image is converted to a .png, then the reference is broken.

So I see that the raster data is written alongside the DWG file, and if that is part of a Data Download, the result is a zip file containing both data files. So the file is delivered, just not referenced. I really don't know how rasters are referenced inside a DWG file. Hmm... according to this document it looks like we can reference an external file from an AutoCAD point feature, but at the same time this Idea says that it isn't possible for images. I would give that a try anyway. You'd need to create a feature with autocad_entity set to autocad_ref I think, also with autocad_xref_path pointing to the raster file. But if that doesn't work, then I'm not sure I have an alternative solution.


AutoCAD will only reference other files such as images. Not imbed them. That’s why the reference is breaking. I’m curious what the end goal is. Why not simply send the image on its own? An image is no more use to a CAD user referenced or included on its own for the user to reference at their own discretion. That said there is a way of making the reference retain its link to the image during file transfers. The path type of the reference must be set to ‘relative’ or ‘no path’. This means provided the AutoCAD file is opened from the same location as the image the link will be retained. I’m unsure though if you can specify this setting in the FME dwg writer. Have not tried this myself.

Thank you for your reply. The end goal is to provide the user with a product that allows them to get to work as quickly as possible by eliminating steps that they will have to perform once they have the CAD drawing on hand. I understand that it's relatively easy to go in and reference the images once you have both the image and the CAD files; but the idea is to simplify this experience to the max. Ultimately, likely due to limitations in AutoCAD, we may end up just sending multiple files and have the users set up referencing...


Can you write the output to a zip file? Then it might include the raster in the content that is delivered. If - as I assume - the DWG writer is writing the raster as a file, then that should work. But I'll do a bit of a test here too, to see what happens.

Thank you Mark; I was going to try that (sending a .zip file) next. I know that some/many email systems block .zip file attachments, so it could create other issues, but I will certainly give it a try. Yes; the writer is writing out a .png file and if the file is stored in the same location as the CAD file, everything works fine. I'll continue to test other options, including exploring the ability to save relative paths as someone suggested.


Thank you for the quick response @mark2atsafe​. I am using Autocad (DWG/DXF) writer and am able to get it to work when the drawing is saved on the network someplace. However, what I'm really after is, the ability to send that .dwg with the image, so that when the end user opens it, the image is still with the CAD file. What I'm experiencing is the image is converted to a .png, then the reference is broken.

Also check that autocad_raster_display_opt_show is set to Yes. Otherwise just the bounding box is displayed. There look to be a gold mine of format attributes in the R+W manual, so it's worth trying out a few of them.


Thank you for your reply. The end goal is to provide the user with a product that allows them to get to work as quickly as possible by eliminating steps that they will have to perform once they have the CAD drawing on hand. I understand that it's relatively easy to go in and reference the images once you have both the image and the CAD files; but the idea is to simplify this experience to the max. Ultimately, likely due to limitations in AutoCAD, we may end up just sending multiple files and have the users set up referencing...

fwiw, our AutoCAD expert at Safe says: "Writing the raster to DWG should create an image XREF inside the DWG file, along with the PNG. You should see the image in AutoCAD."

I'm just wondering, can you see that image when you write locally? I'm unsure at this point whether the problem is not creating the XREF, or the raster being lost when it's sent via Data Download. Or both?!


Thank you for your reply. The end goal is to provide the user with a product that allows them to get to work as quickly as possible by eliminating steps that they will have to perform once they have the CAD drawing on hand. I understand that it's relatively easy to go in and reference the images once you have both the image and the CAD files; but the idea is to simplify this experience to the max. Ultimately, likely due to limitations in AutoCAD, we may end up just sending multiple files and have the users set up referencing...

So after more troubleshooting... here's what I'm finding:

  1. When using FME Workbench (desktop) and writing to a local or network location; the image is automatically converted to .png and exported, written out, and placed next to the CAD file (with same name). When opened, the CAD file successfully shows the referenced image. Works great!
  2. When using FME Server app; I believe it's the streaming service... it automatically writes out a .zip file (without me having to add any additional transformers) to the downloads folder on my system. The .zip file contains the CAD file along with the referenced image. When extracted; to a common folder, the CAD file successfully shows the referenced image. Works great!
  3. When emailing the CAD file; the reference image does not get included. The system does not automatically create a .zip file with both items. The CAD file is sent; however, when opened, it tells us that references are lost.

Thanks for looking into this Mark.


Not an answer sorry, but a further question. I want to create a dwg that references an ecw. At the moment this seems impossible. There is an automatic conversion to a png, with apparently no control over that.

I overwrote the autocad_raster_filename attribute to a corresponding ecw name but this just broke the dwg. Is there a way to create the dwg for an ecw?


Reply