FreeCAD Nodes (renamed from fc_nodes)

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by drmacro »

j8sr0230 wrote: Wed Nov 30, 2022 9:30 pm ...
Used the File>Save menu to save them.

But, they saved with no extension and the File>Open doesn't see them.

...
Thanks for your report!. Actually, the files should be automatically saved as JSON files. Can you open them when you append *.json to your files?
Now have 0.1.24 installed.

Saved node files still don't load.

Edit: One issue appears to be that if there is the node file includes a CViewer node and there is no document in FreeCAD the opening of the node file fails. But, this does not correct the open error in other cases.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by drmacro »

In the process of trying to figure out what Im doing wrong saving the node json files I reproduced one of the examples shown on github.

I think this duplicates https://github.com/j8sr0230/Nodes/blob/ ... _shape.gif
newaligshapes-6.png
newaligshapes-6.png (115.9 KiB) Viewed 2444 times
But, when I move the slider I get this:
newalignshape-6.gif
newalignshape-6.gif (198.46 KiB) Viewed 2444 times
Attachments
newalignshapes-6.json.zip
(21.65 KiB) Downloaded 44 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by drmacro »

After Nodes update with Addonmanager, none of my json files will load. :(

Code: Select all

Traceback (most recent call last):
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_scene.py", line 397, in deserialize
    new_node = self.getNodeClassFromData(node_data)(self)
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_scene.py", line 360, in getNodeClassFromData
    return Node if self.node_class_selector is None else self.node_class_selector(data)
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_sub_window.py", line 50, in get_node_class_from_data
    return NodesStore.get_class_from_opcode(data['op_code'])
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_conf.py", line 44, in get_class_from_opcode
    raise OpCodeNotRegistered("OpCode '%d' is not registered" % op_code)
11:13:11  TypeError: %d format: a number is required, not str
11:13:11  Traceback (most recent call last):
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_scene.py", line 327, in loadFromFile
    self.deserialize(data)
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_scene.py", line 435, in deserialize
    new_edge = Edge(self).deserialize(edge_data, hashmap, restore_id, *args, **kwargs)
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_edge.py", line 301, in deserialize
    self.end_socket = hashmap[data['end']]
11:13:11  KeyError: 139971523285200
11:13:11  Traceback (most recent call last):
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_default_node.py", line 297, in eval
    return self.eval_primer()[index]
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_default_node.py", line 338, in eval_primer
    self.markDescendantsDirty()
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_node.py", line 345, in markDescendantsDirty
    for other_node in self.getChildrenNodes():
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_node.py", line 414, in getChildrenNodes
    other_node = edge.getOtherSocket(self.outputs[ix]).node
11:13:11  AttributeError: 'NoneType' object has no attribute 'node'
11:13:11  
During handling of the above exception, another exception occurred:

11:13:11  Traceback (most recent call last):
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_window.py", line 137, in onFileOpen
    if nodeeditor.fileLoad(file_name):
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_sub_window.py", line 63, in fileLoad
    self.do_eval_outputs()
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_sub_window.py", line 56, in do_eval_outputs
    node.eval()
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./core/nodes_default_node.py", line 302, in eval
    self.markDescendantsDirty()
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_node.py", line 345, in markDescendantsDirty
    for other_node in self.getChildrenNodes():
11:13:11    File "/home/mac/.local/share/FreeCAD/Mod/Nodes/./lib/nodeeditor/node_node.py", line 414, in getChildrenNodes
    other_node = edge.getOtherSocket(self.outputs[ix]).node
11:13:11  AttributeError: 'NoneType' object has no attribute 'node'
11:13:11  







Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (XFCE/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31238 (Git)
Build type: Release
Branch: master
Hash: 6f0afb4d0b8b7a901a8b5b54e07c25e36e840548
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 7.1.1, OCC 7.5.1
Locale: English/United States (en_US)
Installed mods: 
  * parts_library
  * kicadStepUpMod 10.16.5
  * Manipulator 1.4.9
  * PrefExtras
  * QuickMeasure 2022.10.28
  * MyDefaults 2022.9.15
  * ZolkoBase 0.0.1
  * DynamicData 2.46.0
  * fasteners 0.4.25
  * Nodes 0.1.26
  * MacMechX 2022.9.15
  * ExtremeProDark 2.6.4
  * ProDarkThemePreferencePack 1.0.0
  * fcgear 1.0.0
  * plugins
  * Pyramids-and-Polyhedrons
  * Defeaturing 1.2.0
  * Assembly4 0.12.4
  * BaseTest 0.0.1
  * OpticsWorkbench 1.0.9
  * workfeature-macro
  * sheetmetal 0.2.59
  * A2plus 0.4.60f
  * CurvedShapes 1.0.4
  * BasicMech 0.0.1
  * Dracula 0.0.2
  * Curves 0.6.4
  * workfeature
  * lattice2 1.0.0
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
j8sr0230
Posts: 140
Joined: Thu Apr 07, 2022 8:59 am
Location: Chemnitz
Contact:

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by j8sr0230 »

drmacro wrote: Fri Dec 02, 2022 3:47 pm In the process of trying to figure out what Im doing wrong saving the node json files I reproduced one of the examples shown on github.

I think this duplicates https://github.com/j8sr0230/Nodes/blob/ ... _shape.gif

newaligshapes-6.png

But, when I move the slider I get this:
newalignshape-6.gif
Hello, I have reworked the Align node again and made it a bit more user friendly. The Align node now has a pivot socket that allows you to easily define the pivot point of the rotation. Alternatively, you can use the new Dir(ection) socket of the Box node, with which you could directly align the generated Box instances to the sphere surface (see attachment).
Node graph
Node graph
align_boxes_node_graph.PNG (240.36 KiB) Viewed 2233 times
Result
Result
align_boxes_node_graph_result.PNG (524.06 KiB) Viewed 2233 times
Codelink on GitHub: https://github.com/j8sr0230/codelink
Codelink on PiPy: https://pypi.org/project/codelink/
FreeCAD Nodes Workbench on GitHub: https://github.com/j8sr0230/Nodes
User avatar
j8sr0230
Posts: 140
Joined: Thu Apr 07, 2022 8:59 am
Location: Chemnitz
Contact:

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by j8sr0230 »

drmacro wrote: Tue Dec 06, 2022 4:18 pm After Nodes update with Addonmanager, none of my json files will load. :(
Thanks for your feedback. I am really sorry about that, but it is not a bug. My latest update brings significant improvement regarding the Array Broadcastig API of the node editor. Unfortunately I had to adapt many nodes for this purpose. Whenever the node interface (e.g. sockets) has changed, a preheat compatibility is not given... However, your data is not lost! I could send you an image of the Workbench preversion, which you then only have to copy into your FreeCAD user directory, to run the old node editor. This way you could create snapshots of your node graphs. Alternatively, you could also fork the previous version from my repository... Sorry for the circumstances! By the way, does the saving and loading of graphs work for you now?
Codelink on GitHub: https://github.com/j8sr0230/codelink
Codelink on PiPy: https://pypi.org/project/codelink/
FreeCAD Nodes Workbench on GitHub: https://github.com/j8sr0230/Nodes
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by drmacro »

j8sr0230 wrote: Tue Dec 06, 2022 6:24 pm
drmacro wrote: Tue Dec 06, 2022 4:18 pm After Nodes update with Addonmanager, none of my json files will load. :(
Thanks for your feedback. I am really sorry about that, but it is not a bug. My latest update brings significant improvement regarding the Array Broadcastig API of the node editor. Unfortunately I had to adapt many nodes for this purpose. Whenever the node interface (e.g. sockets) has changed, a preheat compatibility is not given... However, your data is not lost! I could send you an image of the Workbench preversion, which you then only have to copy into your FreeCAD user directory, to run the old node editor. This way you could create snapshots of your node graphs. Alternatively, you could also fork the previous version from my repository... Sorry for the circumstances!
I can proceed with the new. I have nothing that extensive.

It would be nice if the example node graphs could be available though rather than having to create them from a picture... ;)
I tried to read your code to see if I could find issues, but, with no comments...not much help.
By the way, does the saving and loading of graphs work for you now?
It did for like two days...until I did the Addon manager update. :lol:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
j8sr0230
Posts: 140
Joined: Thu Apr 07, 2022 8:59 am
Location: Chemnitz
Contact:

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by j8sr0230 »

drmacro wrote: Fri Dec 02, 2022 2:13 pm
j8sr0230 wrote: Wed Nov 30, 2022 9:30 pm ...
Used the File>Save menu to save them.

But, they saved with no extension and the File>Open doesn't see them.

...
Thanks for your report!. Actually, the files should be automatically saved as JSON files. Can you open them when you append *.json to your files?
Now have 0.1.24 installed.

Saved node files still don't load.

Edit: One issue appears to be that if there is the node file includes a CViewer node and there is no document in FreeCAD the opening of the node file fails. But, this does not correct the open error in other cases.
You got that right! The CViewer node needs an open FreeCAD document to render into. I'll be looking into this soon. Probably a new document should be created when loading a node graph, if there is none open yet. How do you see this? Unfortunately, I have not been able to reproduce your save and load problems yet. Is the error still current?
Codelink on GitHub: https://github.com/j8sr0230/codelink
Codelink on PiPy: https://pypi.org/project/codelink/
FreeCAD Nodes Workbench on GitHub: https://github.com/j8sr0230/Nodes
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by drmacro »

j8sr0230 wrote: Tue Dec 06, 2022 6:36 pm ...

You got that right! The CViewer node needs an open FreeCAD document to render into. I'll be looking into this soon. Probably a new document should be created when loading a node graph, if there is none open yet. How do you see this?
Creating a new document if none exists would probably be good. Or maybe offering it to the user...they may not want nodes popping up their existing work.
Unfortunately, I have not been able to reproduce your save and load problems yet. Is the error still current?
I currently have 0.1.26 and R/W appears ok.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
j8sr0230
Posts: 140
Joined: Thu Apr 07, 2022 8:59 am
Location: Chemnitz
Contact:

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by j8sr0230 »

drmacro wrote: Tue Dec 06, 2022 6:34 pm It did for like two days...until I did the Addon manager update. :lol:
Cool, then I can close the issue!
Codelink on GitHub: https://github.com/j8sr0230/codelink
Codelink on PiPy: https://pypi.org/project/codelink/
FreeCAD Nodes Workbench on GitHub: https://github.com/j8sr0230/Nodes
User avatar
j8sr0230
Posts: 140
Joined: Thu Apr 07, 2022 8:59 am
Location: Chemnitz
Contact:

Re: FreeCAD Nodes (renamed from fc_nodes)

Post by j8sr0230 »

Hi Friends,
the CrvToFace node now implements the FaceMakerBullseye class for boundary surface capabilities. The example shows a node setup that generates either 9 circular faces or 5 boundary surfaces, depending on the data structure passed.
Boundary surface
Boundary surface
nodes_boundary_surface.gif (366.07 KiB) Viewed 2067 times
Codelink on GitHub: https://github.com/j8sr0230/codelink
Codelink on PiPy: https://pypi.org/project/codelink/
FreeCAD Nodes Workbench on GitHub: https://github.com/j8sr0230/Nodes
Post Reply