deleting specific nodes in node object


    Nov 26 2012 | 6:19 pm
    Hi all, is there a simple way to do that?
    The only attribute I know for manipulating nodes creation / destruction is... @nodenumber, but of course it adds or deletes point starting from the last index... what if I needed to delete node number 2 in a 10 nodes environment? The only thing I can think right now is to use the coll object for manipulating node creation / destruction and to synchronize it with the [node] object...but I hope there's a simplier solution. Or: I'm not into JS stuff, but maybe some js code may communicate with [node]...and tell him "delete node number 2, reorder"...hmm...
    Any suggestion?
    Thank you!
    PS: first post here, I have to celebrate!

    • Nov 26 2012 | 9:31 pm
      +1, I'm sorry I have not a solution for this, but would love to see an answer too for my patch!
    • Nov 26 2012 | 11:53 pm
      How about setting the active state of the node 2 to 0? It doesn't delete the node per see but it deactivates it. Otherwise you'll have to store everything, change the number of nodes, and restores the nodes you want.
    • Nov 27 2012 | 1:17 am
      Thank you Emmanuel,
      I'm already using the active state feature, so I'm forced to use the store/delete/dump trick. As soon I find a shareable solution i'll share it!
      Thank you again.
    • Nov 27 2012 | 2:08 am
      Ok that works but I imagine there could be better solutions.
      {
      	"patcher" : 	{
      		"fileversion" : 1,
      		"appversion" : 		{
      			"major" : 6,
      			"minor" : 0,
      			"revision" : 4
      		}
      ,
      		"rect" : [ 248.0, 44.0, 943.0, 555.0 ],
      		"bglocked" : 0,
      		"openinpresentation" : 0,
      		"default_fontsize" : 10.0,
      		"default_fontface" : 0,
      		"default_fontname" : "Arial",
      		"gridonopen" : 0,
      		"gridsize" : [ 15.0, 15.0 ],
      		"gridsnaponopen" : 0,
      		"statusbarvisible" : 2,
      		"toolbarvisible" : 1,
      		"boxanimatetime" : 200,
      		"imprint" : 0,
      		"enablehscroll" : 1,
      		"enablevscroll" : 1,
      		"devicewidth" : 0.0,
      		"description" : "",
      		"digest" : "",
      		"tags" : "",
      		"boxes" : [ 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-100",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 257.0, 32.0, 62.0, 18.0 ],
      					"text" : "loadmess 3"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-99",
      					"linecount" : 3,
      					"maxclass" : "comment",
      					"numinlets" : 1,
      					"numoutlets" : 0,
      					"patching_rect" : [ 66.0, 31.0, 156.0, 41.0 ],
      					"text" : "after changing nodenumber you have to move something to refresh coll"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-97",
      					"linecount" : 7,
      					"maxclass" : "comment",
      					"numinlets" : 1,
      					"numoutlets" : 0,
      					"patching_rect" : [ 560.0, 130.5, 164.0, 87.0 ],
      					"text" : "1) close gate outputn2) delete node from colln3) store new coll lenght in the i objn4) dump coll values and refresh node objectn5) set nodenumber to coll lenghtn6) reopen node object output"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-95",
      					"linecount" : 3,
      					"maxclass" : "comment",
      					"numinlets" : 1,
      					"numoutlets" : 0,
      					"patching_rect" : [ 226.0, 424.0, 166.0, 41.0 ],
      					"text" : "< i had to put this because "setnode" dumps nodes-values out and messes with coll"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-93",
      					"maxclass" : "comment",
      					"numinlets" : 1,
      					"numoutlets" : 0,
      					"patching_rect" : [ 256.0, 62.0, 159.0, 18.0 ],
      					"text" : "1) Choose the node to be deleted"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-91",
      					"maxclass" : "comment",
      					"numinlets" : 1,
      					"numoutlets" : 0,
      					"patching_rect" : [ 433.0, 91.0, 60.0, 18.0 ],
      					"text" : "2) delete it"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-84",
      					"maxclass" : "message",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 460.0, 245.0, 52.0, 16.0 ],
      					"text" : "delete $1"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-78",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 460.0, 217.5, 87.0, 18.0 ],
      					"presentation_rect" : [ 465.0, 158.0, 0.0, 0.0 ],
      					"text" : "v node_to_delete"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-75",
      					"maxclass" : "number",
      					"numinlets" : 1,
      					"numoutlets" : 2,
      					"outlettype" : [ "int", "bang" ],
      					"parameter_enable" : 0,
      					"patching_rect" : [ 319.0, 91.0, 50.0, 18.0 ]
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-73",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 319.0, 139.0, 87.0, 18.0 ],
      					"text" : "v node_to_delete"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-72",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "bang" ],
      					"patching_rect" : [ 588.0, 247.5, 52.0, 18.0 ],
      					"text" : "loadbang"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-53",
      					"maxclass" : "newobj",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 153.0, 424.0, 38.0, 18.0 ],
      					"text" : "gate 1"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-46",
      					"maxclass" : "newobj",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "int" ],
      					"patching_rect" : [ 346.25, 253.0, 32.5, 18.0 ],
      					"text" : "i"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-41",
      					"maxclass" : "message",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 433.0, 361.0, 102.0, 16.0 ],
      					"text" : "setnode $1 $2 $3 $4"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"id" : "obj-38",
      					"maxclass" : "button",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "bang" ],
      					"outlinecolor" : [ 1.0, 0.0, 0.0, 1.0 ],
      					"patching_rect" : [ 406.0, 91.0, 20.0, 20.0 ]
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-36",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 6,
      					"outlettype" : [ "int", "bang", "dump", "bang", "bang", "int" ],
      					"patching_rect" : [ 406.0, 139.0, 86.5, 18.0 ],
      					"text" : "t 1 b dump b b 0"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-33",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 2,
      					"outlettype" : [ "", "" ],
      					"patching_rect" : [ 359.75, 217.5, 32.5, 18.0 ],
      					"text" : "grab"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-32",
      					"maxclass" : "message",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 359.75, 189.0, 38.0, 16.0 ],
      					"text" : "length"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-30",
      					"maxclass" : "message",
      					"numinlets" : 2,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 588.0, 269.5, 59.0, 16.0 ],
      					"text" : "refer prova"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"cols" : 5,
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-28",
      					"maxclass" : "jit.cellblock",
      					"numinlets" : 2,
      					"numoutlets" : 4,
      					"outlettype" : [ "list", "", "", "" ],
      					"patching_rect" : [ 588.0, 314.5, 322.0, 109.0 ],
      					"rows" : 3
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"attr" : "nodenumber",
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-22",
      					"maxclass" : "attrui",
      					"numinlets" : 1,
      					"numoutlets" : 1,
      					"outlettype" : [ "" ],
      					"patching_rect" : [ 66.0, 83.0, 150.0, 18.0 ]
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-20",
      					"maxclass" : "newobj",
      					"numinlets" : 2,
      					"numoutlets" : 2,
      					"outlettype" : [ "", "" ],
      					"patching_rect" : [ 172.0, 373.0, 58.0, 18.0 ],
      					"text" : "route node"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-17",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 4,
      					"outlettype" : [ "", "", "", "" ],
      					"patching_rect" : [ 153.0, 465.0, 62.0, 18.0 ],
      					"saved_object_attributes" : 					{
      						"embed" : 0
      					}
      ,
      					"text" : "coll prova 1"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"id" : "obj-16",
      					"maxclass" : "nodes",
      					"nodenumber" : 3,
      					"nsize" : [ 0.2, 0.2, 0.2 ],
      					"numinlets" : 1,
      					"numoutlets" : 3,
      					"outlettype" : [ "", "", "" ],
      					"parameter_enable" : 0,
      					"patching_rect" : [ 66.0, 121.0, 231.0, 231.0 ],
      					"xplace" : [ 0.683983, 0.251082, 0.329004 ],
      					"yplace" : [ 0.649351, 0.558442, 0.25974 ]
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-15",
      					"maxclass" : "newobj",
      					"numinlets" : 2,
      					"numoutlets" : 2,
      					"outlettype" : [ "", "" ],
      					"patching_rect" : [ 433.0, 333.0, 45.0, 18.0 ],
      					"text" : "zl rot 1"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-14",
      					"maxclass" : "newobj",
      					"numinlets" : 2,
      					"numoutlets" : 2,
      					"outlettype" : [ "", "" ],
      					"patching_rect" : [ 433.0, 306.0, 45.0, 18.0 ],
      					"text" : "zl join"
      				}
      
      			}
      , 			{
      				"box" : 				{
      					"fontname" : "Arial",
      					"fontsize" : 10.0,
      					"id" : "obj-1",
      					"maxclass" : "newobj",
      					"numinlets" : 1,
      					"numoutlets" : 4,
      					"outlettype" : [ "", "", "", "" ],
      					"patching_rect" : [ 433.0, 278.0, 62.0, 18.0 ],
      					"saved_object_attributes" : 					{
      						"embed" : 0
      					}
      ,
      					"text" : "coll prova 1"
      				}
      
      			}
       ],
      		"lines" : [ 			{
      				"patchline" : 				{
      					"destination" : [ "obj-14", 1 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-1", 1 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-14", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-1", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-22", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-100", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-15", 1 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-14", 1 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-15", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-14", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-41", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-15", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-20", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-16", 1 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-53", 1 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-20", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-16", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-22", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-28", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-30", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-33", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-32", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-1", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"midpoints" : [ 382.75, 246.25, 442.5, 246.25 ],
      					"source" : [ "obj-33", 1 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-46", 1 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-33", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-1", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-36", 2 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-32", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"midpoints" : [ 456.0, 178.5, 369.25, 178.5 ],
      					"source" : [ "obj-36", 3 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-46", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"midpoints" : [ 429.0, 164.5, 355.75, 164.5 ],
      					"source" : [ "obj-36", 1 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-53", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"midpoints" : [ 483.0, 405.0, 162.5, 405.0 ],
      					"source" : [ "obj-36", 5 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-53", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"midpoints" : [ 415.5, 411.0, 162.5, 411.0 ],
      					"source" : [ "obj-36", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-78", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-36", 4 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-36", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-38", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-16", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-41", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-22", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-46", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-17", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-53", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-30", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-72", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-73", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-75", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-84", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-78", 0 ]
      				}
      
      			}
      , 			{
      				"patchline" : 				{
      					"destination" : [ "obj-1", 0 ],
      					"disabled" : 0,
      					"hidden" : 0,
      					"source" : [ "obj-84", 0 ]
      				}
      
      			}
       ],
      		"dependency_cache" : [  ]
      	}
      
      }