Graphscad

Graphscad : The Graphic Nodal Editor for OpenScad
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 How to create new node types

View previous topic View next topic Go down 
AuthorMessage
ChrisLT



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

PostSubject: How to create new node types   Thu 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
View user profile
Admin
Admin


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

PostSubject: Re: How to create new node types   Thu 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
View user profile http://graphscad.forumotion.com
Admin
Admin


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

PostSubject: Re: How to create new node types   Thu 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
View user profile http://graphscad.forumotion.com
ChrisLT



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

PostSubject: Re: How to create new node types   Thu 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
View user profile
Admin
Admin


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

PostSubject: Re: How to create new node types   Thu 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
View user profile http://graphscad.forumotion.com
Sponsored content




PostSubject: Re: How to create new node types   

Back to top Go down
 
How to create new node types
View previous topic View next topic Back to top 
Page 1 of 1

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