[Solved-workaround] TD Image - relative path to image-file?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
M4x
Veteran
Posts: 1483
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

[Solved-workaround] TD Image - relative path to image-file?

Post by M4x »

Hey everybody,

I'd like to put an png-image (screenshot) into a TechDraw document. This is working great via TechDraw_Image. But the image isn't a part of the FreeCAD-project or something like that. Instead TechDraw_Image relies on an absolute path to the image file. This isn't very practical if you're thinking about sharing your project (which I'm currently preparing for).

Is there a way to feed TechDraw_Image with a relative path to the image file? I've tried something like "../pictures/example_screenshot.png" but that didn't work out ;)

I've attached an example project to this post (it's a zip-file because the screenshots and folder structure is provided too).

object tree with (part of) path to image
object tree with (part of) path to image
Snip macro screenshot-da73cf.png (63.81 KiB) Viewed 1024 times

Code: Select all

OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25645 (Git) AppImage
Build type: Release
Branch: master
Hash: 37d9757399b4c2ec30318eb88d7cd7c508246345
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
Attachments
example_TD_image_M4x.zip
(28.6 KiB) Downloaded 18 times
Last edited by M4x on Mon Sep 27, 2021 2:56 pm, edited 1 time in total.
User avatar
Shalmeneser
Veteran
Posts: 9560
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: TD Image - relative path to image-file?

Post by Shalmeneser »

Same problem.
I don't have /home/max/Nextcloud/Documents/FreeCAD/Forum/example_TD_image_M4x/example_screenshot.png in my computer :lol:
Modifying the name doesn't seem to help.

Proposition :
* Explain this problem in the wiki
* Modify absolute name to relative name.

Actual solution :
* Put your png in a svg file. SVG file are incorporated, not linked like png.
User avatar
M4x
Veteran
Posts: 1483
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: TD Image - relative path to image-file?

Post by M4x »

Are you kidding me? That's an awesome path :lol: Nevertheless, it should work after adapting the path to the png-file. It does on my system.

Converting it into an svg is an interesting idea. I'll try that.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: TD Image - relative path to image-file?

Post by GeneFC »

Can you bring the file into the Image WB first? Then it will be part of the FCStd document permanently.

Insert the image into a TechDraw page the same way as any other object is inserted.

Gene
User avatar
M4x
Veteran
Posts: 1483
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: TD Image - relative path to image-file?

Post by M4x »

The svg-workaround is looking good.

The workaround using the Image_Workbench sounds interesting too but I'm not able to get it to work. Importing the png-file isn't a problem. But I'm not able to add it to a TechDraw page. I've tried TechDraw_View, TechDraw_ActiveView and even TechDraw_Image.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: TD Image - relative path to image-file?

Post by GeneFC »

M4x wrote: Mon Sep 27, 2021 6:37 am I'm not able to get it to work.
You are correct. :oops:

I thought I had used this, but I cannot make it work.

Gene
User avatar
M4x
Veteran
Posts: 1483
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: TD Image - relative path to image-file?

Post by M4x »

Alright, it wasn't me than :mrgreen:
Post Reply