├── .gitignore ├── PythonOCC ├── widgets.py ├── add_function_box_example.py └── nodes.py ├── LICENSE ├── README.md └── examples ├── torus_gcode.json └── demo_example.json /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | .idea/ -------------------------------------------------------------------------------- /PythonOCC/widgets.py: -------------------------------------------------------------------------------- 1 | from ryven.NWENV import * 2 | 3 | from qtpy.QtCore import Signal 4 | from qtpy.QtWidgets import QLineEdit 5 | 6 | 7 | class ImportFileNode_MainWidget(MWB, QLineEdit): 8 | 9 | value_changed = Signal(object) 10 | 11 | def __init__(self, params): 12 | MWB.__init__(self, params) 13 | QLineEdit.__init__(self) 14 | 15 | # self.setFixedWidth(80) 16 | # self.setMinimumWidth(80) 17 | self.resize(120, 31) 18 | self.editingFinished.connect(self.editing_finished) 19 | 20 | def editing_finished(self): 21 | # self.node.update() 22 | self.value_changed.emit(self.get_val()) 23 | 24 | def get_val(self): 25 | val = None 26 | try: 27 | val = eval(self.text()) 28 | except Exception as e: 29 | val = self.text() 30 | return val 31 | 32 | def get_state(self): 33 | data = {'text': self.text()} 34 | return data 35 | 36 | def set_state(self, data): 37 | self.setText(data['text']) 38 | 39 | 40 | export_widgets( 41 | ImportFileNode_MainWidget, 42 | ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Tanneguy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PythonOCC/add_function_box_example.py: -------------------------------------------------------------------------------- 1 | class BrepPrimAPINodeBase(PythonOCCNodeBase): # The parent class of the box 2 | color = '#aabb44' # The color attributed to the parent class 3 | 4 | 5 | class Box_Node(BrepPrimAPINodeBase): # explicit class name(parent class name) 6 | """ 7 | Generates box_________- 8 | o_Width_______________- 9 | o_Length______________- #the text that will appear when your mouse will stay on the node in Ryven 10 | o_Height______________- #it indicates what inputs are expected 11 | """ 12 | init_inputs = [ 13 | NodeInputBP(dtype=dtypes.Data(size='s')), # number of inputs following what your function needs 14 | NodeInputBP(dtype=dtypes.Data(size='s')), 15 | NodeInputBP(dtype=dtypes.Data(size='s')), 16 | ] 17 | 18 | init_outputs = [ 19 | NodeOutputBP(), # output of the node 20 | ] 21 | 22 | title = 'box' # the title name of your node 23 | 24 | def apply_op(self, elements: list): 25 | width = elements[0] # your inputs 26 | length = elements[1] 27 | height = elements[2] 28 | from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox # import of the method 29 | from OCC.Core.gp import gp_Pnt 30 | box = BRepPrimAPI_MakeBox(gp_Pnt(), width, length, height).Shape() # the function to get a result 31 | 32 | return box # the output of the node 33 | 34 | 35 | BRepPrimAPI_nodes = [ # add the node to the list if its family 36 | Box_Node, 37 | ] 38 | 39 | 40 | export_nodes( 41 | *BRepPrimAPI_nodes, # specified the family nodes to export and to make available in Ryven 42 | ) 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pythonocc-nodes-for-Ryven 2 | Pythonocc nodes package for Ryven. 3 | 4 | Here a way to work on Pythonocc with a node editor, Ryven in that case. 5 | To get it functional you will have to execute Ryven in an environment where pythonocc is installed. 6 | 7 | ### Installation 8 | 9 | Prerequisites: 10 | 11 | 1. Ryven: https://github.com/leon-thomm/Ryven 12 | 2. Anaconda: https://docs.anaconda.com/anaconda/install/index.html 13 | 3. pythonocc-core: https://anaconda.org/conda-forge/pythonocc-core 14 | 4. pythonocc-utils: https://github.com/tpaviot/pythonocc-utils 15 | 16 | Easy install solution for beginners : https://github.com/Tanneguydv/Pythonocc-nodes-for-Ryven/discussions/13#discussioncomment-1990881 17 | 18 | ### Usage 19 | 20 | You just have to import the `nodes.py` file in Ryven. 21 | 22 | ### Examples 23 | 24 | Here a small example: https://www.youtube.com/watch?v=lUNYstrfvmg 25 | 26 | ![exemple_tutogithub](https://user-images.githubusercontent.com/81742654/131111996-7d586497-ecb0-4908-9da7-b8fd9ba72055.jpg) 27 | ![exemple_tutogithub_1](https://user-images.githubusercontent.com/81742654/131112006-300cb113-ad9c-406c-9bd4-4ce6629f54ee.jpg) 28 | 29 | You can load this project from `demo_example.json` 30 | 31 | another example: 32 | ![torus_example](https://user-images.githubusercontent.com/81742654/134700246-54ce5366-cb8f-43c1-acd9-fdd091cd802f.jpg) 33 | 34 | 35 | Other example : Convert your points to gcode 36 | ![torus_gcode](https://user-images.githubusercontent.com/81742654/149762316-9d8fb268-cda9-432c-9263-c633bf921da6.jpg) 37 | see `torus_gcode.json file` 38 | 39 | 40 | It's just a beginning to explore the possibilities given by matching the two, I've just coded simple functions to see how it works and how it should be to perform complex operations. 41 | 42 | ### Contribute ! 43 | 44 | The nodes are of course open for contribution, as there are thousands of functions in OpenCascade and thousands of ways to develop properly the nodes! 45 | 46 | The functions currently implemented are: 47 | 48 | `Gp_nodes = Pnt_Node, DeconstructPnt_Node, PointZero_Node,Dir_Node, Vec_Node, DX_Node, DY_Node, DZ_Node,Ax2_Node, Pln_Node, Trsf_Node, Move2pts_Node, MidPoint_Node,` 49 | 50 | `BRepBuilderAPI_nodes = TwoPtsEdge_Node, Wire_Node, WireFillet2d_Node, DiscretizeWire_Node, Get_dir_from_edge_Node` 51 | 52 | `BRepOffsetAPI_nodes = Pipe_Node,` 53 | 54 | `BRepPrimAPI_nodes = Box_Node, Sphere_Node, Cylinder_Node,` 55 | 56 | `BRepAlgoAPI_nodes = Fuse_Node, Common_Node, Cut_Node,` 57 | 58 | `BRepFilletAPI_nodes = fillet_Node,` 59 | 60 | `GeomAPI_nodes = PointsSurface_Node,` 61 | 62 | `TopExplorer_nodes = TopExplorer_Node,` 63 | 64 | `Display_nodes = display_Node, Color_Node,` 65 | 66 | `Tools_nodes = List_Node, ListLength_Node, FlattenList_Node, ListItem_Node, RepeatData_Node, Serie_Node, ShiftList_Node,` 67 | 68 | `DataExchange_nodes = ExportStep_Node, ImportStep_Node, ExportStl_Node, ImportStl_Node, ExportGcode_Node` 69 | 70 | Each "nodes" family is a class with a color attributed. Node names are correspond to the functions from Pythonocc. 71 | 72 | To add a function from Pythonocc you have to generate a code as shown in `add_function_box_example.py`. 73 | -------------------------------------------------------------------------------- /examples/torus_gcode.json: -------------------------------------------------------------------------------- 1 | { 2 | "general info": { 3 | "type": "Ryven project file", 4 | "ryven version": "v3.1" 5 | }, 6 | "required packages": [ 7 | { 8 | "name": "PythonOCC", 9 | "dir": "C:/Users/nutri/projects/ryven projects/Pythonocc-nodes-for-Ryven/PythonOCC" 10 | } 11 | ], 12 | "scripts": [ 13 | { 14 | "title": "hello world", 15 | "variables": {}, 16 | "flow": { 17 | "algorithm mode": "data", 18 | "nodes": [ 19 | { 20 | "identifier": "built_in.Val_Node", 21 | "version": "v0.1", 22 | "state data": "gAN9cQBYAwAAAHZhbHEBSzJzLg==", 23 | "additional data": { 24 | "special actions": { 25 | "edit val via dialog": { 26 | "method": "action_edit_via_dialog" 27 | } 28 | }, 29 | "display title": "" 30 | }, 31 | "inputs": [ 32 | { 33 | "type": "data", 34 | "label": "", 35 | "GID": 19, 36 | "val": "gANLMi4=", 37 | "dtype": "DType.Data", 38 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAlgFAAAAdG9ydXNxA1gDAAAAZG9jcQRYAAAAAHEFWAYAAABib3VuZHNxBk5YBAAAAHNpemVxB1gBAAAAc3EIdS4=", 39 | "has widget": true, 40 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAANTBxAnMu" 41 | } 42 | ], 43 | "outputs": [ 44 | { 45 | "type": "data", 46 | "label": "", 47 | "GID": 20 48 | } 49 | ], 50 | "GID": 18, 51 | "pos x": 136.2194750862892, 52 | "pos y": 425.07657529679483, 53 | "unconnected ports hidden": false, 54 | "collapsed": false 55 | }, 56 | { 57 | "identifier": "built_in.Val_Node", 58 | "version": "v0.1", 59 | "state data": "gAN9cQBYAwAAAHZhbHEBWAUAAAB0b3J1c3ECcy4=", 60 | "additional data": { 61 | "special actions": { 62 | "edit val via dialog": { 63 | "method": "action_edit_via_dialog" 64 | } 65 | }, 66 | "display title": "" 67 | }, 68 | "inputs": [ 69 | { 70 | "type": "data", 71 | "label": "", 72 | "GID": 25, 73 | "val": "gANYBQAAAHRvcnVzcQAu", 74 | "dtype": "DType.Data", 75 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAlgFAAAAdG9ydXNxA1gDAAAAZG9jcQRYAAAAAHEFWAYAAABib3VuZHNxBk5YBAAAAHNpemVxB1gBAAAAc3EIdS4=", 76 | "has widget": true, 77 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgFAAAAdG9ydXNxAnMu" 78 | } 79 | ], 80 | "outputs": [ 81 | { 82 | "type": "data", 83 | "label": "", 84 | "GID": 26 85 | } 86 | ], 87 | "GID": 24, 88 | "pos x": 522.2622838763534, 89 | "pos y": 698.5287903679134, 90 | "unconnected ports hidden": false, 91 | "collapsed": false 92 | }, 93 | { 94 | "identifier": "dev.ExportGcode_Node", 95 | "version": "v0.1", 96 | "state data": "gAN9cQAu", 97 | "additional data": { 98 | "special actions": {}, 99 | "display title": "ExportGcode" 100 | }, 101 | "inputs": [ 102 | { 103 | "type": "data", 104 | "label": "points", 105 | "GID": 28, 106 | "dtype": "DType.Data", 107 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 108 | "has widget": true, 109 | "widget data": "gAN9cQBYBAAAAHRleHRxAViEAwAAWzxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz5dcQJzLg==" 110 | }, 111 | { 112 | "type": "data", 113 | "label": "name", 114 | "GID": 29, 115 | "dtype": "DType.Data", 116 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 117 | "has widget": true, 118 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgFAAAAdG9ydXNxAnMu" 119 | }, 120 | { 121 | "type": "data", 122 | "label": "speed", 123 | "GID": 30, 124 | "dtype": "DType.Data", 125 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 126 | "has widget": true, 127 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTgwMHECcy4=" 128 | } 129 | ], 130 | "outputs": [ 131 | { 132 | "type": "data", 133 | "label": "", 134 | "GID": 31 135 | } 136 | ], 137 | "GID": 27, 138 | "pos x": 875.7600233055198, 139 | "pos y": 664.5700921107555, 140 | "unconnected ports hidden": false, 141 | "collapsed": false 142 | }, 143 | { 144 | "identifier": "dev.Torus_Node", 145 | "version": "v0.1", 146 | "state data": "gAN9cQAu", 147 | "additional data": { 148 | "special actions": {}, 149 | "display title": "torus" 150 | }, 151 | "inputs": [ 152 | { 153 | "type": "data", 154 | "label": "axe", 155 | "GID": 38, 156 | "dtype": "DType.Data", 157 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 158 | "has widget": true, 159 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9BeDInPnECcy4=" 160 | }, 161 | { 162 | "type": "data", 163 | "label": "distance", 164 | "GID": 39, 165 | "dtype": "DType.Data", 166 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 167 | "has widget": true, 168 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAANTBxAnMu" 169 | }, 170 | { 171 | "type": "data", 172 | "label": "radius", 173 | "GID": 40, 174 | "dtype": "DType.Data", 175 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 176 | "has widget": true, 177 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAANXECcy4=" 178 | } 179 | ], 180 | "outputs": [ 181 | { 182 | "type": "data", 183 | "label": "", 184 | "GID": 41 185 | } 186 | ], 187 | "GID": 37, 188 | "pos x": 354.42869936848325, 189 | "pos y": 347.12089113408143, 190 | "unconnected ports hidden": false, 191 | "collapsed": false 192 | }, 193 | { 194 | "identifier": "dev.XOY_Node", 195 | "version": "v0.1", 196 | "state data": "gAN9cQAu", 197 | "additional data": { 198 | "special actions": {}, 199 | "display title": "AxZ" 200 | }, 201 | "inputs": [], 202 | "outputs": [ 203 | { 204 | "type": "data", 205 | "label": "", 206 | "GID": 43 207 | } 208 | ], 209 | "GID": 42, 210 | "pos x": 118.14289978949444, 211 | "pos y": 342.24901897781376, 212 | "unconnected ports hidden": false, 213 | "collapsed": false 214 | }, 215 | { 216 | "identifier": "built_in.Val_Node", 217 | "version": "v0.1", 218 | "state data": "gAN9cQBYAwAAAHZhbHEBSwVzLg==", 219 | "additional data": { 220 | "special actions": { 221 | "edit val via dialog": { 222 | "method": "action_edit_via_dialog" 223 | } 224 | }, 225 | "display title": "" 226 | }, 227 | "inputs": [ 228 | { 229 | "type": "data", 230 | "label": "", 231 | "GID": 47, 232 | "val": "gANLBS4=", 233 | "dtype": "DType.Data", 234 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAlgFAAAAdG9ydXNxA1gDAAAAZG9jcQRYAAAAAHEFWAYAAABib3VuZHNxBk5YBAAAAHNpemVxB1gBAAAAc3EIdS4=", 235 | "has widget": true, 236 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAANXECcy4=" 237 | } 238 | ], 239 | "outputs": [ 240 | { 241 | "type": "data", 242 | "label": "", 243 | "GID": 48 244 | } 245 | ], 246 | "GID": 46, 247 | "pos x": 114.48899567229358, 248 | "pos y": 512.7645444471871, 249 | "unconnected ports hidden": false, 250 | "collapsed": false 251 | }, 252 | { 253 | "identifier": "dev.Display_Node", 254 | "version": "v0.1", 255 | "state data": "gAN9cQAu", 256 | "additional data": { 257 | "special actions": {}, 258 | "display title": "display" 259 | }, 260 | "inputs": [ 261 | { 262 | "type": "data", 263 | "label": "shapes", 264 | "GID": 51, 265 | "dtype": "DType.Data", 266 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 267 | "has widget": true, 268 | "widget data": "gAN9cQBYBAAAAHRleHRxAVieAwAAWzxjbGFzcyAnVG9wb0RTX1NvbGlkJz4sIFs8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+LCA8Y2xhc3MgJ2dwX1BudCc+XV1xAnMu" 269 | } 270 | ], 271 | "outputs": [], 272 | "GID": 50, 273 | "pos x": 946.3611663550219, 274 | "pos y": 361.736507602885, 275 | "unconnected ports hidden": false, 276 | "collapsed": false 277 | }, 278 | { 279 | "identifier": "built_in.Val_Node", 280 | "version": "v0.1", 281 | "state data": "gAN9cQBYAwAAAHZhbHEBTQgHcy4=", 282 | "additional data": { 283 | "special actions": { 284 | "edit val via dialog": { 285 | "method": "action_edit_via_dialog" 286 | } 287 | }, 288 | "display title": "" 289 | }, 290 | "inputs": [ 291 | { 292 | "type": "data", 293 | "label": "", 294 | "GID": 54, 295 | "val": "gANNCAcu", 296 | "dtype": "DType.Data", 297 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAlgFAAAAdG9ydXNxA1gDAAAAZG9jcQRYAAAAAHEFWAYAAABib3VuZHNxBk5YBAAAAHNpemVxB1gBAAAAc3EIdS4=", 298 | "has widget": true, 299 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTgwMHECcy4=" 300 | } 301 | ], 302 | "outputs": [ 303 | { 304 | "type": "data", 305 | "label": "", 306 | "GID": 55 307 | } 308 | ], 309 | "GID": 53, 310 | "pos x": 255.77328820406007, 311 | "pos y": 895.2065087142103, 312 | "unconnected ports hidden": false, 313 | "collapsed": false 314 | }, 315 | { 316 | "identifier": "dev.TopExplorer_Node", 317 | "version": "v0.1", 318 | "state data": "gAN9cQAu", 319 | "additional data": { 320 | "special actions": {}, 321 | "display title": "topexp" 322 | }, 323 | "inputs": [ 324 | { 325 | "type": "data", 326 | "label": "shape", 327 | "GID": 58, 328 | "dtype": "DType.Data", 329 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 330 | "has widget": true, 331 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgWAAAAPGNsYXNzICdUb3BvRFNfU29saWQnPnECcy4=" 332 | } 333 | ], 334 | "outputs": [ 335 | { 336 | "type": "data", 337 | "label": "vertex", 338 | "GID": 59 339 | }, 340 | { 341 | "type": "data", 342 | "label": "edges", 343 | "GID": 60 344 | }, 345 | { 346 | "type": "data", 347 | "label": "wires", 348 | "GID": 61 349 | }, 350 | { 351 | "type": "data", 352 | "label": "faces", 353 | "GID": 62 354 | }, 355 | { 356 | "type": "data", 357 | "label": "shells", 358 | "GID": 63 359 | }, 360 | { 361 | "type": "data", 362 | "label": "solids", 363 | "GID": 64 364 | }, 365 | { 366 | "type": "data", 367 | "label": "compounds", 368 | "GID": 65 369 | }, 370 | { 371 | "type": "data", 372 | "label": "compsolids", 373 | "GID": 66 374 | } 375 | ], 376 | "GID": 57, 377 | "pos x": 591.932466986539, 378 | "pos y": 204.61863056324802, 379 | "unconnected ports hidden": false, 380 | "collapsed": false 381 | }, 382 | { 383 | "identifier": "dev.DiscretizeWire_Node", 384 | "version": "v0.1", 385 | "state data": "gAN9cQAu", 386 | "additional data": { 387 | "special actions": {}, 388 | "display title": "DiscretizeWire" 389 | }, 390 | "inputs": [ 391 | { 392 | "type": "data", 393 | "label": "Wire", 394 | "GID": 69, 395 | "dtype": "DType.Data", 396 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 397 | "has widget": true, 398 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgVAAAAPGNsYXNzICdUb3BvRFNfRWRnZSc+cQJzLg==" 399 | }, 400 | { 401 | "type": "data", 402 | "label": "Nb", 403 | "GID": 70, 404 | "dtype": "DType.Data", 405 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 406 | "has widget": true, 407 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAANTBxAnMu" 408 | } 409 | ], 410 | "outputs": [ 411 | { 412 | "type": "data", 413 | "label": "", 414 | "GID": 71 415 | } 416 | ], 417 | "GID": 68, 418 | "pos x": 594.368403064673, 419 | "pos y": 562.7012340489321, 420 | "unconnected ports hidden": false, 421 | "collapsed": false 422 | }, 423 | { 424 | "identifier": "dev.ListItem_Node", 425 | "version": "v0.1", 426 | "state data": "gAN9cQAu", 427 | "additional data": { 428 | "special actions": {}, 429 | "display title": "ListItem" 430 | }, 431 | "inputs": [ 432 | { 433 | "type": "data", 434 | "label": "list", 435 | "GID": 79, 436 | "dtype": "DType.Data", 437 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 438 | "has widget": true, 439 | "widget data": "gAN9cQBYBAAAAHRleHRxAVhcAAAAWzxjbGFzcyAnVG9wb0RTX0VkZ2UnPiwgPGNsYXNzICdUb3BvRFNfRWRnZSc+LCA8Y2xhc3MgJ1RvcG9EU19FZGdlJz4sIDxjbGFzcyAnVG9wb0RTX0VkZ2UnPl1xAnMu" 440 | }, 441 | { 442 | "type": "data", 443 | "label": "index", 444 | "GID": 80, 445 | "val": "gANLAC4=", 446 | "dtype": "DType.Data", 447 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAksAWAMAAABkb2NxA1gAAAAAcQRYBgAAAGJvdW5kc3EFTlgEAAAAc2l6ZXEGWAEAAABzcQd1Lg==", 448 | "has widget": true, 449 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 450 | } 451 | ], 452 | "outputs": [ 453 | { 454 | "type": "data", 455 | "label": "", 456 | "GID": 81 457 | } 458 | ], 459 | "GID": 78, 460 | "pos x": 865.9752757766032, 461 | "pos y": 153.46397292243608, 462 | "unconnected ports hidden": false, 463 | "collapsed": false 464 | }, 465 | { 466 | "identifier": "dev.List_Node", 467 | "version": "v0.1", 468 | "state data": "gAN9cQAu", 469 | "additional data": { 470 | "special actions": { 471 | "add input": { 472 | "method": "add_operand_input" 473 | }, 474 | "rem input": { 475 | "0": { 476 | "method": "remove_operand_input", 477 | "data": 0 478 | }, 479 | "1": { 480 | "method": "remove_operand_input", 481 | "data": 1 482 | } 483 | } 484 | }, 485 | "display title": "List" 486 | }, 487 | "inputs": [ 488 | { 489 | "type": "data", 490 | "label": "", 491 | "GID": 86, 492 | "dtype": "DType.Data", 493 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 494 | "has widget": true, 495 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgWAAAAPGNsYXNzICdUb3BvRFNfU29saWQnPnECcy4=" 496 | }, 497 | { 498 | "type": "data", 499 | "label": "", 500 | "GID": 87, 501 | "dtype": "DType.Data", 502 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAAB2YWxxAk5YAwAAAGRvY3EDWAAAAABxBFgGAAAAYm91bmRzcQVOWAQAAABzaXplcQZYAQAAAHNxB3Uu", 503 | "has widget": true, 504 | "widget data": "gAN9cQBYBAAAAHRleHRxAViEAwAAWzxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz4sIDxjbGFzcyAnZ3BfUG50Jz5dcQJzLg==" 505 | } 506 | ], 507 | "outputs": [ 508 | { 509 | "type": "data", 510 | "label": "", 511 | "GID": 88 512 | } 513 | ], 514 | "GID": 85, 515 | "pos x": 758.7940883387114, 516 | "pos y": 436.03255798596905, 517 | "unconnected ports hidden": false, 518 | "collapsed": false 519 | } 520 | ], 521 | "connections": [ 522 | { 523 | "GID": 45, 524 | "parent node index": 0, 525 | "output port index": 0, 526 | "connected node": 3, 527 | "connected input port index": 1 528 | }, 529 | { 530 | "GID": 73, 531 | "parent node index": 0, 532 | "output port index": 0, 533 | "connected node": 9, 534 | "connected input port index": 1 535 | }, 536 | { 537 | "GID": 35, 538 | "parent node index": 1, 539 | "output port index": 0, 540 | "connected node": 2, 541 | "connected input port index": 1 542 | }, 543 | { 544 | "GID": 67, 545 | "parent node index": 3, 546 | "output port index": 0, 547 | "connected node": 8, 548 | "connected input port index": 0 549 | }, 550 | { 551 | "GID": 89, 552 | "parent node index": 3, 553 | "output port index": 0, 554 | "connected node": 11, 555 | "connected input port index": 0 556 | }, 557 | { 558 | "GID": 44, 559 | "parent node index": 4, 560 | "output port index": 0, 561 | "connected node": 3, 562 | "connected input port index": 0 563 | }, 564 | { 565 | "GID": 49, 566 | "parent node index": 5, 567 | "output port index": 0, 568 | "connected node": 3, 569 | "connected input port index": 2 570 | }, 571 | { 572 | "GID": 56, 573 | "parent node index": 7, 574 | "output port index": 0, 575 | "connected node": 2, 576 | "connected input port index": 2 577 | }, 578 | { 579 | "GID": 82, 580 | "parent node index": 8, 581 | "output port index": 1, 582 | "connected node": 10, 583 | "connected input port index": 0 584 | }, 585 | { 586 | "GID": 84, 587 | "parent node index": 9, 588 | "output port index": 0, 589 | "connected node": 2, 590 | "connected input port index": 0 591 | }, 592 | { 593 | "GID": 90, 594 | "parent node index": 9, 595 | "output port index": 0, 596 | "connected node": 11, 597 | "connected input port index": 1 598 | }, 599 | { 600 | "GID": 83, 601 | "parent node index": 10, 602 | "output port index": 0, 603 | "connected node": 9, 604 | "connected input port index": 0 605 | }, 606 | { 607 | "GID": 91, 608 | "parent node index": 11, 609 | "output port index": 0, 610 | "connected node": 6, 611 | "connected input port index": 0 612 | } 613 | ], 614 | "GID": 6, 615 | "flow view": { 616 | "drawings": [], 617 | "view size": [ 618 | 6400.0, 619 | 4800.0 620 | ] 621 | } 622 | }, 623 | "GID": 1 624 | } 625 | ] 626 | } 627 | -------------------------------------------------------------------------------- /PythonOCC/nodes.py: -------------------------------------------------------------------------------- 1 | from ryven.NENV import * 2 | 3 | widgets = import_widgets(__file__) 4 | 5 | from OCC.Core.ChFi2d import \ 6 | ChFi2d_AnaFilletAlgo 7 | 8 | from OCC.Core.gp import \ 9 | gp_Pnt, \ 10 | gp_Vec, \ 11 | gp_Dir, \ 12 | gp_Ax2, \ 13 | gp_Pln, \ 14 | gp_Trsf, \ 15 | gp_DX, \ 16 | gp_DY, \ 17 | gp_DZ, \ 18 | gp_Circ, \ 19 | gp_XOY, \ 20 | gp_YOZ, \ 21 | gp_ZOX 22 | 23 | from OCC.Core.BRep import \ 24 | BRep_Tool 25 | 26 | from OCC.Core.BRepBuilderAPI import \ 27 | BRepBuilderAPI_Transform, \ 28 | BRepBuilderAPI_MakeEdge, \ 29 | BRepBuilderAPI_MakeWire, \ 30 | BRepBuilderAPI_MakeFace 31 | 32 | from OCC.Core.BRepPrimAPI import \ 33 | BRepPrimAPI_MakeBox, \ 34 | BRepPrimAPI_MakeSphere, \ 35 | BRepPrimAPI_MakeCylinder, \ 36 | BRepPrimAPI_MakeTorus 37 | 38 | from OCC.Core.BRepAdaptor import \ 39 | BRepAdaptor_CompCurve 40 | 41 | from OCC.Core.BRepAlgoAPI import \ 42 | BRepAlgoAPI_Fuse, \ 43 | BRepAlgoAPI_Common, \ 44 | BRepAlgoAPI_Cut, \ 45 | BRepAlgoAPI_Section 46 | 47 | from OCC.Core.BRepOffsetAPI import \ 48 | BRepOffsetAPI_MakePipe 49 | 50 | from OCC.Core.Geom import \ 51 | Geom_Circle 52 | 53 | from OCC.Core.GeomAbs import \ 54 | GeomAbs_C2 55 | 56 | from OCC.Core.GCPnts import \ 57 | GCPnts_UniformAbscissa 58 | 59 | from OCC.Core.GeomAPI import \ 60 | GeomAPI_PointsToBSplineSurface 61 | 62 | from OCC.Core.STEPControl import \ 63 | STEPControl_Writer, \ 64 | STEPControl_AsIs 65 | 66 | from OCC.Core.TColgp import \ 67 | TColgp_Array1OfPnt, \ 68 | TColgp_Array2OfPnt 69 | 70 | from OCC.Core.TopAbs import \ 71 | TopAbs_EDGE, \ 72 | TopAbs_FACE, \ 73 | TopAbs_SHELL, \ 74 | TopAbs_VERTEX, \ 75 | TopAbs_WIRE, \ 76 | TopAbs_SOLID, \ 77 | TopAbs_COMPOUND, \ 78 | TopAbs_COMPSOLID 79 | 80 | from OCC.Core.TopExp import \ 81 | TopExp_Explorer 82 | 83 | from OCC.Core.TopoDS import \ 84 | topods_Edge, \ 85 | TopoDS_Edge, \ 86 | topods_Face, \ 87 | topods_Shell, \ 88 | topods_Vertex, \ 89 | topods_Wire, \ 90 | TopoDS_Wire, \ 91 | topods_Solid, \ 92 | topods_Compound, \ 93 | topods_CompSolid 94 | 95 | from OCC.Extend.DataExchange import \ 96 | write_stl_file, \ 97 | read_stl_file, \ 98 | read_step_file 99 | 100 | from OCC.Core.BRepFilletAPI import \ 101 | BRepFilletAPI_MakeFillet 102 | 103 | from OCC.Extend.TopologyUtils import \ 104 | TopologyExplorer 105 | 106 | from OCC.Extend.ShapeFactory import \ 107 | get_oriented_boundingbox 108 | 109 | from OCCUtils.Common import \ 110 | filter_points_by_distance, \ 111 | curve_length 112 | 113 | from OCCUtils.edge import Edge 114 | 115 | 116 | # 3D Viewer ------------------------------------------ 117 | 118 | from datetime import datetime 119 | from OCC.Display.SimpleGui import init_display 120 | display, start_display, add_menu, add_function_to_menu = init_display() 121 | add_menu('View') 122 | 123 | def Fit_All(): 124 | display.FitAll() 125 | 126 | def Iso_View(): 127 | display.View_Iso() 128 | display.FitAll() 129 | 130 | def Top_View(): 131 | display.View_Top() 132 | display.FitAll() 133 | 134 | def Left_View(): 135 | display.View_Left() 136 | display.FitAll() 137 | 138 | def Front_View(): 139 | display.View_Front() 140 | display.FitAll() 141 | 142 | def Right_View(): 143 | display.View_Right() 144 | display.FitAll() 145 | 146 | def Bottom_View(): 147 | display.View_Bottom() 148 | display.FitAll() 149 | 150 | def Rear_View(): 151 | display.View_Rear() 152 | display.FitAll() 153 | 154 | 155 | add_function_to_menu('View', Fit_All) 156 | add_function_to_menu('View', Iso_View) 157 | add_function_to_menu('View', Top_View) 158 | add_function_to_menu('View', Left_View) 159 | add_function_to_menu('View', Front_View) 160 | add_function_to_menu('View', Right_View) 161 | add_function_to_menu('View', Bottom_View) 162 | add_function_to_menu('View', Rear_View) 163 | 164 | add_menu('Screenshot') 165 | 166 | 167 | def Save_Screenshot(): 168 | screenshot_OCC_name = str(datetime.now().strftime("%Y-%m-%d_%H-%M-%S")) + '_screenshot.jpg' 169 | display.ExportToImage(screenshot_OCC_name) 170 | 171 | 172 | add_function_to_menu('Screenshot', Save_Screenshot) 173 | 174 | # ----------------------------------------------------- 175 | # Base Classes 176 | 177 | 178 | class PythonOCCNodeBase(Node): 179 | 180 | def get_inputs(self): 181 | return (self.input(i) for i in range(len(self.inputs))) 182 | 183 | 184 | class PythonOCCNodeBase_DynamicInputs(PythonOCCNodeBase): 185 | 186 | def __init__(self, params): 187 | super().__init__(params) 188 | 189 | self.num_inputs = 0 190 | 191 | def setup_actions(self): 192 | self.actions = {} 193 | self.actions['add input'] = {'method': self.add_operand_input} 194 | self.actions['rem input'] = {} 195 | 196 | def place_event(self): 197 | self.setup_actions() 198 | if 0 == self.num_inputs < len(self.inputs): 199 | for i in range(len(self.inputs)): 200 | self.register_new_operand_input(i) 201 | 202 | def add_operand_input(self): 203 | self.create_input_dt(dtype=dtypes.Data(size='s')) 204 | self.register_new_operand_input(self.num_inputs) 205 | self.update() 206 | 207 | def remove_operand_input(self, index): 208 | self.delete_input(index) 209 | self.num_inputs -= 1 210 | del self.actions['rem input'][f'{self.num_inputs}'] 211 | self.update() 212 | 213 | def register_new_operand_input(self, index): 214 | self.actions['rem input'][f'{index}'] = { 215 | 'method': self.remove_operand_input, 216 | 'data': index 217 | } 218 | self.num_inputs += 1 219 | 220 | def update_event(self, inp=-1): 221 | self.set_output_val(0, self.apply_op([self.input(i) for i in range(len(self.inputs))])) 222 | 223 | def apply_op(self, elements: list): 224 | return None 225 | 226 | 227 | # ------------------------------------------- 228 | 229 | # GP ---------------------------------------- 230 | 231 | 232 | class GpNodeBase(PythonOCCNodeBase): 233 | version = 'v0.1' 234 | color = '#5e0a91' 235 | 236 | 237 | class Pnt_Node(GpNodeBase): 238 | """ 239 | Generates Point_______- 240 | o_X___________________- 241 | o_Y___________________- 242 | o_Z___________________- 243 | """ 244 | 245 | title = 'point' 246 | 247 | init_inputs = [ 248 | NodeInputBP('x', dtype=dtypes.Data(size='s')), 249 | NodeInputBP('y', dtype=dtypes.Data(size='s')), 250 | NodeInputBP('z', dtype=dtypes.Data(size='s')), 251 | ] 252 | 253 | init_outputs = [ 254 | NodeOutputBP(), 255 | ] 256 | 257 | def update_event(self, inp=-1): 258 | x, y, z = self.clean(self.get_inputs()) 259 | self.set_output_val(0, gp_Pnt(x, y, z)) 260 | 261 | def clean(self, coords): 262 | """Returns a tuple of coords where `None` values are replaced by 0""" 263 | return ( (c if c is not None else 0) for c in coords ) 264 | 265 | 266 | class PointZero_Node(GpNodeBase): 267 | """ 268 | Generates Point Zero__- 269 | """ 270 | 271 | title = 'Point0' 272 | 273 | init_outputs = [ 274 | NodeOutputBP(), 275 | ] 276 | 277 | def place_event(self): 278 | point = gp_Pnt(0,0,0) 279 | self.set_output_val(0, point) 280 | 281 | 282 | class DeconstructPnt_Node(GpNodeBase): 283 | """ 284 | Deconstruct Point_____- 285 | o_Point_______________- 286 | """ 287 | 288 | title = 'deconstruct point' 289 | 290 | init_inputs = [ 291 | NodeInputBP('point', dtype=dtypes.Data(size='s')), 292 | ] 293 | 294 | init_outputs = [ 295 | NodeOutputBP('X'), 296 | NodeOutputBP('Y'), 297 | NodeOutputBP('Z'), 298 | ] 299 | 300 | def update_event(self, inp=-1): 301 | for point in self.get_inputs(): 302 | self.set_output_val(0, point.X()) 303 | self.set_output_val(1, point.Y()) 304 | self.set_output_val(2, point.Z()) 305 | 306 | 307 | class Vec_Node(GpNodeBase): 308 | """ 309 | Generates Vector______- 310 | o_X___________________- 311 | o_Y___________________- 312 | o_Z___________________- 313 | """ 314 | 315 | title = 'Vector' 316 | 317 | init_inputs = [ 318 | NodeInputBP('x', dtype=dtypes.Data(size='s')), 319 | NodeInputBP('y', dtype=dtypes.Data(size='s')), 320 | NodeInputBP('z', dtype=dtypes.Data(size='s')), 321 | ] 322 | 323 | init_outputs = [ 324 | NodeOutputBP(), 325 | ] 326 | 327 | def update_event(self, inp=-1): 328 | x, y, z = self.get_inputs() 329 | self.set_output_val(0, gp_Vec(x, y, z)) 330 | 331 | 332 | class DX_Node(GpNodeBase): 333 | """ 334 | Generates Dir X____- 335 | """ 336 | 337 | title = 'DirX' 338 | 339 | init_outputs = [ 340 | NodeOutputBP(), 341 | ] 342 | 343 | def place_event(self): 344 | dx = gp_DX() 345 | self.set_output_val(0, dx) 346 | 347 | 348 | class DY_Node(GpNodeBase): 349 | """ 350 | Generates Dir Y____- 351 | """ 352 | 353 | title = 'DirY' 354 | 355 | init_outputs = [ 356 | NodeOutputBP(), 357 | ] 358 | 359 | def place_event(self): 360 | dy = gp_DY() 361 | self.set_output_val(0, dy) 362 | 363 | 364 | class DZ_Node(GpNodeBase): 365 | """ 366 | Generates Dir Z____- 367 | """ 368 | 369 | title = 'DirZ' 370 | 371 | init_outputs = [ 372 | NodeOutputBP(), 373 | ] 374 | 375 | def place_event(self): 376 | dz = gp_DZ() 377 | self.set_output_val(0, dz) 378 | 379 | 380 | class Dir_Node(GpNodeBase): 381 | """ 382 | Generates Dir_______- 383 | o_X___________________- 384 | o_Y___________________- 385 | o_Z___________________- 386 | """ 387 | 388 | title = 'dir' 389 | 390 | init_inputs = [ 391 | NodeInputBP('x', dtype=dtypes.Data(size='s')), 392 | NodeInputBP('y', dtype=dtypes.Data(size='s')), 393 | NodeInputBP('z', dtype=dtypes.Data(size='s')), 394 | ] 395 | 396 | init_outputs = [ 397 | NodeOutputBP(), 398 | ] 399 | 400 | def update_event(self, inp=-1): 401 | x, y, z = self.get_inputs() 402 | self.set_output_val(0, gp_Dir(x, y, z)) 403 | 404 | 405 | class Ax2_Node(GpNodeBase): 406 | """ 407 | Generates Ax2_________- 408 | o_Point_______________- 409 | o_Dir_________________- 410 | """ 411 | 412 | title = 'Ax2' 413 | 414 | init_inputs = [ 415 | NodeInputBP('point', dtype=dtypes.Data(size='s')), 416 | NodeInputBP('dir', dtype=dtypes.Data(size='s')), 417 | ] 418 | 419 | init_outputs = [ 420 | NodeOutputBP(), 421 | ] 422 | 423 | def update_event(self, inp=-1): 424 | point, dir_ = self.get_inputs() 425 | self.set_output_val(0, gp_Ax2(point, dir_)) 426 | 427 | class XOY_Node(GpNodeBase): 428 | """ 429 | Generates Ax Z____- 430 | """ 431 | 432 | title = 'AxZ' 433 | 434 | init_outputs = [ 435 | NodeOutputBP(), 436 | ] 437 | 438 | def place_event(self): 439 | axz = gp_XOY() 440 | self.set_output_val(0, axz) 441 | 442 | class YOZ_Node(GpNodeBase): 443 | """ 444 | Generates Ax X____- 445 | """ 446 | 447 | title = 'AxX' 448 | 449 | init_outputs = [ 450 | NodeOutputBP(), 451 | ] 452 | 453 | def place_event(self): 454 | axx = gp_YOZ() 455 | self.set_output_val(0, axx) 456 | 457 | class ZOX_Node(GpNodeBase): 458 | """ 459 | Generates Ax Y____- 460 | """ 461 | 462 | title = 'AxY' 463 | 464 | init_outputs = [ 465 | NodeOutputBP(), 466 | ] 467 | 468 | def place_event(self): 469 | axy = gp_ZOX() 470 | self.set_output_val(0, axy) 471 | 472 | class Pln_Node(GpNodeBase): 473 | """ 474 | Generates Plane_______- 475 | o_Point_______________- 476 | o_Dir_________________- 477 | """ 478 | 479 | title = 'Plane' 480 | 481 | init_inputs = [ 482 | NodeInputBP('point', dtype=dtypes.Data(size='s')), 483 | NodeInputBP('dir', dtype=dtypes.Data(size='s')), 484 | ] 485 | 486 | init_outputs = [ 487 | NodeOutputBP(), 488 | ] 489 | 490 | def update_event(self, inp=-1): 491 | point, dir_ = self.get_inputs() 492 | self.set_output_val(0, gp_Pln(point, dir_)) 493 | 494 | 495 | class Trsf_Node(GpNodeBase): 496 | """ 497 | Generates transform___- 498 | o_[Shapes]____________- 499 | o_[Vectors]___________- 500 | """ 501 | 502 | title = 'Transform' 503 | 504 | init_inputs = [ 505 | NodeInputBP('shapes', dtype=dtypes.Data(size='s')), 506 | NodeInputBP('vectors', dtype=dtypes.Data(size='s')), 507 | ] 508 | 509 | init_outputs = [ 510 | NodeOutputBP(), 511 | ] 512 | 513 | def update_event(self, inp=-1): 514 | shapes, vectors = self.get_inputs() 515 | result = [] 516 | 517 | if isinstance(shapes, list) and isinstance(vectors, list): 518 | for sh, v in zip(shapes, vectors): 519 | trns = gp_Trsf() 520 | trns.SetTranslation(v) 521 | if isinstance(sh, gp_Pnt): 522 | sh2 = sh 523 | sh2.Transform(trns) 524 | translated = sh2 525 | else: 526 | translated = BRepBuilderAPI_Transform(sh, trns).Shape() 527 | result.append(translated) 528 | self.set_output_val(0, result) 529 | 530 | elif isinstance(shapes, list) and not isinstance(vectors, list): 531 | for sh in (shapes): 532 | trns = gp_Trsf() 533 | trns.SetTranslation(vectors) 534 | if isinstance(sh, gp_Pnt): 535 | sh2 = sh 536 | sh2.Transform(trns) 537 | translated = sh2 538 | else: 539 | translated = BRepBuilderAPI_Transform(sh, trns).Shape() 540 | result.append(translated) 541 | self.set_output_val(0, result) 542 | 543 | elif not isinstance(shapes, list) and isinstance(vectors, list): 544 | for v in (vectors): 545 | trns = gp_Trsf() 546 | trns.SetTranslation(v) 547 | if isinstance(shapes, gp_Pnt): 548 | sh2 = shapes 549 | sh2.Transform(trns) 550 | translated = sh2 551 | else: 552 | translated = BRepBuilderAPI_Transform(shapes, trns).Shape() 553 | result.append(translated) 554 | self.set_output_val(0, result) 555 | 556 | else: 557 | trns = gp_Trsf() 558 | trns.SetTranslation(vectors) 559 | if isinstance(shapes, gp_Pnt): 560 | sh2 = shapes 561 | sh2.Transform(trns) 562 | translated = sh2 563 | else: 564 | translated = BRepBuilderAPI_Transform(shapes, trns).Shape() 565 | self.set_output_val(0, translated) 566 | 567 | 568 | class Move2pts_Node(GpNodeBase): 569 | """ 570 | Move 2 points_________- 571 | o_from pnt____________- 572 | o_to pnt______________- 573 | """ 574 | 575 | title = 'Move2pnts' 576 | 577 | init_inputs = [ 578 | NodeInputBP('shapes', dtype=dtypes.Data(size='s')), 579 | NodeInputBP('from', dtype=dtypes.Data(size='s')), 580 | NodeInputBP('to', dtype=dtypes.Data(size='s')), 581 | ] 582 | 583 | init_outputs = [ 584 | NodeOutputBP(), 585 | ] 586 | 587 | def update_event(self, inp=-1): 588 | shapes, from_pnt, to_pnt = self.get_inputs() 589 | vectors = [] 590 | result = [] 591 | 592 | if isinstance(from_pnt, list): 593 | for f, t in zip(from_pnt, to_pnt): 594 | v = gp_Vec() 595 | x = t.X() - f.X() 596 | y = t.Y() - f.Y() 597 | z = t.Z() - f.Z() 598 | v.SetCoord(x, y, z) 599 | vectors.append(v) 600 | for sh, v, in zip(shapes, vectors): 601 | trns = gp_Trsf() 602 | trns.SetTranslation(v.Reversed()) 603 | translated = BRepBuilderAPI_Transform(sh, trns).Shape() 604 | result.append(translated) 605 | self.set_output_val(0, result) 606 | 607 | else: 608 | v = gp_Vec() 609 | x = to_pnt.X() - from_pnt.X() 610 | y = to_pnt.Y() - from_pnt.Y() 611 | z = to_pnt.Z() - from_pnt.Z() 612 | v.SetCoord(x, y, z) 613 | trns = gp_Trsf() 614 | trns.SetTranslation(v.Reversed()) 615 | translated = BRepBuilderAPI_Transform(shapes, trns).Shape() 616 | self.set_output_val(0, translated) 617 | 618 | 619 | class MidPoint_Node(GpNodeBase): 620 | """ 621 | MidPoint_____________- 622 | o_Point A____________- 623 | o_Point B______________- 624 | """ 625 | 626 | title = 'MidPoint' 627 | 628 | init_inputs = [ 629 | NodeInputBP('pointA', dtype=dtypes.Data(size='s')), 630 | NodeInputBP('pointB', dtype=dtypes.Data(size='s')), 631 | ] 632 | 633 | init_outputs = [ 634 | NodeOutputBP(), 635 | ] 636 | 637 | def update_event(self, inp=-1): 638 | pointA, pointB = self.get_inputs() 639 | vec1 = gp_Vec(pointA.XYZ()) 640 | vec2 = gp_Vec(pointB.XYZ()) 641 | midvec = (vec1 + vec2) / 2. 642 | midpoint = gp_Pnt(midvec.XYZ()) 643 | self.set_output_val(0, midpoint) 644 | 645 | 646 | class Get_dir_from_edge_Node(GpNodeBase): 647 | """ 648 | Dir from Edge________- 649 | o_Edge_______________- 650 | """ 651 | 652 | title = 'DirfromEdge' 653 | 654 | init_inputs = [ 655 | NodeInputBP('Edge', dtype=dtypes.Data(size='s')), 656 | ] 657 | 658 | init_outputs = [ 659 | NodeOutputBP(), 660 | ] 661 | 662 | def update_event(self, inp=-1): 663 | for edge in self.get_inputs(): 664 | edg = Edge(edge) 665 | first_point = BRep_Tool.Pnt(edg.first_vertex()) 666 | last_point = BRep_Tool.Pnt(edg.last_vertex()) 667 | dir_edge = gp_Dir(last_point.X() - first_point.X(), last_point.Y() - first_point.Y(), 668 | last_point.Z() - first_point.Z()) 669 | self.set_output_val(0, dir_edge) 670 | 671 | 672 | Gp_nodes = [ 673 | Pnt_Node, 674 | DeconstructPnt_Node, 675 | PointZero_Node, 676 | Dir_Node, 677 | Vec_Node, 678 | DX_Node, 679 | DY_Node, 680 | DZ_Node, 681 | Ax2_Node, 682 | XOY_Node, 683 | YOZ_Node, 684 | ZOX_Node, 685 | Pln_Node, 686 | Trsf_Node, 687 | Move2pts_Node, 688 | MidPoint_Node, 689 | Get_dir_from_edge_Node, 690 | ] 691 | 692 | 693 | # ------------------------------------------- 694 | 695 | # BREPBUILDERAPI----------------------------- 696 | 697 | 698 | class BrepBuilderAPINodeBase(PythonOCCNodeBase): 699 | version = 'v0.1' 700 | color = '#DAA520' 701 | 702 | 703 | class TwoPtsEdge_Node(BrepBuilderAPINodeBase): 704 | """ 705 | Generates 2 pts Edge__- 706 | o_Point_______________- 707 | o_Point_______________- 708 | """ 709 | 710 | title = '2ptsEdge' 711 | 712 | init_inputs = [ 713 | NodeInputBP('pnt1', dtype=dtypes.Data(size='s')), 714 | NodeInputBP('Pnt2', dtype=dtypes.Data(size='s')), 715 | ] 716 | 717 | init_outputs = [ 718 | NodeOutputBP(), 719 | ] 720 | 721 | def update_event(self, inp=-1): 722 | pnt1, pnt2 = self.get_inputs() 723 | 724 | if isinstance(pnt1, list): 725 | edges = [] 726 | for p1, p2 in zip(pnt1, pnt2): 727 | edge = BRepBuilderAPI_MakeEdge(p1, p2).Edge() 728 | edges.append(edge) 729 | self.set_output_val(0, edges) 730 | 731 | else: 732 | edge = BRepBuilderAPI_MakeEdge(pnt1, pnt2).Edge() 733 | self.set_output_val(0, edge) 734 | 735 | 736 | class Wire_Node(BrepBuilderAPINodeBase): 737 | """ 738 | Generates Wire________- 739 | o_List of Points______- 740 | """ 741 | 742 | title = 'Wire' 743 | 744 | init_inputs = [ 745 | NodeInputBP('pntslist', dtype=dtypes.Data(size='s')), 746 | ] 747 | 748 | init_outputs = [ 749 | NodeOutputBP(), 750 | ] 751 | 752 | def update_event(self, inp=-1): 753 | 754 | for pointlist in self.get_inputs(): 755 | pointsarray = TColgp_Array1OfPnt(1, len(pointlist)) 756 | for n, i in enumerate(pointlist): 757 | pointsarray.SetValue(n + 1, i) 758 | wirebuild = BRepBuilderAPI_MakeWire() 759 | for i in range(1, len(pointlist)): 760 | edgepoint = BRepBuilderAPI_MakeEdge(pointsarray.Value(i), pointsarray.Value(i + 1)).Edge() 761 | wirebuild.Add(edgepoint) 762 | 763 | self.set_output_val(0, wirebuild.Shape()) 764 | 765 | 766 | class WireFillet2d_Node(BrepBuilderAPINodeBase): 767 | """ 768 | Generates 2dWireFillet_- 769 | o_List of Points______- 770 | o_Fillet Radius_______- 771 | """ 772 | 773 | title = '2dWireFillet' 774 | 775 | init_inputs = [ 776 | NodeInputBP('pntslist', dtype=dtypes.Data(size='s')), 777 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 778 | ] 779 | 780 | init_outputs = [ 781 | NodeOutputBP(), 782 | ] 783 | 784 | def update_event(self, inp=-1): 785 | pointlist, radius = self.get_inputs() 786 | if radius == 0: 787 | radius = 0.01 788 | 789 | pointsarray = TColgp_Array1OfPnt(1, len(pointlist)) 790 | for n, i in enumerate(pointlist): 791 | pointsarray.SetValue(n + 1, i) 792 | 793 | edges = {} 794 | ijk = 0 795 | for i in range(1, len(pointlist)): 796 | edges[ijk] = BRepBuilderAPI_MakeEdge(pointsarray.Value(i), pointsarray.Value(i + 1)).Edge() 797 | ijk += 1 798 | edges_list = list(edges.values()) 799 | wirebuild = BRepBuilderAPI_MakeWire() 800 | 801 | for index, edge in enumerate(edges_list[:-1]): 802 | f = ChFi2d_AnaFilletAlgo() 803 | f.Init(edges_list[index], edges_list[index+ 1], gp_Pln()) 804 | f.Perform(radius) 805 | fillet = f.Result(edges_list[index], edges_list[index + 1]) 806 | wirebuild.Add(edge) 807 | wirebuild.Add(fillet) 808 | 809 | wirebuild.Add(edges_list[-1]) 810 | self.set_output_val(0, wirebuild.Shape()) 811 | 812 | 813 | class DiscretizeWire_Node(BrepBuilderAPINodeBase): 814 | """ 815 | Discretize Wire_______- 816 | o_Wire________________- 817 | o_Nb of points________- 818 | """ 819 | 820 | title = 'DiscretizeWire' 821 | 822 | init_inputs = [ 823 | NodeInputBP('Wire', dtype=dtypes.Data(size='s')), 824 | NodeInputBP('Nb', dtype=dtypes.Data(size='s')), 825 | ] 826 | 827 | init_outputs = [ 828 | NodeOutputBP(), 829 | ] 830 | 831 | def update_event(self, inp=-1): 832 | wire, nbpts = self.get_inputs() 833 | pnts = [] # points to create bsplines 834 | if isinstance(wire, TopoDS_Edge): 835 | wire = BRepBuilderAPI_MakeWire(wire).Wire() 836 | curve_adapt = BRepAdaptor_CompCurve(wire) 837 | # print(curve_adapt) 838 | _lbound, _ubound = curve_adapt.FirstParameter(), curve_adapt.LastParameter() 839 | npts = GCPnts_UniformAbscissa(curve_adapt, nbpts, _lbound, _ubound) 840 | if npts.IsDone(): 841 | for i in range(1, npts.NbPoints() + 1): 842 | pnts.append(curve_adapt.Value(npts.Parameter(i))) 843 | self.set_output_val(0, pnts) 844 | # print(tmp) 845 | 846 | class CurveLength_Node(BrepBuilderAPINodeBase): 847 | """ 848 | Curve Length__________- 849 | o_Wire/Edge(L)________- 850 | """ 851 | 852 | title = 'CurveLength' 853 | 854 | init_inputs = [ 855 | NodeInputBP('Wire/Edge', dtype=dtypes.Data(size='s')), 856 | ] 857 | 858 | init_outputs = [ 859 | NodeOutputBP(), 860 | ] 861 | 862 | def update_event(self, inp=-1): 863 | lengths = [] 864 | for curve in self.get_inputs(): 865 | lengths.append(curve_length(curve)) 866 | self.set_output_val(0, lengths) 867 | # print(tmp) 868 | 869 | 870 | BRepBuilderAPI_nodes = [ 871 | TwoPtsEdge_Node, 872 | Wire_Node, 873 | WireFillet2d_Node, 874 | DiscretizeWire_Node, 875 | CurveLength_Node, 876 | ] 877 | 878 | 879 | # ------------------------------------------- 880 | 881 | # BREPOFFSETAPI------------------------------ 882 | 883 | 884 | class BrepOffsetAPINodeBase(PythonOCCNodeBase): 885 | version = 'v0.1' 886 | color = '#aabb44' 887 | 888 | 889 | class Pipe_Node(BrepOffsetAPINodeBase): 890 | """ 891 | Generates pipe________- 892 | o_Wire________________- 893 | o_Radius______________- 894 | """ 895 | 896 | title = 'pipe' 897 | 898 | init_inputs = [ 899 | NodeInputBP('wire', dtype=dtypes.Data(size='s')), 900 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 901 | ] 902 | 903 | init_outputs = [ 904 | NodeOutputBP(), 905 | ] 906 | 907 | def update_event(self, inp=-1): 908 | wire, radius = self.get_inputs() 909 | 910 | if type(wire) is list: 911 | pipes = [] 912 | for w in wire: 913 | if isinstance(w, TopoDS_Edge): 914 | w = BRepBuilderAPI_MakeWire(w).Wire() 915 | topexp_vertex = TopExp_Explorer() 916 | topexp_vertex.Init(w, TopAbs_VERTEX) 917 | vertices = [] 918 | while topexp_vertex.More(): 919 | vert = topods_Vertex(topexp_vertex.Current()) 920 | point = BRep_Tool.Pnt(vert) 921 | vertices.append(point) 922 | topexp_vertex.Next() 923 | dir_ = gp_Dir(vertices[1].X()-vertices[0].X(), vertices[1].Y()-vertices[0].Y(), vertices[1].Z()-vertices[0].Z()) 924 | if radius == 0: 925 | radius = 0.01 926 | circle = gp_Circ(gp_Ax2(vertices[0], dir_), radius) 927 | profile_edge = BRepBuilderAPI_MakeEdge(circle).Edge() 928 | profile_wire = BRepBuilderAPI_MakeWire(profile_edge).Wire() 929 | profile_face = BRepBuilderAPI_MakeFace(profile_wire).Face() 930 | pipe = BRepOffsetAPI_MakePipe(w, profile_face).Shape() 931 | pipes.append(pipe) 932 | self.set_output_val(0, pipes) 933 | 934 | else: 935 | if isinstance(wire, TopoDS_Edge): 936 | wire = BRepBuilderAPI_MakeWire(wire).Wire() 937 | topexp_vertex = TopExp_Explorer() 938 | topexp_vertex.Init(wire, TopAbs_VERTEX) 939 | vertices = [] 940 | while topexp_vertex.More(): 941 | vert = topods_Vertex(topexp_vertex.Current()) 942 | point = BRep_Tool.Pnt(vert) 943 | vertices.append(point) 944 | topexp_vertex.Next() 945 | dir_ = gp_Dir(vertices[1].X() - vertices[0].X(), vertices[1].Y() - vertices[0].Y(), vertices[1].Z() - vertices[0].Z()) 946 | if radius == 0: 947 | radius = 0.01 948 | circle = gp_Circ(gp_Ax2(vertices[0], dir_), radius) 949 | profile_edge = BRepBuilderAPI_MakeEdge(circle).Edge() 950 | profile_wire = BRepBuilderAPI_MakeWire(profile_edge).Wire() 951 | profile_face = BRepBuilderAPI_MakeFace(profile_wire).Face() 952 | pipe = BRepOffsetAPI_MakePipe(wire, profile_face).Shape() 953 | self.set_output_val(0, pipe) 954 | 955 | 956 | BRepOffsetAPI_nodes = [ 957 | Pipe_Node, 958 | ] 959 | 960 | 961 | # ------------------------------------------- 962 | 963 | # BREPPRIMAPI -------------------------------- 964 | 965 | 966 | class BrepPrimAPINodeBase(PythonOCCNodeBase): 967 | version = 'v0.1' 968 | color = '#aabb44' 969 | 970 | 971 | class Box_Node(BrepPrimAPINodeBase): 972 | """ 973 | Generates box_________- 974 | o_Width_______________- 975 | o_Length______________- 976 | o_Height______________- 977 | """ 978 | 979 | title = 'box' 980 | 981 | init_inputs = [ 982 | NodeInputBP('w', dtype=dtypes.Data(size='s')), 983 | NodeInputBP('l', dtype=dtypes.Data(size='s')), 984 | NodeInputBP('h', dtype=dtypes.Data(size='s')), 985 | ] 986 | 987 | init_outputs = [ 988 | NodeOutputBP(), 989 | ] 990 | 991 | def update_event(self, inp=-1): 992 | width, length, height = self.get_inputs() 993 | box = BRepPrimAPI_MakeBox(gp_Pnt(), width, length, height).Shape() 994 | self.set_output_val(0, box) 995 | 996 | 997 | class Sphere_Node(BrepPrimAPINodeBase): 998 | """ 999 | Generates sphere_________- 1000 | o_Center point/ax2_______- 1001 | o_Radius_________________- 1002 | """ 1003 | 1004 | title = 'sphere' 1005 | 1006 | init_inputs = [ 1007 | NodeInputBP('point', dtype=dtypes.Data(size='s')), 1008 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 1009 | ] 1010 | 1011 | init_outputs = [ 1012 | NodeOutputBP(), 1013 | ] 1014 | 1015 | def update_event(self, inp=-1): 1016 | point, radius = self.get_inputs() 1017 | sphere = BRepPrimAPI_MakeSphere(point, radius).Shape() 1018 | self.set_output_val(0, sphere) 1019 | 1020 | 1021 | class Cylinder_Node(BrepPrimAPINodeBase): 1022 | """ 1023 | Generates cylinder_______- 1024 | o_Axe____________________- 1025 | o_Radius_________________- 1026 | o_Length_________________- 1027 | """ 1028 | 1029 | title = 'cylinder' 1030 | 1031 | init_inputs = [ 1032 | NodeInputBP('axe', dtype=dtypes.Data(size='s')), 1033 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 1034 | NodeInputBP('len', dtype=dtypes.Data(size='s')), 1035 | ] 1036 | 1037 | init_outputs = [ 1038 | NodeOutputBP(), 1039 | ] 1040 | 1041 | def update_event(self, inp=-1): 1042 | axe, radius, length = self.get_inputs() 1043 | cylinder = BRepPrimAPI_MakeCylinder(axe, radius, length).Shape() 1044 | self.set_output_val(0, cylinder) 1045 | 1046 | class Torus_Node(BrepPrimAPINodeBase): 1047 | """ 1048 | Generates torus__________- 1049 | o_Ax2____________________- 1050 | o_Distance center/center_- 1051 | o_Radius_________________- 1052 | """ 1053 | 1054 | title = 'torus' 1055 | 1056 | init_inputs = [ 1057 | NodeInputBP('axe', dtype=dtypes.Data(size='s')), 1058 | NodeInputBP('distance', dtype=dtypes.Data(size='s')), 1059 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 1060 | ] 1061 | 1062 | init_outputs = [ 1063 | NodeOutputBP(), 1064 | ] 1065 | 1066 | def update_event(self, inp=-1): 1067 | axe, distance, radius = self.get_inputs() 1068 | torus = BRepPrimAPI_MakeTorus(axe, distance, radius).Shape() 1069 | self.set_output_val(0, torus) 1070 | 1071 | 1072 | BRepPrimAPI_nodes = [ 1073 | Box_Node, 1074 | Sphere_Node, 1075 | Cylinder_Node, 1076 | Torus_Node, 1077 | ] 1078 | 1079 | 1080 | # ------------------------------------------- 1081 | 1082 | # BREPALGOAPI -------------------------------- 1083 | 1084 | 1085 | class BrepAlgoAPINodeBase(PythonOCCNodeBase): 1086 | version = 'v0.1' 1087 | color = '#ab0c36' 1088 | 1089 | 1090 | class Fuse_Node(BrepAlgoAPINodeBase): 1091 | """ 1092 | Generates fusion_________- 1093 | o_Part 1 (or list)_______- 1094 | o_Part 2_________________- 1095 | """ 1096 | 1097 | title = 'fuse' 1098 | 1099 | init_inputs = [ 1100 | NodeInputBP('a', dtype=dtypes.Data(size='s')), 1101 | NodeInputBP('b', dtype=dtypes.Data(size='s')), 1102 | ] 1103 | init_outputs = [ 1104 | NodeOutputBP(), 1105 | ] 1106 | 1107 | def update_event(self, inp=-1): 1108 | a, b = self.get_inputs() 1109 | if type(a) is list: 1110 | count = len(a) 1111 | fuse_shps = {} 1112 | ijk = 0 1113 | fuse_shps[ijk] = BRepAlgoAPI_Fuse(a[0], a[1]).Shape() 1114 | for i in range(2, count): 1115 | ijk += 1 1116 | fuse_shps[ijk] = BRepAlgoAPI_Fuse(fuse_shps[ijk-1], a[i]).Shape() 1117 | self.set_output_val(0, fuse_shps[ijk]) 1118 | else: 1119 | fuse_shp = BRepAlgoAPI_Fuse(a, b).Shape() 1120 | self.set_output_val(0, fuse_shp) 1121 | 1122 | 1123 | class Common_Node(BrepAlgoAPINodeBase): 1124 | """ 1125 | Generates common_________- 1126 | o_Part 1_________________- 1127 | o_Part 2_________________- 1128 | """ 1129 | 1130 | title = 'common' 1131 | 1132 | init_inputs = [ 1133 | NodeInputBP('a', dtype=dtypes.Data(size='s')), 1134 | NodeInputBP('b', dtype=dtypes.Data(size='s')), 1135 | ] 1136 | init_outputs = [ 1137 | NodeOutputBP(), 1138 | ] 1139 | 1140 | def update_event(self, inp=-1): 1141 | a, b = self.get_inputs() 1142 | common_shp = BRepAlgoAPI_Common(a, b).Shape() 1143 | self.set_output_val(0, common_shp) 1144 | 1145 | 1146 | class Cut_Node(BrepAlgoAPINodeBase): 1147 | """ 1148 | Generates cutting________- 1149 | o_Basis__________________- 1150 | o_Cutter (or list)_______- 1151 | """ 1152 | 1153 | title = 'cut' 1154 | 1155 | init_inputs = [ 1156 | NodeInputBP('Basis', dtype=dtypes.Data(size='s')), 1157 | NodeInputBP('Cutter', dtype=dtypes.Data(size='s')), 1158 | ] 1159 | init_outputs = [ 1160 | NodeOutputBP(), 1161 | ] 1162 | 1163 | def update_event(self, inp=-1): 1164 | basis, cutter = self.get_inputs() 1165 | if type(cutter) is list and type(basis) is not list: 1166 | count = len(cutter) 1167 | cut_shps = {} 1168 | ijk = 0 1169 | cut_shps[ijk] = BRepAlgoAPI_Cut(basis, cutter[0]).Shape() 1170 | for i in range(1, count): 1171 | ijk += 1 1172 | cut_shps[ijk] = BRepAlgoAPI_Cut(cut_shps[ijk - 1], cutter[i]).Shape() 1173 | self.set_output_val(0, cut_shps[ijk]) 1174 | elif type(basis) is list and type(cutter) is not list: 1175 | cut_shps = [] 1176 | for b in basis: 1177 | cut_shps.append(BRepAlgoAPI_Cut(b, cutter).Shape()) 1178 | self.set_output_val(0, cut_shps) 1179 | else: 1180 | cut_shp = BRepAlgoAPI_Cut(basis, cutter).Shape() 1181 | self.set_output_val(0, cut_shp) 1182 | 1183 | class Section_Node(BrepAlgoAPINodeBase): 1184 | """ 1185 | Generates Sections_______- 1186 | o_Basis__________________- 1187 | o_Cutter (or list)_______- 1188 | """ 1189 | 1190 | title = 'section' 1191 | 1192 | init_inputs = [ 1193 | NodeInputBP('Basis', dtype=dtypes.Data(size='s')), 1194 | NodeInputBP('Cutter', dtype=dtypes.Data(size='s')), 1195 | ] 1196 | init_outputs = [ 1197 | NodeOutputBP(), 1198 | ] 1199 | 1200 | def update_event(self, inp=-1): 1201 | basis, cutter = self.get_inputs() 1202 | if None not in (basis, cutter): 1203 | if type(cutter) is list and type(basis) is not list: 1204 | count = len(cutter) 1205 | cut_shps = {} 1206 | ijk = 0 1207 | cut_shps[ijk] = BRepAlgoAPI_Section(basis, cutter[0]).Shape() 1208 | for i in range(1, count): 1209 | ijk += 1 1210 | cut_shps[ijk] = BRepAlgoAPI_Section(cut_shps[ijk - 1], cutter[i]).Shape() 1211 | self.set_output_val(0, cut_shps[ijk]) 1212 | elif type(basis) is list and type(cutter) is not list: 1213 | cut_shps = [] 1214 | for b in basis: 1215 | cut_shps.append(BRepAlgoAPI_Section(b, cutter).Shape()) 1216 | self.set_output_val(0, cut_shps) 1217 | else: 1218 | cut_shp = BRepAlgoAPI_Section(basis, cutter).Shape() 1219 | self.set_output_val(0, cut_shp) 1220 | 1221 | 1222 | BRepAlgoAPI_nodes = [ 1223 | Fuse_Node, 1224 | Common_Node, 1225 | Cut_Node, 1226 | Section_Node, 1227 | ] 1228 | 1229 | 1230 | # ------------------------------------------- 1231 | 1232 | # BREPFILLETAPI -------------------------------- 1233 | 1234 | 1235 | class BrepFilletAPINodeBase(PythonOCCNodeBase): 1236 | version = 'v0.1' 1237 | color = '#e0149c' 1238 | 1239 | 1240 | class Fillet_Node(BrepFilletAPINodeBase): 1241 | """ 1242 | Generates fillet_________- 1243 | o_Shape__________________- 1244 | o_Radius_________________- 1245 | """ 1246 | 1247 | title = 'fillet' 1248 | 1249 | init_inputs = [ 1250 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1251 | NodeInputBP('radius', dtype=dtypes.Data(size='s')), 1252 | ] 1253 | init_outputs = [ 1254 | NodeOutputBP(), 1255 | ] 1256 | 1257 | def update_event(self, inp=-1): 1258 | shape, radius = self.get_inputs() 1259 | fill = BRepFilletAPI_MakeFillet(shape) 1260 | 1261 | for e in TopologyExplorer(shape).edges(): 1262 | fill.Add(e) 1263 | 1264 | for i in range(1, fill.NbContours() + 1): 1265 | length = fill.Length(i) 1266 | fill.SetRadius(radius, i, 1) 1267 | 1268 | blended_fused_solids = fill.Shape() 1269 | 1270 | self.set_output_val(0, blended_fused_solids) 1271 | 1272 | 1273 | BRepFilletAPI_nodes = [ 1274 | Fillet_Node, 1275 | ] 1276 | 1277 | 1278 | # ------------------------------------------- 1279 | 1280 | # GEOMAPI------------------------------------ 1281 | 1282 | class GeomNodeBase(PythonOCCNodeBase): 1283 | version = 'v0.1' 1284 | color = '#c91604' 1285 | 1286 | class Circle_Node(GeomNodeBase): 1287 | """ 1288 | Draw circle______________- 1289 | o_Ax2____________________- 1290 | o_Radius_________________- 1291 | """ 1292 | 1293 | title = 'Circle' 1294 | 1295 | init_inputs = [ 1296 | NodeInputBP('Ax2', dtype=dtypes.Data(size='s')), 1297 | NodeInputBP('Radius', dtype=dtypes.Data(size='s')), 1298 | ] 1299 | init_outputs = [ 1300 | NodeOutputBP(), 1301 | ] 1302 | 1303 | def update_event(self, inp=-1): 1304 | axis, radius = self.get_inputs() 1305 | circle = Geom_Circle(axis, radius) 1306 | self.set_output_val(0, circle) 1307 | 1308 | Geom_nodes = [ 1309 | Circle_Node, 1310 | ] 1311 | 1312 | # ------------------------------------------- 1313 | 1314 | # GEOMAPI------------------------------------ 1315 | 1316 | class GeomAPINodeBase(PythonOCCNodeBase): 1317 | version = 'v0.1' 1318 | color = '#ff4633' 1319 | 1320 | class PointsSurface_Node(GeomAPINodeBase): 1321 | """ 1322 | Generates surface________- 1323 | o_List of points_________- 1324 | """ 1325 | 1326 | title = 'PointsSurface' 1327 | 1328 | init_inputs = [ 1329 | NodeInputBP('points', dtype=dtypes.Data(size='s')), 1330 | ] 1331 | init_outputs = [ 1332 | NodeOutputBP(), 1333 | ] 1334 | 1335 | def update_event(self, inp=-1): 1336 | count = 0 1337 | pts = {} 1338 | for l in self.get_inputs(): 1339 | pts[count] = l 1340 | nbpts = len(l) 1341 | count += 1 1342 | pts_list = list(pts.values()) 1343 | array = TColgp_Array2OfPnt(1, nbpts, 1, len(pts_list)) # nbrow, nbcol 1344 | for c in range(count): 1345 | for n in range(nbpts): 1346 | print(pts[c][n]) 1347 | array.SetValue(n + 1, c + 1, pts[c][n]) 1348 | nurbs = GeomAPI_PointsToBSplineSurface(array, 2, 2, GeomAbs_C2, 0.001).Surface() 1349 | self.set_output_val(0, nurbs) 1350 | 1351 | 1352 | GeomAPI_nodes = [ 1353 | PointsSurface_Node, 1354 | ] 1355 | 1356 | 1357 | # ------------------------------------------- 1358 | 1359 | # SHAPE ANALYSIS -------------------------- 1360 | 1361 | 1362 | class TopExplorer_Node(PythonOCCNodeBase): 1363 | """ 1364 | Topology Explorer________- 1365 | o_Shape__________________- 1366 | """ 1367 | 1368 | title = 'topexp' 1369 | version = 'v0.1' 1370 | color = '#FF00FF' 1371 | 1372 | init_inputs = [ 1373 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1374 | ] 1375 | init_outputs = [ 1376 | NodeOutputBP('vertex'), 1377 | NodeOutputBP('edges'), 1378 | NodeOutputBP('wires'), 1379 | NodeOutputBP('faces'), 1380 | NodeOutputBP('shells'), 1381 | NodeOutputBP('solids'), 1382 | NodeOutputBP('compounds'), 1383 | NodeOutputBP('compsolids'), 1384 | ] 1385 | 1386 | def update_event(self, inp=-1): 1387 | for shape in self.get_inputs(): 1388 | #find vertices 1389 | topexp_vertex = TopExp_Explorer() 1390 | topexp_vertex.Init(shape, TopAbs_VERTEX) 1391 | vertices = [] 1392 | while topexp_vertex.More(): 1393 | vert = topods_Vertex(topexp_vertex.Current()) 1394 | point = BRep_Tool.Pnt(vert) 1395 | vertices.append(point) 1396 | topexp_vertex.Next() 1397 | vertices_red = filter_points_by_distance(vertices, 0.01) 1398 | #find edges 1399 | topexp_edge = TopExp_Explorer() 1400 | topexp_edge.Init(shape, TopAbs_EDGE) 1401 | edges = [] 1402 | while topexp_edge.More(): 1403 | edge = topods_Edge(topexp_edge.Current()) 1404 | edges.append(edge) 1405 | topexp_edge.Next() 1406 | # find wires 1407 | topexp_wire = TopExp_Explorer() 1408 | topexp_wire.Init(shape, TopAbs_WIRE) 1409 | wires = [] 1410 | while topexp_wire.More(): 1411 | wire = topods_Wire(topexp_wire.Current()) 1412 | wires.append(wire) 1413 | topexp_wire.Next() 1414 | #find faces 1415 | topexp_face = TopExp_Explorer() 1416 | topexp_face.Init(shape, TopAbs_FACE) 1417 | faces = [] 1418 | while topexp_face.More(): 1419 | face = topods_Face(topexp_face.Current()) 1420 | faces.append(face) 1421 | topexp_face.Next() 1422 | #find shells 1423 | topexp_shell = TopExp_Explorer() 1424 | topexp_shell.Init(shape, TopAbs_SHELL) 1425 | shells = [] 1426 | while topexp_shell.More(): 1427 | shell = topods_Shell(topexp_shell.Current()) 1428 | shells.append(shell) 1429 | topexp_shell.Next() 1430 | # find solids 1431 | topexp_solid = TopExp_Explorer() 1432 | topexp_solid.Init(shape, TopAbs_SOLID) 1433 | solids = [] 1434 | while topexp_solid.More(): 1435 | solid = topods_Solid(topexp_solid.Current()) 1436 | solids.append(solid) 1437 | topexp_solid.Next() 1438 | # find compounds 1439 | topexp_compound = TopExp_Explorer() 1440 | topexp_compound.Init(shape, TopAbs_COMPOUND) 1441 | compounds = [] 1442 | while topexp_compound.More(): 1443 | compound = topods_Compound(topexp_compound.Current()) 1444 | compounds.append(compound) 1445 | topexp_compound.Next() 1446 | # find compsolids 1447 | topexp_compsolid = TopExp_Explorer() 1448 | topexp_compsolid.Init(shape, TopAbs_COMPSOLID) 1449 | compsolids = [] 1450 | while topexp_compsolid.More(): 1451 | compsolid = topods_CompSolid(topexp_compsolid.Current()) 1452 | compsolids.append(compsolid) 1453 | topexp_compsolid.Next() 1454 | 1455 | self.set_output_val(0, vertices_red) 1456 | self.set_output_val(1, edges) 1457 | self.set_output_val(2, wires) 1458 | self.set_output_val(3, faces) 1459 | self.set_output_val(4, shells) 1460 | self.set_output_val(5, solids) 1461 | self.set_output_val(6, compounds) 1462 | self.set_output_val(7, compsolids) 1463 | 1464 | 1465 | class BoundingBox_Node(PythonOCCNodeBase): 1466 | """ 1467 | Bounding Box________- 1468 | o_Shape__________________- 1469 | """ 1470 | 1471 | title = 'bounding box' 1472 | version = 'v0.1' 1473 | color = '#FF00FF' 1474 | 1475 | init_inputs = [ 1476 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1477 | ] 1478 | init_outputs = [ 1479 | NodeOutputBP('box'), 1480 | ] 1481 | 1482 | def update_event(self, inp=-1): 1483 | bboxes = [] 1484 | for shape in self.get_inputs(): 1485 | aBaryCenter, [aHalfX, aHalfY, aHalfZ], aBox = get_oriented_boundingbox(shape) 1486 | bboxes.append(aBox) 1487 | self.set_output_val(0, bboxes) # TODO make it work for list 1488 | 1489 | 1490 | Shape_Analysis_nodes = [ 1491 | TopExplorer_Node, 1492 | BoundingBox_Node, 1493 | ] 1494 | 1495 | 1496 | # ------------------------------------------- 1497 | 1498 | # DISPLAY -------------------------------- 1499 | 1500 | 1501 | class DisplayNodeBase(PythonOCCNodeBase): 1502 | version = 'v0.1' 1503 | color = '#3355dd' 1504 | 1505 | 1506 | class Display_Node(DisplayNodeBase): 1507 | """ 1508 | display shapes 1509 | o_Shapes__________________- 1510 | """ 1511 | 1512 | title = 'display' 1513 | 1514 | init_inputs = [ 1515 | NodeInputBP('shapes', dtype=dtypes.Data(size='s')), 1516 | ] 1517 | 1518 | def update_event(self, inp=-1): 1519 | display.EraseAll() 1520 | for v in self.get_inputs(): 1521 | if v is None: 1522 | pass 1523 | elif type(v) is list : 1524 | for el in v: 1525 | if type(el) is list : 1526 | for e in el: 1527 | if type(e) is list: 1528 | shape = e[0] 1529 | colore = e[1] 1530 | display.DisplayShape(shape, color=colore) 1531 | else: 1532 | if isinstance(e, int): 1533 | shape = el[0] 1534 | colore = el[1] 1535 | display.DisplayShape(shape, color=colore) 1536 | else: 1537 | display.DisplayShape(e) 1538 | else: 1539 | if isinstance(el, int): 1540 | shape = v[0] 1541 | colore = v[1] 1542 | display.DisplayShape(shape, color=colore) 1543 | else: 1544 | display.DisplayShape(el) 1545 | else : 1546 | display.DisplayShape(v) 1547 | display.FitAll() 1548 | 1549 | 1550 | class Color_Node(DisplayNodeBase): 1551 | """ 1552 | Choose Color_____________- 1553 | o_Shape__________________- 1554 | o_QuantityColor(int)_____- 1555 | """ 1556 | 1557 | title = 'color' 1558 | 1559 | init_inputs = [ 1560 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1561 | NodeInputBP('Int', dtype=dtypes.Data(size='s')), 1562 | ] 1563 | init_outputs = [ 1564 | NodeOutputBP(), 1565 | ] 1566 | 1567 | def update_event(self, inp=-1): 1568 | shapecolored = [] 1569 | shape, colore = self.get_inputs() 1570 | if type(shape) is list: 1571 | for shp in shape: 1572 | shapecolored.append([shp, colore]) 1573 | self.set_output_val(0, shapecolored) 1574 | else: 1575 | shapecolored.append(shape) 1576 | shapecolored.append(colore) 1577 | self.set_output_val(0, shapecolored) 1578 | 1579 | 1580 | Display_nodes = [ 1581 | Display_Node, 1582 | Color_Node, 1583 | ] 1584 | 1585 | 1586 | # ------------------------------------------- 1587 | 1588 | # TOOLS-------------------------------------- 1589 | 1590 | 1591 | class List_Node(PythonOCCNodeBase_DynamicInputs): 1592 | """ 1593 | Generates List_______- 1594 | o_A__________________- 1595 | o_B__________________- 1596 | """ 1597 | 1598 | title = 'List' 1599 | version = 'v0.1' 1600 | color = '#000000' 1601 | 1602 | init_inputs = [ 1603 | NodeInputBP(dtype=dtypes.Data(size='s')), 1604 | NodeInputBP(dtype=dtypes.Data(size='s')), 1605 | ] 1606 | 1607 | init_outputs = [ 1608 | NodeOutputBP(), 1609 | ] 1610 | 1611 | def apply_op(self, elements: list): 1612 | return elements 1613 | 1614 | 1615 | class ListLength_Node(PythonOCCNodeBase): 1616 | """ 1617 | List Length__________- 1618 | o_List_______________- 1619 | """ 1620 | 1621 | title = 'ListLength' 1622 | version = 'v0.1' 1623 | color = '#000000' 1624 | 1625 | init_inputs = [ 1626 | NodeInputBP('list', dtype=dtypes.Data(size='s')), 1627 | ] 1628 | 1629 | init_outputs = [ 1630 | NodeOutputBP(), 1631 | ] 1632 | 1633 | def update_event(self, inp=-1): 1634 | for el in self.get_inputs(): 1635 | if type(el) is list: 1636 | length = len(el) 1637 | self.set_output_val(0, length) 1638 | else : 1639 | pass 1640 | 1641 | 1642 | class FlattenList_Node(PythonOCCNodeBase): 1643 | """ 1644 | Flatten list_________- 1645 | o_List_______________- 1646 | """ 1647 | 1648 | title = 'FlattenList' 1649 | version = 'v0.1' 1650 | color = '#000000' 1651 | 1652 | init_inputs = [ 1653 | NodeInputBP('list', dtype=dtypes.Data(size='s')), 1654 | ] 1655 | 1656 | init_outputs = [ 1657 | NodeOutputBP(), 1658 | ] 1659 | 1660 | def update_event(self, inp=-1): 1661 | newlist = [] 1662 | for el in self.get_inputs(): 1663 | if type(el) is list: 1664 | for e in el: 1665 | if type(e) is list: 1666 | for a in e: 1667 | newlist.append(a) 1668 | else: 1669 | newlist.append(e) 1670 | else: 1671 | newlist.append(el) 1672 | self.set_output_val(0,newlist) 1673 | 1674 | 1675 | class ListItem_Node(PythonOCCNodeBase): 1676 | """ 1677 | Item list____________- 1678 | o_List_______________- 1679 | o_Indec______________- 1680 | """ 1681 | 1682 | title = 'ListItem' 1683 | version = 'v0.1' 1684 | color = '#000000' 1685 | 1686 | init_inputs = [ 1687 | NodeInputBP('list', dtype=dtypes.Data(size='s')), 1688 | NodeInputBP('index', dtype=dtypes.Data(size='s')), 1689 | ] 1690 | 1691 | init_outputs = [ 1692 | NodeOutputBP(), 1693 | ] 1694 | 1695 | def update_event(self, inp=-1): 1696 | reflist, index = self.get_inputs() 1697 | self.set_output_val(0, reflist[index]) 1698 | 1699 | 1700 | class RepeatData_Node(PythonOCCNodeBase): 1701 | """ 1702 | Repeat Data__________- 1703 | o_Data as List_______- 1704 | o_Length of repeat___- 1705 | """ 1706 | 1707 | title = 'RepeatData' 1708 | version = 'v0.1' 1709 | color = '#000000' 1710 | 1711 | init_inputs = [ 1712 | NodeInputBP('Data', dtype=dtypes.Data(size='s')), 1713 | NodeInputBP('Length', dtype=dtypes.Data(size='s')), 1714 | ] 1715 | 1716 | init_outputs = [ 1717 | NodeOutputBP(), 1718 | ] 1719 | 1720 | def update_event(self, inp=-1): 1721 | Data, Length = self.get_inputs() 1722 | repeat = [] 1723 | for l in range(Length): 1724 | if type(Data) is list: 1725 | for d in Data: 1726 | repeat.append(d) 1727 | else: 1728 | repeat.append(Data) 1729 | self.set_output_val(0, repeat) 1730 | 1731 | 1732 | class Serie_Node(PythonOCCNodeBase): 1733 | """ 1734 | Create Serie_________- 1735 | o_Start______________- 1736 | o_Step_______________- 1737 | o_Length_____________- 1738 | """ 1739 | 1740 | title = 'Serie' 1741 | version = 'v0.1' 1742 | color = '#000000' 1743 | 1744 | init_inputs = [ 1745 | NodeInputBP('Start', dtype=dtypes.Data(size='s')), 1746 | NodeInputBP('Step', dtype=dtypes.Data(size='s')), 1747 | NodeInputBP('Length', dtype=dtypes.Data(size='s')), 1748 | ] 1749 | 1750 | init_outputs = [ 1751 | NodeOutputBP(), 1752 | ] 1753 | 1754 | def update_event(self, inp=-1): 1755 | Start, Step, Length = self.get_inputs() 1756 | serie = [] 1757 | count = Start 1758 | serie.append(Start) 1759 | for l in range(Length-1): 1760 | count += Step 1761 | serie.append(count) 1762 | self.set_output_val(0, serie) 1763 | 1764 | class ShiftList_Node(PythonOCCNodeBase): 1765 | """ 1766 | Shift List___________- 1767 | o_List_______________- 1768 | o_Shift value________- 1769 | """ 1770 | 1771 | title = 'ShiftLIst' 1772 | version = 'v0.1' 1773 | color = '#000000' 1774 | 1775 | init_inputs = [ 1776 | NodeInputBP('List', dtype=dtypes.Data(size='s')), 1777 | NodeInputBP('ShiftValue', dtype=dtypes.Data(size='s')), 1778 | ] 1779 | 1780 | init_outputs = [ 1781 | NodeOutputBP(), 1782 | ] 1783 | 1784 | def update_event(self, inp=-1): 1785 | list_, value = self.get_inputs() 1786 | shifted_list = [] 1787 | if value < 0: 1788 | for i in range(len(list_) - value): 1789 | shifted_list.append(list_[i]) 1790 | elif value > 0: 1791 | for i in range(value, len(list_)): 1792 | shifted_list.append(list_[i]) 1793 | self.set_output_val(0, shifted_list) 1794 | 1795 | 1796 | Tools_nodes = [ 1797 | List_Node, 1798 | ListLength_Node, 1799 | FlattenList_Node, 1800 | ListItem_Node, 1801 | RepeatData_Node, 1802 | Serie_Node, 1803 | ShiftList_Node, 1804 | ] 1805 | 1806 | 1807 | # -------------------------------------------------------- 1808 | 1809 | # DATA EXCHANGE------------------------------------------ 1810 | 1811 | 1812 | class DataExchangeNodeBase(PythonOCCNodeBase): 1813 | version = 'v0.1' 1814 | color = '#6b6767' 1815 | 1816 | 1817 | class ExportStep_Node(DataExchangeNodeBase): 1818 | """ 1819 | Generates Step_______- 1820 | o_Shape______________- 1821 | o_Name_______________- 1822 | """ 1823 | 1824 | title = 'ExportStep' 1825 | 1826 | init_inputs = [ 1827 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1828 | NodeInputBP('fname', dtype=dtypes.Data(size='s')), 1829 | ] 1830 | 1831 | init_outputs = [ 1832 | NodeOutputBP(), 1833 | ] 1834 | 1835 | def update_event(self, inp=-1): 1836 | shape, filename = self.get_inputs() 1837 | step_writer = STEPControl_Writer() 1838 | step_writer.Transfer(shape, STEPControl_AsIs) 1839 | status = step_writer.Write(str(filename)+'.stp') 1840 | 1841 | 1842 | class ImportStep_Node(DataExchangeNodeBase): 1843 | """ 1844 | Import Step__________- 1845 | o_Filename___________- 1846 | """ 1847 | 1848 | title = 'ImportStep' 1849 | doc = 'returns the evaluated text that is typed into the input field' 1850 | init_outputs = [ 1851 | NodeOutputBP(), 1852 | ] 1853 | main_widget_class = widgets.ImportFileNode_MainWidget 1854 | main_widget_pos = 'between ports' 1855 | style = 'normal' 1856 | 1857 | def __init__(self, params): 1858 | super().__init__(params) 1859 | 1860 | self.actions['edit string via dialog'] = {'method': self.action_edit_via_dialog} 1861 | self.string = None 1862 | 1863 | 1864 | def place_event(self): 1865 | self.update() 1866 | 1867 | def view_place_event(self): 1868 | self.main_widget().value_changed.connect(self.main_widget_string_changed) 1869 | 1870 | def main_widget_string_changed(self, string): 1871 | self.string = string 1872 | self.update() 1873 | 1874 | def update_event(self, input_called=-1): 1875 | shape = read_step_file(self.string) 1876 | self.set_output_val(0, shape) 1877 | 1878 | def action_edit_via_dialog(self): 1879 | return 1880 | 1881 | # from ..EditVal_Dialog import EditVal_Dialog 1882 | # 1883 | # val_dialog = EditVal_Dialog(parent=None, init_val=self.val) 1884 | # accepted = val_dialog.exec_() 1885 | # if accepted: 1886 | # self.main_widget().setText(str(val_dialog.get_val())) 1887 | # self.update() 1888 | 1889 | 1890 | def get_current_var_name(self): 1891 | return self.input(0) 1892 | 1893 | 1894 | def get_state(self): 1895 | return { 1896 | 'string': self.string # self.main_widget().get_val() 1897 | } 1898 | 1899 | def set_state(self, data, version): 1900 | self.string = data['string'] 1901 | 1902 | 1903 | class ExportStl_Node(DataExchangeNodeBase): 1904 | """ 1905 | Generates Stl________- 1906 | o_Shape______________- 1907 | o_Name_______________- 1908 | """ 1909 | 1910 | title = 'ExportStl' 1911 | 1912 | init_inputs = [ 1913 | NodeInputBP('shape', dtype=dtypes.Data(size='s')), 1914 | NodeInputBP('name', dtype=dtypes.Data(size='s')), 1915 | ] 1916 | 1917 | init_outputs = [ 1918 | NodeOutputBP(), 1919 | ] 1920 | 1921 | def update_event(self, inp=-1): 1922 | shape, filename = self.get_inputs() 1923 | status = write_stl_file(shape, str(filename)+'.stl', mode="ascii", linear_deflection=0.9, angular_deflection=0.5) 1924 | 1925 | 1926 | class ImportStl_Node(DataExchangeNodeBase): 1927 | """ 1928 | Import Stl___________- 1929 | o_Filename___________- 1930 | """ 1931 | 1932 | title = 'ImportStl' 1933 | doc = 'returns the evaluated text that is typed into the input field' 1934 | init_outputs = [ 1935 | NodeOutputBP(), 1936 | ] 1937 | main_widget_class = widgets.ImportFileNode_MainWidget 1938 | main_widget_pos = 'between ports' 1939 | style = 'normal' 1940 | 1941 | def __init__(self, params): 1942 | super().__init__(params) 1943 | 1944 | self.actions['edit string via dialog'] = {'method': self.action_edit_via_dialog} 1945 | self.string = None 1946 | 1947 | 1948 | def place_event(self): 1949 | self.update() 1950 | 1951 | def view_place_event(self): 1952 | self.main_widget().value_changed.connect(self.main_widget_string_changed) 1953 | 1954 | def main_widget_string_changed(self, string): 1955 | self.string = string 1956 | self.update() 1957 | 1958 | def update_event(self, input_called=-1): 1959 | shape = read_stl_file(self.string) 1960 | self.set_output_val(0, shape) 1961 | 1962 | def action_edit_via_dialog(self): 1963 | return 1964 | 1965 | # from ..EditVal_Dialog import EditVal_Dialog 1966 | # 1967 | # val_dialog = EditVal_Dialog(parent=None, init_val=self.val) 1968 | # accepted = val_dialog.exec_() 1969 | # if accepted: 1970 | # self.main_widget().setText(str(val_dialog.get_val())) 1971 | # self.update() 1972 | 1973 | 1974 | def get_current_var_name(self): 1975 | return self.input(0) 1976 | 1977 | 1978 | def get_state(self): 1979 | return { 1980 | 'string': self.string # self.main_widget().get_val() 1981 | } 1982 | 1983 | def set_state(self, data, version): 1984 | self.string = data['string'] 1985 | 1986 | class ExportGcode_Node(DataExchangeNodeBase): 1987 | """ 1988 | Generates Gcode______- 1989 | o_List of point______- 1990 | o_Name_______________- 1991 | o_Speed______________- 1992 | """ 1993 | 1994 | title = 'ExportGcode' 1995 | 1996 | init_inputs = [ 1997 | NodeInputBP('points', dtype=dtypes.Data(size='s')), 1998 | NodeInputBP('name', dtype=dtypes.Data(size='s')), 1999 | NodeInputBP('speed', dtype=dtypes.Data(size='s')), 2000 | ] 2001 | 2002 | init_outputs = [ 2003 | NodeOutputBP(), 2004 | ] 2005 | 2006 | def update_event(self, inp=-1): 2007 | points, filename, speed = self.get_inputs() 2008 | with open(str(filename)+'.gcode', 'w') as file: 2009 | for point in points: 2010 | file.write('G1 X' + str(point.X()) + ' Y' + str(point.Y()) + ' Z' + str(point.Z()) + ' F' + str(speed) + '\n') 2011 | 2012 | 2013 | DataExchange_nodes = [ 2014 | ExportStep_Node, 2015 | ImportStep_Node, 2016 | ExportStl_Node, 2017 | ImportStl_Node, 2018 | ExportGcode_Node, 2019 | ] 2020 | 2021 | 2022 | # ------------------------------------------- 2023 | 2024 | 2025 | export_nodes( 2026 | *Gp_nodes, 2027 | *BRepBuilderAPI_nodes, 2028 | *BRepOffsetAPI_nodes, 2029 | *BRepPrimAPI_nodes, 2030 | *BRepAlgoAPI_nodes, 2031 | *BRepFilletAPI_nodes, 2032 | *Geom_nodes, 2033 | *GeomAPI_nodes, 2034 | *Shape_Analysis_nodes, 2035 | *Display_nodes, 2036 | *Tools_nodes, 2037 | *DataExchange_nodes, 2038 | ) 2039 | -------------------------------------------------------------------------------- /examples/demo_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "general info": { 3 | "type": "Ryven project file" 4 | }, 5 | "required packages": [ 6 | { 7 | "name": "std", 8 | "dir": "C:/Users/tdevillemagne/Documents/00-DEMONSTRATEUR/dev3D/Ryven-master/Ryven/packages/std" 9 | }, 10 | { 11 | "name": "PythonOCC", 12 | "dir": "C:/Users/tdevillemagne/Documents/00-DEMONSTRATEUR/dev3D/Ryven-master/Ryven/packages/PythonOCC" 13 | } 14 | ], 15 | "macro scripts": [], 16 | "scripts": [ 17 | { 18 | "name": "hello world", 19 | "variables": {}, 20 | "flow": { 21 | "algorithm mode": "data", 22 | "nodes": [ 23 | { 24 | "identifier": "built_in.Val_Node", 25 | "state data": "gAN9cQBYAwAAAHZhbHEBSx5zLg==", 26 | "special actions": { 27 | "edit val via dialog": { 28 | "method": "action_edit_via_dialog" 29 | } 30 | }, 31 | "display title": "val", 32 | "inputs": [], 33 | "outputs": [ 34 | { 35 | "type": "data", 36 | "label": "" 37 | } 38 | ], 39 | "pos x": 190.0, 40 | "pos y": 112.0, 41 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMzBxAnMu", 42 | "unconnected ports hidden": false, 43 | "collapsed": false 44 | }, 45 | { 46 | "identifier": "built_in.Val_Node", 47 | "state data": "gAN9cQBYAwAAAHZhbHEBSwpzLg==", 48 | "special actions": { 49 | "edit val via dialog": { 50 | "method": "action_edit_via_dialog" 51 | } 52 | }, 53 | "display title": "val", 54 | "inputs": [], 55 | "outputs": [ 56 | { 57 | "type": "data", 58 | "label": "" 59 | } 60 | ], 61 | "pos x": 190.22819355804288, 62 | "pos y": 219.20334886820834, 63 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMTBxAnMu", 64 | "unconnected ports hidden": false, 65 | "collapsed": false 66 | }, 67 | { 68 | "identifier": "built_in.Val_Node", 69 | "state data": "gAN9cQBYAwAAAHZhbHEBSwJzLg==", 70 | "special actions": { 71 | "edit val via dialog": { 72 | "method": "action_edit_via_dialog" 73 | } 74 | }, 75 | "display title": "val", 76 | "inputs": [], 77 | "outputs": [ 78 | { 79 | "type": "data", 80 | "label": "" 81 | } 82 | ], 83 | "pos x": 192.74777228066597, 84 | "pos y": 328.8050233023125, 85 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMnECcy4=", 86 | "unconnected ports hidden": false, 87 | "collapsed": false 88 | }, 89 | { 90 | "identifier": "built_in.Val_Node", 91 | "state data": "gAN9cQBYAwAAAHZhbHEBSwFzLg==", 92 | "special actions": { 93 | "edit val via dialog": { 94 | "method": "action_edit_via_dialog" 95 | } 96 | }, 97 | "display title": "val", 98 | "inputs": [], 99 | "outputs": [ 100 | { 101 | "type": "data", 102 | "label": "" 103 | } 104 | ], 105 | "pos x": 185.18903611279669, 106 | "pos y": 428.32838284592424, 107 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMXECcy4=", 108 | "unconnected ports hidden": false, 109 | "collapsed": false 110 | }, 111 | { 112 | "identifier": "built_in.Val_Node", 113 | "state data": "gAN9cQBYAwAAAHZhbHEBSwBzLg==", 114 | "special actions": { 115 | "edit val via dialog": { 116 | "method": "action_edit_via_dialog" 117 | } 118 | }, 119 | "display title": "val", 120 | "inputs": [], 121 | "outputs": [ 122 | { 123 | "type": "data", 124 | "label": "" 125 | } 126 | ], 127 | "pos x": 187.70861483541975, 128 | "pos y": 529.1115317508477, 129 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=", 130 | "unconnected ports hidden": false, 131 | "collapsed": false 132 | }, 133 | { 134 | "identifier": "built_in.Val_Node", 135 | "state data": "gAN9cQBYAwAAAHZhbHEBWAAAAABxAnMu", 136 | "special actions": { 137 | "edit val via dialog": { 138 | "method": "action_edit_via_dialog" 139 | } 140 | }, 141 | "display title": "val", 142 | "inputs": [], 143 | "outputs": [ 144 | { 145 | "type": "data", 146 | "label": "" 147 | } 148 | ], 149 | "pos x": 192.7477722806659, 150 | "pos y": 633.6740487397055, 151 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgAAAAAcQJzLg==", 152 | "unconnected ports hidden": false, 153 | "collapsed": false 154 | }, 155 | { 156 | "identifier": "PythonOCC.Box_Node", 157 | "state data": "gAN9cQAu", 158 | "special actions": { 159 | "add input": {}, 160 | "remove input 0": { 161 | "data": 0 162 | }, 163 | "remove input 1": { 164 | "data": 1 165 | }, 166 | "remove input 2": { 167 | "data": 2 168 | } 169 | }, 170 | "display title": "box", 171 | "inputs": [ 172 | { 173 | "type": "data", 174 | "label": "", 175 | "dtype": "DType.Data", 176 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 177 | "has widget": true, 178 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMzBxAnMu" 179 | }, 180 | { 181 | "type": "data", 182 | "label": "", 183 | "dtype": "DType.Data", 184 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 185 | "has widget": true, 186 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMzBxAnMu" 187 | }, 188 | { 189 | "type": "data", 190 | "label": "", 191 | "dtype": "DType.Data", 192 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 193 | "has widget": true, 194 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMTBxAnMu" 195 | } 196 | ], 197 | "outputs": [ 198 | { 199 | "type": "data", 200 | "label": "" 201 | } 202 | ], 203 | "pos x": 473.68079985313983, 204 | "pos y": 109.60167443410417, 205 | "unconnected ports hidden": false, 206 | "collapsed": false 207 | }, 208 | { 209 | "identifier": "PythonOCC.Display_Node", 210 | "state data": "gAN9cQAu", 211 | "special actions": { 212 | "add input": {}, 213 | "remove input 0": { 214 | "data": 0 215 | } 216 | }, 217 | "display title": "display", 218 | "inputs": [ 219 | { 220 | "type": "data", 221 | "label": "", 222 | "dtype": "DType.Data", 223 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 224 | "has widget": true, 225 | "widget data": "gAN9cQBYBAAAAHRleHRxAVg2AAAAWzxjbGFzcyAnVG9wb0RTX0NvbXBvdW5kJz4sIDxjbGFzcyAnVG9wb0RTX0NvbXBvdW5kJz5dcQJzLg==" 226 | } 227 | ], 228 | "outputs": [], 229 | "pos x": 1412.2238740302384, 230 | "pos y": 138.57682974426962, 231 | "unconnected ports hidden": false, 232 | "collapsed": false 233 | }, 234 | { 235 | "identifier": "PythonOCC.Fillet_Node", 236 | "state data": "gAN9cQAu", 237 | "special actions": { 238 | "add input": {}, 239 | "remove input 0": { 240 | "data": 0 241 | }, 242 | "remove input 1": { 243 | "data": 1 244 | } 245 | }, 246 | "display title": "fillet", 247 | "inputs": [ 248 | { 249 | "type": "data", 250 | "label": "", 251 | "dtype": "DType.Data", 252 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 253 | "has widget": true, 254 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgWAAAAPGNsYXNzICdUb3BvRFNfU29saWQnPnECcy4=" 255 | }, 256 | { 257 | "type": "data", 258 | "label": "", 259 | "dtype": "DType.Data", 260 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 261 | "has widget": true, 262 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMXECcy4=" 263 | } 264 | ], 265 | "outputs": [ 266 | { 267 | "type": "data", 268 | "label": "" 269 | } 270 | ], 271 | "pos x": 692.8841487213481, 272 | "pos y": 119.67998932459648, 273 | "unconnected ports hidden": false, 274 | "collapsed": false 275 | }, 276 | { 277 | "identifier": "std.Divide_Node", 278 | "state data": "gAN9cQAu", 279 | "special actions": { 280 | "add input": { 281 | "method": "add_operand_input" 282 | }, 283 | "remove input 0": { 284 | "method": "remove_operand_input", 285 | "data": 0 286 | }, 287 | "remove input 1": { 288 | "method": "remove_operand_input", 289 | "data": 1 290 | } 291 | }, 292 | "display title": "/", 293 | "inputs": [ 294 | { 295 | "type": "data", 296 | "label": "", 297 | "dtype": "DType.Data", 298 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 299 | "has widget": true, 300 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMzBxAnMu" 301 | }, 302 | { 303 | "type": "data", 304 | "label": "", 305 | "dtype": "DType.Data", 306 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 307 | "has widget": true, 308 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMnECcy4=" 309 | } 310 | ], 311 | "outputs": [ 312 | { 313 | "type": "data", 314 | "label": "" 315 | } 316 | ], 317 | "pos x": 531.6311104734709, 318 | "pos y": 296.0504999082124, 319 | "unconnected ports hidden": false, 320 | "collapsed": false 321 | }, 322 | { 323 | "identifier": "PythonOCC.Cylinder_Node", 324 | "state data": "gAN9cQAu", 325 | "special actions": { 326 | "add input": {}, 327 | "remove input 0": { 328 | "data": 0 329 | }, 330 | "remove input 1": { 331 | "data": 1 332 | }, 333 | "remove input 2": { 334 | "data": 2 335 | } 336 | }, 337 | "display title": "cylinder", 338 | "inputs": [ 339 | { 340 | "type": "data", 341 | "label": "", 342 | "dtype": "DType.Data", 343 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 344 | "has widget": true, 345 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9BeDInPnECcy4=" 346 | }, 347 | { 348 | "type": "data", 349 | "label": "", 350 | "dtype": "DType.Data", 351 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 352 | "has widget": true, 353 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 354 | }, 355 | { 356 | "type": "data", 357 | "label": "", 358 | "dtype": "DType.Data", 359 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 360 | "has widget": true, 361 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgDAAAANS4wcQJzLg==" 362 | } 363 | ], 364 | "outputs": [ 365 | { 366 | "type": "data", 367 | "label": "" 368 | } 369 | ], 370 | "pos x": 1233.333784724, 371 | "pos y": 395.5738594518242, 372 | "unconnected ports hidden": false, 373 | "collapsed": false 374 | }, 375 | { 376 | "identifier": "std.Divide_Node", 377 | "state data": "gAN9cQAu", 378 | "special actions": { 379 | "add input": { 380 | "method": "add_operand_input" 381 | }, 382 | "remove input 0": { 383 | "method": "remove_operand_input", 384 | "data": 0 385 | }, 386 | "remove input 1": { 387 | "method": "remove_operand_input", 388 | "data": 1 389 | } 390 | }, 391 | "display title": "/", 392 | "inputs": [ 393 | { 394 | "type": "data", 395 | "label": "", 396 | "dtype": "DType.Data", 397 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 398 | "has widget": true, 399 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMTBxAnMu" 400 | }, 401 | { 402 | "type": "data", 403 | "label": "", 404 | "dtype": "DType.Data", 405 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 406 | "has widget": true, 407 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMnECcy4=" 408 | } 409 | ], 410 | "outputs": [ 411 | { 412 | "type": "data", 413 | "label": "" 414 | } 415 | ], 416 | "pos x": 503.9157445246168, 417 | "pos y": 454.7839594334667, 418 | "unconnected ports hidden": false, 419 | "collapsed": false 420 | }, 421 | { 422 | "identifier": "PythonOCC.Ax2_Node", 423 | "state data": "gAN9cQAu", 424 | "special actions": { 425 | "add input": {}, 426 | "remove input 0": { 427 | "data": 0 428 | }, 429 | "remove input 1": { 430 | "data": 1 431 | } 432 | }, 433 | "display title": "Ax2", 434 | "inputs": [ 435 | { 436 | "type": "data", 437 | "label": "", 438 | "dtype": "DType.Data", 439 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 440 | "has widget": true, 441 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9QbnQnPnECcy4=" 442 | }, 443 | { 444 | "type": "data", 445 | "label": "", 446 | "dtype": "DType.Data", 447 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 448 | "has widget": true, 449 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9EaXInPnECcy4=" 450 | } 451 | ], 452 | "outputs": [ 453 | { 454 | "type": "data", 455 | "label": "" 456 | } 457 | ], 458 | "pos x": 930.9843380092295, 459 | "pos y": 374.157440309528, 460 | "unconnected ports hidden": false, 461 | "collapsed": false 462 | }, 463 | { 464 | "identifier": "PythonOCC.Pnt_Node", 465 | "state data": "gAN9cQAu", 466 | "special actions": { 467 | "add input": {}, 468 | "remove input 0": { 469 | "data": 0 470 | }, 471 | "remove input 1": { 472 | "data": 1 473 | }, 474 | "remove input 2": { 475 | "data": 2 476 | } 477 | }, 478 | "display title": "point", 479 | "inputs": [ 480 | { 481 | "type": "data", 482 | "label": "", 483 | "dtype": "DType.Data", 484 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 485 | "has widget": true, 486 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 487 | }, 488 | { 489 | "type": "data", 490 | "label": "", 491 | "dtype": "DType.Data", 492 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 493 | "has widget": true, 494 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 495 | }, 496 | { 497 | "type": "data", 498 | "label": "", 499 | "dtype": "DType.Data", 500 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 501 | "has widget": true, 502 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgDAAAANS4wcQJzLg==" 503 | } 504 | ], 505 | "outputs": [ 506 | { 507 | "type": "data", 508 | "label": "" 509 | } 510 | ], 511 | "pos x": 710.5211997797098, 512 | "pos y": 345.18228499936254, 513 | "unconnected ports hidden": false, 514 | "collapsed": false 515 | }, 516 | { 517 | "identifier": "PythonOCC.Dir_Node", 518 | "state data": "gAN9cQAu", 519 | "special actions": { 520 | "add input": {}, 521 | "remove input 0": { 522 | "data": 0 523 | }, 524 | "remove input 1": { 525 | "data": 1 526 | }, 527 | "remove input 2": { 528 | "data": 2 529 | } 530 | }, 531 | "display title": "dir", 532 | "inputs": [ 533 | { 534 | "type": "data", 535 | "label": "", 536 | "dtype": "DType.Data", 537 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 538 | "has widget": true, 539 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 540 | }, 541 | { 542 | "type": "data", 543 | "label": "", 544 | "dtype": "DType.Data", 545 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 546 | "has widget": true, 547 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 548 | }, 549 | { 550 | "type": "data", 551 | "label": "", 552 | "dtype": "DType.Data", 553 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 554 | "has widget": true, 555 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMXECcy4=" 556 | } 557 | ], 558 | "outputs": [ 559 | { 560 | "type": "data", 561 | "label": "" 562 | } 563 | ], 564 | "pos x": 700.4428848892176, 565 | "pos y": 525.332163666913, 566 | "unconnected ports hidden": false, 567 | "collapsed": false 568 | }, 569 | { 570 | "identifier": "PythonOCC.List_Node", 571 | "state data": "gAN9cQAu", 572 | "special actions": { 573 | "add input": { 574 | "method": "add_operand_input" 575 | }, 576 | "remove input 0": { 577 | "method": "remove_operand_input", 578 | "data": 0 579 | }, 580 | "remove input 1": { 581 | "method": "remove_operand_input", 582 | "data": 1 583 | } 584 | }, 585 | "display title": "List", 586 | "inputs": [ 587 | { 588 | "type": "data", 589 | "label": "", 590 | "dtype": "DType.Data", 591 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 592 | "has widget": true, 593 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 594 | }, 595 | { 596 | "type": "data", 597 | "label": "", 598 | "dtype": "DType.Data", 599 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 600 | "has widget": true, 601 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 602 | } 603 | ], 604 | "outputs": [ 605 | { 606 | "type": "data", 607 | "label": "" 608 | } 609 | ], 610 | "pos x": 1127.346090787474, 611 | "pos y": 280.63712667926774, 612 | "unconnected ports hidden": false, 613 | "collapsed": false 614 | }, 615 | { 616 | "identifier": "std.Divide_Node", 617 | "state data": "gAN9cQAu", 618 | "special actions": { 619 | "add input": { 620 | "method": "add_operand_input" 621 | }, 622 | "remove input 0": { 623 | "method": "remove_operand_input", 624 | "data": 0 625 | }, 626 | "remove input 1": { 627 | "method": "remove_operand_input", 628 | "data": 1 629 | } 630 | }, 631 | "display title": "/", 632 | "inputs": [ 633 | { 634 | "type": "data", 635 | "label": "", 636 | "dtype": "DType.Data", 637 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 638 | "has widget": true, 639 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 640 | }, 641 | { 642 | "type": "data", 643 | "label": "", 644 | "dtype": "DType.Data", 645 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 646 | "has widget": true, 647 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMnECcy4=" 648 | } 649 | ], 650 | "outputs": [ 651 | { 652 | "type": "data", 653 | "label": "" 654 | } 655 | ], 656 | "pos x": 621.0761551265902, 657 | "pos y": 697.9233061665942, 658 | "unconnected ports hidden": false, 659 | "collapsed": false 660 | }, 661 | { 662 | "identifier": "PythonOCC.Cylinder_Node", 663 | "state data": "gAN9cQAu", 664 | "special actions": { 665 | "add input": {}, 666 | "remove input 0": { 667 | "data": 0 668 | }, 669 | "remove input 1": { 670 | "data": 1 671 | }, 672 | "remove input 2": { 673 | "data": 2 674 | } 675 | }, 676 | "display title": "cylinder", 677 | "inputs": [ 678 | { 679 | "type": "data", 680 | "label": "", 681 | "dtype": "DType.Data", 682 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 683 | "has widget": true, 684 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9BeDInPnECcy4=" 685 | }, 686 | { 687 | "type": "data", 688 | "label": "", 689 | "dtype": "DType.Data", 690 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 691 | "has widget": true, 692 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgCAAAAMTBxAnMu" 693 | }, 694 | { 695 | "type": "data", 696 | "label": "", 697 | "dtype": "DType.Data", 698 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 699 | "has widget": true, 700 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgDAAAANS4wcQJzLg==" 701 | } 702 | ], 703 | "outputs": [ 704 | { 705 | "type": "data", 706 | "label": "" 707 | } 708 | ], 709 | "pos x": 1318.9994612931844, 710 | "pos y": 666.4285721338057, 711 | "unconnected ports hidden": false, 712 | "collapsed": false 713 | }, 714 | { 715 | "identifier": "PythonOCC.Ax2_Node", 716 | "state data": "gAN9cQAu", 717 | "special actions": { 718 | "add input": {}, 719 | "remove input 0": { 720 | "data": 0 721 | }, 722 | "remove input 1": { 723 | "data": 1 724 | } 725 | }, 726 | "display title": "Ax2", 727 | "inputs": [ 728 | { 729 | "type": "data", 730 | "label": "", 731 | "dtype": "DType.Data", 732 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 733 | "has widget": true, 734 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9QbnQnPnECcy4=" 735 | }, 736 | { 737 | "type": "data", 738 | "label": "", 739 | "dtype": "DType.Data", 740 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 741 | "has widget": true, 742 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9EaXInPnECcy4=" 743 | } 744 | ], 745 | "outputs": [ 746 | { 747 | "type": "data", 748 | "label": "" 749 | } 750 | ], 751 | "pos x": 1001.5325422426758, 752 | "pos y": 657.6100466046249, 753 | "unconnected ports hidden": false, 754 | "collapsed": false 755 | }, 756 | { 757 | "identifier": "PythonOCC.Pnt_Node", 758 | "state data": "gAN9cQAu", 759 | "special actions": { 760 | "add input": {}, 761 | "remove input 0": { 762 | "data": 0 763 | }, 764 | "remove input 1": { 765 | "data": 1 766 | }, 767 | "remove input 2": { 768 | "data": 2 769 | } 770 | }, 771 | "display title": "point", 772 | "inputs": [ 773 | { 774 | "type": "data", 775 | "label": "", 776 | "dtype": "DType.Data", 777 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 778 | "has widget": true, 779 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 780 | }, 781 | { 782 | "type": "data", 783 | "label": "", 784 | "dtype": "DType.Data", 785 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 786 | "has widget": true, 787 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAMTUuMHECcy4=" 788 | }, 789 | { 790 | "type": "data", 791 | "label": "", 792 | "dtype": "DType.Data", 793 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 794 | "has widget": true, 795 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 796 | } 797 | ], 798 | "outputs": [ 799 | { 800 | "type": "data", 801 | "label": "" 802 | } 803 | ], 804 | "pos x": 788.6281401810254, 805 | "pos y": 709.2614104183982, 806 | "unconnected ports hidden": false, 807 | "collapsed": false 808 | }, 809 | { 810 | "identifier": "PythonOCC.Fuse_Node", 811 | "state data": "gAN9cQAu", 812 | "special actions": { 813 | "add input": {}, 814 | "remove input 0": { 815 | "data": 0 816 | }, 817 | "remove input 1": { 818 | "data": 1 819 | } 820 | }, 821 | "display title": "fuse", 822 | "inputs": [ 823 | { 824 | "type": "data", 825 | "label": "", 826 | "dtype": "DType.Data", 827 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 828 | "has widget": true, 829 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgWAAAAPGNsYXNzICdUb3BvRFNfU29saWQnPnECcy4=" 830 | }, 831 | { 832 | "type": "data", 833 | "label": "", 834 | "dtype": "DType.Data", 835 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 836 | "has widget": true, 837 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgWAAAAPGNsYXNzICdUb3BvRFNfU29saWQnPnECcy4=" 838 | } 839 | ], 840 | "outputs": [ 841 | { 842 | "type": "data", 843 | "label": "" 844 | } 845 | ], 846 | "pos x": 1401.4982273193373, 847 | "pos y": 522.5309025761003, 848 | "unconnected ports hidden": false, 849 | "collapsed": false 850 | }, 851 | { 852 | "identifier": "PythonOCC.Fillet_Node", 853 | "state data": "gAN9cQAu", 854 | "special actions": { 855 | "add input": {}, 856 | "remove input 0": { 857 | "data": 0 858 | }, 859 | "remove input 1": { 860 | "data": 1 861 | } 862 | }, 863 | "display title": "fillet", 864 | "inputs": [ 865 | { 866 | "type": "data", 867 | "label": "", 868 | "dtype": "DType.Data", 869 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 870 | "has widget": true, 871 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 872 | }, 873 | { 874 | "type": "data", 875 | "label": "", 876 | "dtype": "DType.Data", 877 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 878 | "has widget": true, 879 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMXECcy4=" 880 | } 881 | ], 882 | "outputs": [ 883 | { 884 | "type": "data", 885 | "label": "" 886 | } 887 | ], 888 | "pos x": 1566.2694654870154, 889 | "pos y": 303.56268985326136, 890 | "unconnected ports hidden": false, 891 | "collapsed": false 892 | }, 893 | { 894 | "identifier": "PythonOCC.Cut_Node", 895 | "state data": "gAN9cQAu", 896 | "special actions": { 897 | "add input": {}, 898 | "remove input 0": { 899 | "data": 0 900 | }, 901 | "remove input 1": { 902 | "data": 1 903 | } 904 | }, 905 | "display title": "cut", 906 | "inputs": [ 907 | { 908 | "type": "data", 909 | "label": "", 910 | "dtype": "DType.Data", 911 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 912 | "has widget": true, 913 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 914 | }, 915 | { 916 | "type": "data", 917 | "label": "", 918 | "dtype": "DType.Data", 919 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 920 | "has widget": true, 921 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 922 | } 923 | ], 924 | "outputs": [ 925 | { 926 | "type": "data", 927 | "label": "" 928 | } 929 | ], 930 | "pos x": 913.53842345512, 931 | "pos y": 114.0141558134315, 932 | "unconnected ports hidden": false, 933 | "collapsed": false 934 | }, 935 | { 936 | "identifier": "PythonOCC.Trsf_Node", 937 | "state data": "gAN9cQAu", 938 | "special actions": { 939 | "add input": {}, 940 | "remove input 0": { 941 | "data": 0 942 | }, 943 | "remove input 1": { 944 | "data": 1 945 | } 946 | }, 947 | "display title": "Transform", 948 | "inputs": [ 949 | { 950 | "type": "data", 951 | "label": "", 952 | "dtype": "DType.Data", 953 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 954 | "has widget": true, 955 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 956 | }, 957 | { 958 | "type": "data", 959 | "label": "", 960 | "dtype": "DType.Data", 961 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 962 | "has widget": true, 963 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgQAAAAPGNsYXNzICdncF9WZWMnPnECcy4=" 964 | } 965 | ], 966 | "outputs": [ 967 | { 968 | "type": "data", 969 | "label": "" 970 | } 971 | ], 972 | "pos x": 1624.7017203413989, 973 | "pos y": 568.6456021194896, 974 | "unconnected ports hidden": false, 975 | "collapsed": false 976 | }, 977 | { 978 | "identifier": "PythonOCC.Vec_Node", 979 | "state data": "gAN9cQAu", 980 | "special actions": { 981 | "add input": {}, 982 | "remove input 0": { 983 | "data": 0 984 | }, 985 | "remove input 1": { 986 | "data": 1 987 | }, 988 | "remove input 2": { 989 | "data": 2 990 | } 991 | }, 992 | "display title": "Vector", 993 | "inputs": [ 994 | { 995 | "type": "data", 996 | "label": "", 997 | "dtype": "DType.Data", 998 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 999 | "has widget": true, 1000 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 1001 | }, 1002 | { 1003 | "type": "data", 1004 | "label": "", 1005 | "dtype": "DType.Data", 1006 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 1007 | "has widget": true, 1008 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgBAAAAMHECcy4=" 1009 | }, 1010 | { 1011 | "type": "data", 1012 | "label": "", 1013 | "dtype": "DType.Data", 1014 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 1015 | "has widget": true, 1016 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgFAAAAMjAuMDFxAnMu" 1017 | } 1018 | ], 1019 | "outputs": [ 1020 | { 1021 | "type": "data", 1022 | "label": "" 1023 | } 1024 | ], 1025 | "pos x": 1499.2861489466243, 1026 | "pos y": 796.6739137463526, 1027 | "unconnected ports hidden": false, 1028 | "collapsed": false 1029 | }, 1030 | { 1031 | "identifier": "std.Slider_Node", 1032 | "state data": "gAN9cQBYAwAAAHZhbHEBRz/lWBBiTdLycy4=", 1033 | "special actions": {}, 1034 | "display title": "slider", 1035 | "inputs": [ 1036 | { 1037 | "type": "data", 1038 | "label": "scl", 1039 | "val": "gANLHi4=", 1040 | "dtype": "DType.Integer", 1041 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFLAVgDAAAAZG9jcQJYAAAAAHEDWAYAAABib3VuZHNxBE51Lg==", 1042 | "has widget": true, 1043 | "widget data": "gAN9cQBYAwAAAHZhbHEBSx5zLg==" 1044 | }, 1045 | { 1046 | "type": "data", 1047 | "label": "round", 1048 | "val": "gANOLg==", 1049 | "dtype": "DType.Boolean", 1050 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQGJWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETnUu", 1051 | "has widget": true, 1052 | "widget data": "gAN9cQBYBwAAAGNoZWNrZWRxAYlzLg==" 1053 | } 1054 | ], 1055 | "outputs": [ 1056 | { 1057 | "type": "data", 1058 | "label": "" 1059 | } 1060 | ], 1061 | "pos x": 1024.7022253732155, 1062 | "pos y": 893.5859461877693, 1063 | "main widget data": "gAN9cQBYAwAAAHZhbHEBTZsCcy4=", 1064 | "unconnected ports hidden": false, 1065 | "collapsed": false 1066 | }, 1067 | { 1068 | "identifier": "PythonOCC.ExportStl_Node", 1069 | "state data": "gAN9cQAu", 1070 | "special actions": { 1071 | "add input": {}, 1072 | "remove input 0": { 1073 | "data": 0 1074 | }, 1075 | "remove input 1": { 1076 | "data": 1 1077 | } 1078 | }, 1079 | "display title": "ExportStl", 1080 | "inputs": [ 1081 | { 1082 | "type": "data", 1083 | "label": "", 1084 | "dtype": "DType.Data", 1085 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 1086 | "has widget": true, 1087 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgZAAAAPGNsYXNzICdUb3BvRFNfQ29tcG91bmQnPnECcy4=" 1088 | }, 1089 | { 1090 | "type": "data", 1091 | "label": "", 1092 | "dtype": "DType.Data", 1093 | "dtype state": "gAN9cQAoWAcAAABkZWZhdWx0cQFOWAMAAABkb2NxAlgAAAAAcQNYBgAAAGJvdW5kc3EETlgEAAAAc2l6ZXEFWAEAAABzcQZ1Lg==", 1094 | "has widget": true, 1095 | "widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAbW9sZHECcy4=" 1096 | } 1097 | ], 1098 | "outputs": [ 1099 | { 1100 | "type": "data", 1101 | "label": "" 1102 | } 1103 | ], 1104 | "pos x": 1274.1081912150971, 1105 | "pos y": 81.23508601706993, 1106 | "unconnected ports hidden": false, 1107 | "collapsed": false 1108 | }, 1109 | { 1110 | "identifier": "built_in.Val_Node", 1111 | "state data": "gAN9cQBYAwAAAHZhbHEBWAQAAABtb2xkcQJzLg==", 1112 | "special actions": { 1113 | "edit val via dialog": { 1114 | "method": "action_edit_via_dialog" 1115 | } 1116 | }, 1117 | "display title": "val", 1118 | "inputs": [], 1119 | "outputs": [ 1120 | { 1121 | "type": "data", 1122 | "label": "" 1123 | } 1124 | ], 1125 | "pos x": 1114.4883730762929, 1126 | "pos y": 183.8478262491583, 1127 | "main widget data": "gAN9cQBYBAAAAHRleHRxAVgEAAAAbW9sZHECcy4=", 1128 | "unconnected ports hidden": false, 1129 | "collapsed": false 1130 | } 1131 | ], 1132 | "connections": [ 1133 | { 1134 | "parent node index": 0, 1135 | "output port index": 0, 1136 | "connected node": 6, 1137 | "connected input port index": 0 1138 | }, 1139 | { 1140 | "parent node index": 0, 1141 | "output port index": 0, 1142 | "connected node": 6, 1143 | "connected input port index": 1 1144 | }, 1145 | { 1146 | "parent node index": 0, 1147 | "output port index": 0, 1148 | "connected node": 9, 1149 | "connected input port index": 0 1150 | }, 1151 | { 1152 | "parent node index": 1, 1153 | "output port index": 0, 1154 | "connected node": 6, 1155 | "connected input port index": 2 1156 | }, 1157 | { 1158 | "parent node index": 1, 1159 | "output port index": 0, 1160 | "connected node": 11, 1161 | "connected input port index": 0 1162 | }, 1163 | { 1164 | "parent node index": 1, 1165 | "output port index": 0, 1166 | "connected node": 17, 1167 | "connected input port index": 1 1168 | }, 1169 | { 1170 | "parent node index": 2, 1171 | "output port index": 0, 1172 | "connected node": 9, 1173 | "connected input port index": 1 1174 | }, 1175 | { 1176 | "parent node index": 2, 1177 | "output port index": 0, 1178 | "connected node": 11, 1179 | "connected input port index": 1 1180 | }, 1181 | { 1182 | "parent node index": 2, 1183 | "output port index": 0, 1184 | "connected node": 16, 1185 | "connected input port index": 1 1186 | }, 1187 | { 1188 | "parent node index": 3, 1189 | "output port index": 0, 1190 | "connected node": 8, 1191 | "connected input port index": 1 1192 | }, 1193 | { 1194 | "parent node index": 3, 1195 | "output port index": 0, 1196 | "connected node": 14, 1197 | "connected input port index": 2 1198 | }, 1199 | { 1200 | "parent node index": 3, 1201 | "output port index": 0, 1202 | "connected node": 21, 1203 | "connected input port index": 1 1204 | }, 1205 | { 1206 | "parent node index": 4, 1207 | "output port index": 0, 1208 | "connected node": 14, 1209 | "connected input port index": 0 1210 | }, 1211 | { 1212 | "parent node index": 4, 1213 | "output port index": 0, 1214 | "connected node": 14, 1215 | "connected input port index": 1 1216 | }, 1217 | { 1218 | "parent node index": 4, 1219 | "output port index": 0, 1220 | "connected node": 19, 1221 | "connected input port index": 2 1222 | }, 1223 | { 1224 | "parent node index": 4, 1225 | "output port index": 0, 1226 | "connected node": 24, 1227 | "connected input port index": 0 1228 | }, 1229 | { 1230 | "parent node index": 4, 1231 | "output port index": 0, 1232 | "connected node": 24, 1233 | "connected input port index": 1 1234 | }, 1235 | { 1236 | "parent node index": 6, 1237 | "output port index": 0, 1238 | "connected node": 8, 1239 | "connected input port index": 0 1240 | }, 1241 | { 1242 | "parent node index": 8, 1243 | "output port index": 0, 1244 | "connected node": 22, 1245 | "connected input port index": 0 1246 | }, 1247 | { 1248 | "parent node index": 9, 1249 | "output port index": 0, 1250 | "connected node": 13, 1251 | "connected input port index": 0 1252 | }, 1253 | { 1254 | "parent node index": 9, 1255 | "output port index": 0, 1256 | "connected node": 13, 1257 | "connected input port index": 1 1258 | }, 1259 | { 1260 | "parent node index": 9, 1261 | "output port index": 0, 1262 | "connected node": 10, 1263 | "connected input port index": 1 1264 | }, 1265 | { 1266 | "parent node index": 9, 1267 | "output port index": 0, 1268 | "connected node": 16, 1269 | "connected input port index": 0 1270 | }, 1271 | { 1272 | "parent node index": 9, 1273 | "output port index": 0, 1274 | "connected node": 19, 1275 | "connected input port index": 0 1276 | }, 1277 | { 1278 | "parent node index": 9, 1279 | "output port index": 0, 1280 | "connected node": 19, 1281 | "connected input port index": 1 1282 | }, 1283 | { 1284 | "parent node index": 10, 1285 | "output port index": 0, 1286 | "connected node": 20, 1287 | "connected input port index": 0 1288 | }, 1289 | { 1290 | "parent node index": 11, 1291 | "output port index": 0, 1292 | "connected node": 10, 1293 | "connected input port index": 2 1294 | }, 1295 | { 1296 | "parent node index": 11, 1297 | "output port index": 0, 1298 | "connected node": 13, 1299 | "connected input port index": 2 1300 | }, 1301 | { 1302 | "parent node index": 11, 1303 | "output port index": 0, 1304 | "connected node": 17, 1305 | "connected input port index": 2 1306 | }, 1307 | { 1308 | "parent node index": 12, 1309 | "output port index": 0, 1310 | "connected node": 10, 1311 | "connected input port index": 0 1312 | }, 1313 | { 1314 | "parent node index": 13, 1315 | "output port index": 0, 1316 | "connected node": 12, 1317 | "connected input port index": 0 1318 | }, 1319 | { 1320 | "parent node index": 14, 1321 | "output port index": 0, 1322 | "connected node": 12, 1323 | "connected input port index": 1 1324 | }, 1325 | { 1326 | "parent node index": 14, 1327 | "output port index": 0, 1328 | "connected node": 18, 1329 | "connected input port index": 1 1330 | }, 1331 | { 1332 | "parent node index": 15, 1333 | "output port index": 0, 1334 | "connected node": 7, 1335 | "connected input port index": 0 1336 | }, 1337 | { 1338 | "parent node index": 17, 1339 | "output port index": 0, 1340 | "connected node": 20, 1341 | "connected input port index": 1 1342 | }, 1343 | { 1344 | "parent node index": 18, 1345 | "output port index": 0, 1346 | "connected node": 17, 1347 | "connected input port index": 0 1348 | }, 1349 | { 1350 | "parent node index": 19, 1351 | "output port index": 0, 1352 | "connected node": 18, 1353 | "connected input port index": 0 1354 | }, 1355 | { 1356 | "parent node index": 20, 1357 | "output port index": 0, 1358 | "connected node": 21, 1359 | "connected input port index": 0 1360 | }, 1361 | { 1362 | "parent node index": 21, 1363 | "output port index": 0, 1364 | "connected node": 22, 1365 | "connected input port index": 1 1366 | }, 1367 | { 1368 | "parent node index": 21, 1369 | "output port index": 0, 1370 | "connected node": 23, 1371 | "connected input port index": 0 1372 | }, 1373 | { 1374 | "parent node index": 22, 1375 | "output port index": 0, 1376 | "connected node": 15, 1377 | "connected input port index": 0 1378 | }, 1379 | { 1380 | "parent node index": 22, 1381 | "output port index": 0, 1382 | "connected node": 26, 1383 | "connected input port index": 0 1384 | }, 1385 | { 1386 | "parent node index": 23, 1387 | "output port index": 0, 1388 | "connected node": 15, 1389 | "connected input port index": 1 1390 | }, 1391 | { 1392 | "parent node index": 24, 1393 | "output port index": 0, 1394 | "connected node": 23, 1395 | "connected input port index": 1 1396 | }, 1397 | { 1398 | "parent node index": 25, 1399 | "output port index": 0, 1400 | "connected node": 24, 1401 | "connected input port index": 2 1402 | }, 1403 | { 1404 | "parent node index": 27, 1405 | "output port index": 0, 1406 | "connected node": 26, 1407 | "connected input port index": 1 1408 | } 1409 | ] 1410 | }, 1411 | "flow view": { 1412 | "drawings": [], 1413 | "view size": [ 1414 | 6400.0, 1415 | 4800.0 1416 | ] 1417 | } 1418 | } 1419 | ] 1420 | } --------------------------------------------------------------------------------