Graphscad
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Graphscad

Graphscad : The Graphic Nodal Editor for OpenScad
 
HomeLatest imagesSearchRegisterLog in

 

 How to create new node types

Go down 
2 posters
AuthorMessage
ChrisLT




Messages : 45
Date d'inscription : 2017-01-30
Localisation : Newbury, Berkshire, England

How to create new node types Empty
PostSubject: How to create new node types   How to create new node types Icon_minitimeThu 9 Feb - 0:37

I have tried to create a new node type but failed:
I edited the existing node_box.py making a few changes - to the classname and the def evaluate statement.
I saved as newname.py
I created an icon file newname.png in the icons folder.
I byte-compiled from newname.py to newname.pyc by running: python -m py_compile "newname.py"
This seemed successful. I have python 2.7.12
Lastly, I ran GraphSCAD. But as soon as I right-clicked to try to add a node I got a critical error "Node plugins newname was not found! Don't save this file"
What am I doing wrong?
Back to top Go down
Admin
Admin



Messages : 59
Date d'inscription : 2017-01-08

How to create new node types Empty
PostSubject: Re: How to create new node types   How to create new node types Icon_minitimeThu 9 Feb - 12:52

Hi. just a problem of name. Node MUST be named as this : "node_??????????.py'.

use prefix 'node_' for your node name and for icon name and it should work.
Back to top Go down
https://graphscad.forumotion.com
Admin
Admin



Messages : 59
Date d'inscription : 2017-01-08

How to create new node types Empty
PostSubject: Re: How to create new node types   How to create new node types Icon_minitimeThu 9 Feb - 12:55

another thing : the class name in python code must be like this : Node_??????????

N of Node is Uppercase
Back to top Go down
https://graphscad.forumotion.com
ChrisLT




Messages : 45
Date d'inscription : 2017-01-30
Localisation : Newbury, Berkshire, England

How to create new node types Empty
PostSubject: Re: How to create new node types   How to create new node types Icon_minitimeThu 9 Feb - 17:04

OK, I found the problem. It was that every character in the node class name must be lower case (minuscule pour nos amis francais) except the initial 'N'. I had created class Node_boxCLT in the file node_boxCLT.py and with icon file node_boxCLT.png. That didn't work. Class Node_box_clt in file node_box_clt.py with icon file node_box_clt.png does work. In the menu that offers to create a node, this shows as box_clt.
Back to top Go down
Admin
Admin



Messages : 59
Date d'inscription : 2017-01-08

How to create new node types Empty
PostSubject: Re: How to create new node types   How to create new node types Icon_minitimeThu 9 Feb - 19:47

cool. "minuscules" for filenames, and first char of classname is 'majuscule' ;-)
good catch !
I will activate github repository for people who want to share custom nodes and icons.

Back to top Go down
https://graphscad.forumotion.com
Sponsored content





How to create new node types Empty
PostSubject: Re: How to create new node types   How to create new node types Icon_minitime

Back to top Go down
 
How to create new node types
Back to top 
Page 1 of 1
 Similar topics
-
» Idea: Colour by name node
» Proposed node type: debug_aid
» Why does boolean node include translation?
» resize node auto feature
» Proposed node type: val_to_text

Permissions in this forum:You cannot reply to topics in this forum
Graphscad :: General discussion-
Jump to: