Inkscape Community

Help Using Inkscape => Beyond the Basics => Topic started by: NeckWarmer on September 18, 2017, 09:59:30 AM

Title: Smooth truncated icosahedron
Post by: NeckWarmer on September 18, 2017, 09:59:30 AM
Hi, i've a question to all you: i would to make a soccer ball, and to do this i choosen to render a truncated icosahedron. The result is soddisfying but i need to bend the edges of the polyhedron to simulate the sphericity. For the external edge i've used an inscribed circle  but for the internal hexagon and pentagon i don't know how to achieve this. I need  Could you help me? Please suggest me other methods to make a soccer ball.

Thank you
Title: Re: Smooth truncated icosahedron
Post by: Lazur on September 19, 2017, 09:27:40 AM
Hi.

You can select under by Alt+clicking, and/or change the fill&stroke attributes within the group of paths.
For a reference I'd probably use blender to model a ball with more vertices and export an obj file that the extension could call.

Edit: attaching an obj with 4 nodes/face "edges".
Title: Re: Smooth truncated icosahedron
Post by: brynn on September 19, 2017, 06:53:28 PM
Something is wrong with that zip file.  Windows can unzip at all.  7z extracts it as RAR.  Inside is ball.obj file.  No idea what that is!

Managed to open its code.  Looks like a Blender file?  No wonder -- I don't have Blender installed.
Title: Re: Smooth truncated icosahedron
Post by: Lazur on September 20, 2017, 01:22:54 AM
Had problems zipping it, so used winrar to convert it to rar, and to zip after -rar is not supported by the forum, not sure why if zip is ok-.
But if you could open the obj, that's a good sign. It was meant to be the obj only which is also an unsupported attachment format.

Obj files are not blender's native format, they are so basic inkscape uses them in the render 3D polyhedron extension.
The built-in obj files are located in inkscape/share/extensions/Poly3DObjects. With the extension settings in the inkscape window when run there is a dropdown list to load them in, and also an option to load from file.
The latter should be used if you not copy/paste the obj file in the aforementioned folder.

Only thing I haven't tested is the scale factor -in blender it was 1700 mm wide, so probably it needs to be scaled down.
Title: Re: Smooth truncated icosahedron
Post by: brynn on September 20, 2017, 04:16:15 AM
But if you could open the obj, that's a good sign.

Oh, I never saw an image.  I could only open in the browser, and  I only saw a lot of code, with Blender in the header or metadata.....well the top section of the code.

(Guess I could make RAR accepted as attachment.  Just didn't think it would ever be needed.  Why did you use RAR?)
Title: Re: Smooth truncated icosahedron
Post by: brynn on September 20, 2017, 04:58:30 AM
I would also suggest Blender, if you need this as vector paths.  And if you need it very realistic. Or maybe a CAD program could do it???

If raster is acceptable, I think GIMP has a plugin (or maybe it's a script fu?) that can make images look like they are wrapped around a sphere.  But if not GIMP, I'm sure it could be found in some raster editor, just don't know which (if not gimp).

If it does not need to be precisely realistic, the Envelope Deformation LPE could probablly achieve something more or less close to what you need.  But there is no way to be precise with it.  You  just drag handles until it looks about right.
Title: Re: Smooth truncated icosahedron
Post by: Lazur on September 20, 2017, 08:06:27 AM
Checked the trunc_icos obj file in the Poly3DObjects folder. The ball is 4854 mm wide, so scaled the previously attached obj file accordingly. Here is the updated version:
 [ You are not allowed to view attachments ]

Rar is the default format in win awailable by right click menu. Could figure out this time how to zip it without any rar.

With 2 middle nodes on an "edge" of a "face" of the ball you can set them smooth and add a spiro path to bend edges smoothly.
Not elliptical arcs though, may need some adjustments on the faces near the 3D model's contours.
Title: Re: Smooth truncated icosahedron
Post by: Lazur on September 20, 2017, 08:46:59 AM
So here is how you can use the obj file in inkscape:
https://www.youtube.com/watch?v=G63wAc-drIw


Some years before had taken part of a soccerball design contest, used blender for that to render the 3D -the design was drawn in inkscape.
Not sure if you can open this link, though it would show one example design concept.
example image (https://images-platform.99static.com/UyHx3ClJuzOrdKdTdOZkkELbY3s=/filters:quality(100)/99designs-contests-attachments/20/20056/attachment_20056427)
Title: Re: Smooth truncated icosahedron
Post by: brynn on September 21, 2017, 06:43:39 PM
Yes, I can open the soccerball image page.  That's a nice design!

Following your video, when I try to load ball2.obj into the 3D Polyhedron dialog, I get a Traceback error.  Part of the error seems to indicate that Inkscape didn't find ball2.obj in the extensions directory.  Could you have forgotten to mention that part?  I did wonder why I didn't have to tell Inkscape where the file was.  So that must be, at least part of the problem.

The rest of the traceback.....well let's see.  I'll put the file in the extensions folder, to find out how much of the traceback gets fixed, because there are 5 or 6 lines of errors.  Oh geez -- it has to be in the program files directory!  Well no, not that either. I really can only guess what the traceback errors mean. 

Here's the Traceback:

Traceback (most recent call last):
  File "polyhedron_3d.py", line 531, in <module>
    e.affect()
  File "inkex.py", line 283, in affect
    self.effect()
  File "polyhedron_3d.py", line 461, in effect
    get_obj_data(obj, file)#load data from the obj file
  File "polyhedron_3d.py", line 90, in get_obj_data
    infile = open(objfile(name))
IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\Inkscape 0.92.2\\inkscape\\share\\extensions\\Poly3DObjects\\ball2.obj'

Is that anything I can fix myself?

(btw, moving this to the advanced board - links will be provided)
Title: Re: Smooth truncated icosahedron
Post by: Lazur on September 22, 2017, 12:46:44 AM
Besides moving the file into the "C:\\Program Files\\Inkscape 0.92.2\\inkscape\\share\\extensions\\Poly3DObjects\\" folder? No, that should do it as seen in the video.

Part of the error seems to indicate that Inkscape didn't find ball2.obj in the extensions directory.  Could you have forgotten to mention that part?


The built-in obj files are located in inkscape/share/extensions/Poly3DObjects. With the extension settings in the inkscape window when run there is a dropdown list to load them in, and also an option to load from file.
The latter should be used if you not copy/paste the obj file in the aforementioned folder.

Also mentioned in the video description
Quote
With the load from file you can accept custom modelled obj files if you save them in the inkscape/share/extensions/poly3Dobjects folder.

Right next to the other existing obj files.