Sverchok and FreeCAD

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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Sverchok and FreeCAD

Post by Kunda1 »

There is a buzz these days about the blender addon called Sverchok
СВеРЧОК, The Russian word for Cricket, is pronounced "Sverchok" in English.

Sverchok is a parametric tool for Blender built to help generate complex 3d shapes using a node system to control the flow of math and geometry. It is ideally suited to Architects and Designers, but anyone with highschool Math and Trigonometry will be able to produce results that are impossible to achieve unless you know text based programming languages such as Python or C.

Those familiar with Houdini, Rhinoceros3D (Grasshopper), Dynamo or other modular systems should feel at home using our addon. Sverchok is not an attempt to clone existing packages or workflows, but a chance to experiment with different approaches to similar constraints.
Source http://nortikin.github.io/sverchok/

I started this post to follow it's development and also see its interoperability with FreeCAD. In fact there has been recent news of FreeCAD being used in it's workflow.
FreeCAD-Sverchok-Workflow.jpg
FreeCAD-Sverchok-Workflow.jpg (299.29 KiB) Viewed 6377 times
Some notable links: In fact, a Sverchok dev 'portnov' has posted on the forum already (thread)
So, I've CC'd @portnov below with the intention of helping the community understand more more in depth what the possibilities are between these 2 projects.
portnov wrote: :bell:
@portnov hope you're OK with this? Do you mind explaining some of your ideas and how FreeCAD could fit in to them currently and in the future?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Sverchok and FreeCAD

Post by vocx »

@nikitron has been involved with the OSArch community to improve Sverchok for architectural uses.

Ladybug Tools for Sverchok and Blender

Dion Moult has also suggested porting the Ladybug tools for energy analysis to FreeCAD through microelly's PyFlow/NodeEditor, however, the current status of NodeEditor is uncertain.

Solar diagrams
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Sverchok and FreeCAD

Post by yorik »

Note that the Arch WB already uses Ladybug. So far, it's only to produce solar and wind diagrams. The more interesting stuff (energy analyses) requires analytics models, which the Arch WB doesn't do very well yet.

What the sverchok people are doing is amazing, though. Almost another, new interface to FreeCAD...
User avatar
portnov
Posts: 8
Joined: Tue Sep 08, 2020 2:47 pm

Re: Sverchok and FreeCAD

Post by portnov »

Well, feel free to ask if you have questions :)

What I can say in general, Sverchok just uses FreeCAD's python API (mostly Part module), and gives you node-based UI for possibilities of that API. Not all of that API is available as nodes (and at the moment there is no goal to make it so), but most usable features are.
Another thing is that Sverchok has some support for NURBS, including some algorithms for them, like "ruled surface", "loft", "sweep", "coons surface". And FreeCAD's API understands NURBS too. So it is possible, for example, to define a surface by lofting with Sverchok native algorithm, then pass it to FreeCAD-based "extrude" node to make a solid. Or vice versa, take a surface from a body defined with FreeCAD-based nodes.

There is some documentation about these things:
https://github.com/nortikin/sverchok/bl ... solids.rst
https://github.com/nortikin/sverchok/bl ... /nurbs.rst
https://github.com/nortikin/sverchok/tr ... odes/solid

If you need to generate one object, and you know it's parameters (like dimensions) in advance, it's probably simpler to make it with FreeCAD's native GUI. In non-trivial objects, there are relations between different parameters of the object, like "radius of this fillet must be twice height of that bump", and so on; FreeCAD supports expressions, but for one object it's simpler (imho) to just calculate all such things in advance and put specific numbers into parameters of primitives.
But if you have a complex object (or many objects), defined by many parameters with many relations between them, and then you want to be able to change parameters, or generate many variants of the same object with different parameters at once, you probably will prefer node-based approach. Sverchok is also known for it's "vectorization" feature, which allows you to do things like "for each value in this list of possible widths, make a box of this width" very easily. Though it is possible with FreeCAD's expressions + some python macros, probably.
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Sverchok and FreeCAD

Post by paullee »

Looks cool!

But have difficulty to understand what actually Sverchok and Pyflow do ? :oops:
User avatar
portnov
Posts: 8
Joined: Tue Sep 08, 2020 2:47 pm

Re: Sverchok and FreeCAD

Post by portnov »

Kunda1 cited Sverchok's readme. It's an addon for Blender, which provides node-based UI for geometry generation and manipulation. Blender is mesh-based modelling software, so most of tools Sverchok provides are mesh-based too. But Sverchok also has higher-level concepts such as curves and surfaces.
In node editors, you have concept of abstract (not visible in scene) "geometry" and it's details (like vertices or edges, or just vectors and matrices, or curves and surfaces), which "flows" from input nodes through other nodes to outputs. Nodes do something with this geometry according to their settings. Output nodes create actual objects in 3D scene based on geometry information they receive; there are also "viewer" nodes, that allow you to preview generated objects in 3D view without creating actual objects, and create objects only when you explicitly say it ("baking" process).
Manipulating with nodes is similar to manipulating with document tree in FreeCAD; key differences are (imho):
  1. nodes can form arbitrary graphs, not only tree;
  2. some nodes give much higher abstraction level, comparing to nodes in FreeCAD's document tree: nodes are not bound to manipulate with concrete objects like solids or meshes, there are things like "matrix multiplication" or "quaternion addition"; where these matrices come from and why do you want to multiply them, and how they end up in geometry is completely your choice;
  3. while document tree is more like "additional tool for general reference", node tree is main thing which you use to define geometry.
  4. vectorization feature I mentioned earlier.
In fact, people are referring to Sverchok as "visual programming language", because by configuring nodes and linking them you are in fact writing a program, which says what geometry do you want. Just instead of code you have checkboxes, dropdown menus and node links.
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Sverchok and FreeCAD

Post by flachyjoe »

Hi,
without known about Sverchok, I recently write a macro to link FreeCAD to PureData. PureData is a well known "visual programming language" for multimedia. It natively processes text messages so we can imagine use text representation of FC objects (shapes or placement or anything other) as input and output of PureData patches.
Here is the post in the french forum https://forum.freecadweb.org/viewtopic. ... 6&p=441086 (macro is english commented).
Last edited by flachyjoe on Tue Oct 20, 2020 2:36 pm, edited 1 time in total.
- Flachy Joe -
Image
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Sverchok and FreeCAD

Post by bitacovir »

paullee wrote: Tue Oct 13, 2020 2:43 am Looks cool!

But have difficulty to understand what actually Sverchok and Pyflow do ? :oops:
In addition of what portnov said, this visual scripting has become very popular between users. In fact, Robert McNeel & Associates included Grasshopper3D to their last version of Rhinoceros program and Autodesk added Dynamo to their Revit software.
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Sverchok and FreeCAD

Post by Jee-Bee »

flachyjoe wrote: Tue Oct 20, 2020 11:53 am Hi,
without known about Sverchok, I recently write a macro to link FreeCAD to PureData.
cool :geek:
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Sverchok and FreeCAD

Post by Kunda1 »

flachyjoe wrote: Tue Oct 20, 2020 11:53 am Hi,
without known about Sverchok, I recently write a macro to link FreeCAD to PureData. PureData is a well known "visual programming language" for multimedia. It natively processes text messages so we can imagine use text representation of FC objects (shapes or placement or anything other) as input and output of PureData patches.
Here is the post in the french forum https://forum.freecadweb.org/viewtopic. ... 6&p=441086 (macro is english commented).
Can you open a User Showcase thread so we don't hijack this one?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply