node editor - pyflow

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Tue Oct 01, 2019 7:28 pm

Kunda1 wrote:
Tue Oct 01, 2019 3:32 pm
microelly2 wrote:
Tue Sep 24, 2019 7:21 pm
very impressive what pyflow can do in the next version. I will start rebase for my FreeCAD version soon.
@microelly2 Question, why are you coding functionality to make pyflow compatible with py2 ? ( https://pythonclock.org/ )
https://github.com/wonderworks-software/PyFlow/pull/48
These are not py2 compatibility patches, I had some erros when pyflow worked inside freecad. So I made a version with some hacks to get it running.
when I rebase my version of pyflow I have to check that it runs with the py3 version of FreeCAD. This will be one of the next steps.
Maybe I get pyflow already running inside FreeCAD without modifications, otherwise I will discuss all conflicts with ilgar next weeks to get the conflicts solved. There was no time during summer to do that, but now raining has started and we can come in to the computers again. :lol:

my todo list for october:

* end user documentation of the existing nodes
* rebase pyflow
* compatibility to py3
* first alpha release
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Wed Oct 09, 2019 2:50 pm

my todo list for october:
* end user documentation of the existing nodes - started in http://freecadbuch.de/doku.php?id=nodes
* rebase pyflow - done, the nodeeditor now works with the original PyFlow@wonderworks-software without extra modifications.
* compatibility to py3 - tested for this environment

OS: Ubuntu 14.04.6 LTS (Unity/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18403 (Git) AppImage
Build type: Release
Branch: master
Hash: 0717b4fc23ef1db70964c3977d25e2fe46a739d1
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
User avatar
Kunda1
Posts: 7091
Joined: Thu Jan 05, 2017 9:03 pm

Re: node editor - pyflow

Postby Kunda1 » Wed Oct 09, 2019 3:39 pm

looo wrote:
Hey @looo is pyflow available in conda ?
ref: https://gitmemory.com/issue/IlgarLunin/ ... /515375539
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
looo
Posts: 3190
Joined: Mon Nov 11, 2013 5:29 pm

Re: node editor - pyflow

Postby looo » Thu Oct 10, 2019 12:55 pm

Kunda1 wrote:
Wed Oct 09, 2019 3:39 pm
looo wrote:
Hey @looo is pyflow available in conda ?
ref: https://gitmemory.com/issue/IlgarLunin/ ... /515375539
I am still waiting for a pypi release. Because this is the easiest way to create a conda-forge feedstock :D
please help with my conda-packaging efforts: https://liberapay.com/looooo/
minimalistic blog: https://looooo.github.io/mini-blog/
foadsf
Posts: 88
Joined: Fri Mar 06, 2015 10:02 pm
Contact:

Re: node editor - pyflow

Postby foadsf » Thu Oct 10, 2019 9:57 pm

I see people on this forum are already aware of Blender's plugin Sverchok. But I would like to also point out at Antimony by Matt Keeter.
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Fri Oct 11, 2019 7:05 am

foadsf wrote:
Thu Oct 10, 2019 9:57 pm
I see people on this forum are already aware of Blender's plugin Sverchok. But I would like to also point out at Antimony by Matt Keeter.
All these implementations use the same ideas. So my goal is to get a base implementation where we can start to port the idea of grashopper, sverchok etc to FreeCAD. Another benefit will be to have all the features from different workbenches in one pool. Pyflow is modular, so it is easy to add more packages. I see at the moment two packages by ilgar: pyrr and maya https://github.com/wonderworks-software
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Mon Oct 14, 2019 3:45 pm

Image
this is one more real application of pyflow nodes.
I worked on steering simulation more than a year ago and stopped because I wondered how to design the user interface. there are a lot of questions the user can investigate and a flexible interface is needed.
with a node for ackermann steering I hope to get a way to simulate chains of trailers too.
https://youtu.be/SBsuudzi0x0
here the pylfow way ..
phpBB [video]

some theory behind ...
sweppath.jpg
sweppath.jpg (54.55 KiB) Viewed 739 times
Lets have a car with one horse.
in my draft b is the horse and a is the center of the wheel axis.
The horse follows the path and goes to b2.
The car follows from a to a2.
In the approximation we assume that we can model
the movement of the whiffletree or horse
by an arc with center m and angle alpha.
the car must do the same rotation from a to a2
that means the angle a m a2 is the same as b m b2
bm == b2m and
am == a2m
the wheels on axis a are perpendicular to the radius am.
if we do not have a horse but a front axis
the front wheels must be perpendicular to the radius bm.
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Tue Oct 15, 2019 7:26 pm

There was a question to design a handrail with pyflow
phpBB [video]

use case:
https://www.jlconline.com/photos/buildi ... d-handrail
User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Wed Oct 16, 2019 9:11 pm

inspired by this question
https://forum.freecadweb.org/viewtopic.php?f=3&t=40141
phpBB [video]


the transformation of the bender node is:

Code: Select all

	for u in range(countA):
		for v in range(countB):
			[x,y,z]=poles[u,v]
			poles2[u,v,0]=(a+x)*cos(b*y+c)
			poles2[u,v,1]=(a+x)*sin(b*y+c)
			poles2[u,v,2]=z

User avatar
microelly2
Posts: 4627
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: node editor - pyflow

Postby microelly2 » Mon Oct 21, 2019 5:15 pm

I love the functionality in grasshopper to display and hide shapes along the workflow, So my idea was to have a method with one mouse click to have the same in FreeCAD.
when a node has an outpin Shape_out I can display this shape temporary, So I debug the intermediate results of a workflow.
No extra node is needed. After restart preview is deactivated by default. When I want a shape in FreeCAD persinstent the view3D node can be used.

phpBB [video]


The preview tool was my first shelftool and it is easy to implement such tools.

Code: Select all

class PreviewTool(ShelfTool):
    """docstring for PreviewTool."""
    def __init__(self):
        super( PreviewTool, self).__init__()

    @staticmethod
    def toolTip():
        return "Preview of a node on/off"

    @staticmethod
    def getIcon():
        return QtGui.QIcon(RESOURCES_DIR + "preview.png")

    @staticmethod
    def name():
        return str("PreviewTool")

    def do(self):
         nodes=FreeCAD.PF.graphManager.get().getAllNodes()
         say("selected Nodes ...")
         for n in nodes:
             if n.getWrapper().isSelected():
                say(n)
                n._preview = not n._preview
                n.preview()