solved: wrapping a picture file onto a cylinder

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
byakk0
Posts: 83
Joined: Fri Sep 04, 2020 7:38 pm

solved: wrapping a picture file onto a cylinder

Post by byakk0 »

I need to put a picture (jpg, gif, png, whatever...) on the side of a cylinder. Is there a way to do this?
All I've been able to find with searching don't involve a picture file.

Any ideas?
Thanks.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 (Git)
Build type: Release
Branch: master
Hash: b2ca86d8d72b636011a73394bf9bcdedb3b109b7
Python version: 3.8.8
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Last edited by byakk0 on Tue Jan 04, 2022 8:54 pm, edited 1 time in total.
~~Hazen
chrisb
Veteran
Posts: 53951
Joined: Tue Mar 17, 2015 9:14 am

Re: wrapping a picture file onto a cylinder

Post by chrisb »

- Use Inkscape - another Free program - to create an SVG from yur picture
- import it to FreeCAD
- create a sketch from it Draft->Draft2Sketch
- Use addon Curves workbench to map the sketch on the cylinder.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
byakk0
Posts: 83
Joined: Fri Sep 04, 2020 7:38 pm

Re: wrapping a picture file onto a cylinder

Post by byakk0 »

Sweet.
Thanks Chris! I'll give that a try and get with you.
~~Hazen
byakk0
Posts: 83
Joined: Fri Sep 04, 2020 7:38 pm

Re: wrapping a picture file onto a cylinder

Post by byakk0 »

I finally got a chance to play with this a little. (It's a side project of no particular importance, hench the slowness in my reply)
I took your advice and downloaded inkscape and converted the file.

Anyway, I must either be a lunkhead or just missing something entirely.

I haven't played with the draft workbench before...
I selected Draft workbench-->new.
Imported the SVG file as a drawing. (there is an option to import as SVG. would this be better?)
Now I have a blank draft layout and a tab with the image file.
All the icons are currently greyed out. How do I get the image file moved over to the draft tab, and then convert it to a sketch?
The draft draft2sketch in the wiki doesn't tell me much. https://wiki.freecadweb.org/Draft_Draft2Sketch

Thanks again.
Attachments
F19screenshot.png
F19screenshot.png (141.15 KiB) Viewed 1586 times
~~Hazen
chrisb
Veteran
Posts: 53951
Joined: Tue Mar 17, 2015 9:14 am

Re: wrapping a picture file onto a cylinder

Post by chrisb »

You have to import "SVG as geometry".
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
byakk0
Posts: 83
Joined: Fri Sep 04, 2020 7:38 pm

Re: wrapping a picture file onto a cylinder

Post by byakk0 »

Thanks.
That worked, but I also discovered I had a problem somehow with the SVG file I was using. I picked a different file and it worked.

I also used the help of another post I stumbled across, https://forum.freecadweb.org/viewtopic.php?t=29704

I can see how this would be useful for other projects, but the one I'm currently doing I just simply need a picture/photograph wrapped onto a cylinder. It sounds as if that isn't possible at this point with Freecad. I'll have to do this in Blender
~~Hazen
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: wrapping a picture file onto a cylinder

Post by TheMarkster »

byakk0 wrote: Tue Jan 04, 2022 8:53 pm Thanks.
That worked, but I also discovered I had a problem somehow with the SVG file I was using. I picked a different file and it worked.

I also used the help of another post I stumbled across, https://forum.freecadweb.org/viewtopic.php?t=29704

I can see how this would be useful for other projects, but the one I'm currently doing I just simply need a picture/photograph wrapped onto a cylinder. It sounds as if that isn't possible at this point with Freecad. I'll have to do this in Blender
Attach the file and the svg if you are interested in seeing if it can be done in FreeCAD. You are wanting to change the geometry of the face by cutting or fusing geometry converted from the image or are you wanting simply to have the image on the face for the purpose of making an image of the model?

If you just want the image, try this macro: (Usage: select object, run macro, select image file)

Code: Select all

import FreeCADGui
from PySide import QtGui
from pivy import coin

# get a jpg filename
jpgfilename = QtGui.QFileDialog.getOpenFileName(Gui.getMainWindow(),'Open image file','*.*')

# apply textures
for obj in FreeCADGui.Selection.getSelection():
    rootnode = obj.ViewObject.RootNode
    tex =  coin.SoTexture2()
    tex.filename = str(jpgfilename[0])
    rootnode.insertChild(tex,1)
    if obj.ViewObject.Transparency == 0:
        obj.ViewObject.Transparency = 1
Snip macro screenshot-14ada4.png
Snip macro screenshot-14ada4.png (162.28 KiB) Viewed 1491 times
Note: the texture does not survive reloading the document.
byakk0
Posts: 83
Joined: Fri Sep 04, 2020 7:38 pm

Re: solved: wrapping a picture file onto a cylinder

Post by byakk0 »

Just putting on image on the side of a cylinder.
Like a lable on a jar, or maybe even a Pringles can.
I don't need to do anything with geometries in said image.

I'll dig up the files if need be.
~~Hazen
kisolre
Veteran
Posts: 4165
Joined: Wed Nov 21, 2018 1:13 pm

Re: solved: wrapping a picture file onto a cylinder

Post by kisolre »

Probably use this? https://github.com/furti/FreeCAD-ArchTextures Check the Readme there to see how it works.
Post Reply