connecting freecad and inkscape/gimp

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

connecting freecad and inkscape/gimp

Postby microelly2 » Wed Oct 18, 2017 2:32 pm

For face painting I want to connect FreeCAD and drawing programs (inkscape and gimp).

inkscape can be used to draw vector graphics and gimp for textures.
pixel images can be used for design purposes too.
One inspiration was this video
phpBB [video]



both gimp and inkscape supprot python, so a client server connection between running instances should be possible.
That means that the change of an object in any of these programs should update the instance in the other one.

Here some results of my work.

import/link an inkscap svg file
phpBB [video]




conversion of the imported faces into sketcher format
phpBB [video]
User avatar
Kunda1
Posts: 3940
Joined: Thu Jan 05, 2017 9:03 pm

Re: connecting freecad and inkscape/gimp

Postby Kunda1 » Wed Oct 18, 2017 5:20 pm

Very cool! Do you mind sharing the code for this?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: connecting freecad and inkscape/gimp

Postby microelly2 » Wed Oct 18, 2017 8:30 pm

Kunda1 wrote:
Wed Oct 18, 2017 5:20 pm
Very cool! Do you mind sharing the code for this?
At the moment I put it all into the nurbs WB because it's for the shoelast project.
User avatar
regis
Posts: 655
Joined: Sun Jul 12, 2015 8:17 am
Contact:

Re: connecting freecad and inkscape/gimp

Postby regis » Wed Oct 18, 2017 8:58 pm

This is epic.
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: connecting freecad and inkscape/gimp

Postby microelly2 » Wed Nov 15, 2017 12:51 pm

I think this can be the first testable version of the inkscape freecad connection
phpBB [video]
User avatar
Kunda1
Posts: 3940
Joined: Thu Jan 05, 2017 9:03 pm

Re: connecting freecad and inkscape/gimp

Postby Kunda1 » Wed Nov 15, 2017 2:39 pm

Nicely done. Would it be possible to open a dedicated widget inside FC so there is no need run inkscape, AKA can it run headless inside of FC ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: connecting freecad and inkscape/gimp

Postby microelly2 » Wed Nov 15, 2017 2:55 pm

Kunda1 wrote:
Wed Nov 15, 2017 2:39 pm
Nicely done. Would it be possible to open a dedicated widget inside FC so there is no need run inkscape, AKA can it run headless inside of FC ?
I still have no idea how this can be done.

The other possibility is to write a inkscape addon which triggers the update of the freecad data without the extra "save" method invocation.
my idea is to write a temporary file with the current content of the active inkscape window and calcucate a "preview" model in freecad until the
change in inkscape is saved. then a complete update of the freecad scene can be executed.
User avatar
Kunda1
Posts: 3940
Joined: Thu Jan 05, 2017 9:03 pm

Re: connecting freecad and inkscape/gimp

Postby Kunda1 » Wed Nov 15, 2017 3:32 pm

microelly2 wrote:
Wed Nov 15, 2017 2:55 pm
The other possibility is to write a inkscape addon which triggers the update of the freecad data without the extra "save" method invocation.
my idea is to write a temporary file with the current content of the active inkscape window and calcucate a "preview" model in freecad until the
change in inkscape is saved. then a complete update of the freecad scene can be executed.
I asked on #inkscape freenode

Code: Select all

[09:58] <kunda_> Mc, what about the other way, code something on the inkscape side as mentioned above ?
[09:59] <@Mc> the python addons already write the complete svg file
[09:59] <@Mc> so it's doable to also write it to a place where freecad will automatically find it
[10:07] <kunda_> Mc, what do you mean by the "python addons already write the complete svg file" which addon? An inkscape addon ?
[10:08] <@Mc> inkscape addons basicaly are simple python files that read the svg files, modify it as they please, and write it back (and it's reloaded by inkscape)
Edit: @microelly2 check out https://medium.com/@xaviju/inkscape-ext ... 72dda360fe
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: connecting freecad and inkscape/gimp

Postby microelly2 » Wed Nov 15, 2017 4:42 pm

Kunda1 wrote:
Wed Nov 15, 2017 3:32 pm

I asked on #inkscape freenode

Code: Select all


[10:08] <@Mc> inkscape addons basicaly are simple python files that read the svg files, modify it as they please, and write it back (and it's reloaded by inkscape)
:D land ahoy
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: connecting freecad and inkscape/gimp

Postby microelly2 » Wed Nov 15, 2017 5:56 pm

bp_622.png
bp_622.png (342.22 KiB) Viewed 922 times
If it is possible to draw faces then faces with holes should be possible too.

So there is a brezel object: create a subface with up to 3 holes on a surface by (up to 4) closed curves.

Now we can design our shoes to have a hole where the foot can slip in
and another where the water can flow out. :lol: