sessionbeer Posted September 18, 2015 Share Posted September 18, 2015 Can some please help me with importing an array? I'm struggling with the documentation and searching the web. I would like to import the previously created @near_array into a wrangle node. Thanks import_array_vex.hip Quote Link to comment Share on other sites More sharing options...
Atom Posted September 18, 2015 Share Posted September 18, 2015 (edited) There are some problems in your build_array. Here is code as I would correct it to remove syntax and type casting errors. float @near_array[]; float search_rad = ch("max_rad"); int max_points = int(ch("max_points")); int success; // Used as a flag to determine if the function returned a valid value. int handle = pcopen(1, "P", @P, search_rad, max_points); int i = 0; while( pciterate(handle) ) { float result = pcimport(handle, "point.number", success); if (success) { @near_array[i] = result; i += 1; } } Once you have created the attribute it will exist downstream in the network (middle click on node to check). There is nothing special to do to import it. Simply reference the attribute in another wrangle downstream. printf("%s\n",@near_array); Edited September 18, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
anim Posted September 18, 2015 Share Posted September 18, 2015 (edited) you should refer to it as: i[]@near_array so for accessing existing one from first input you will use: printf("%s\n",i[]@near_array); to create one that just contains point numbers as in your file, you can use pcfind() function directly float search_rad = chf("max_rad"); int max_points = chi("max_points"); i[]@near_array = pcfind(1, "P", @P, search_rad, max_points); Edited September 18, 2015 by anim Quote Link to comment Share on other sites More sharing options...
sessionbeer Posted September 22, 2015 Author Share Posted September 22, 2015 Thanks Tomas and Atom! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.