sadhu Posted June 29, 2013 Share Posted June 29, 2013 Hi, Noob question I am creating a float attrib "chk" and its value is random(ptnum) I want to crate new attrib , "a" and I want its value to be equal to value of chk attrib for point number 15 f@chk = random(ptnum);f@a = point(".","chk",15);printf("%f",@a);[/CODE]I am not getting the desired result. Can someone help me point out my mistake?Thanks a lot for you time.: ) Quote Link to comment Share on other sites More sharing options...
magneto Posted June 29, 2013 Share Posted June 29, 2013 I don't think you can access the value of that attribute because it's not created yet, let alone for point 15. You need to use 2 point wrangle sops, or create the attribute with another sop beforehand. But if that's all you need, you could calculate the value of the attribute for point15 in your code. Quote Link to comment Share on other sites More sharing options...
sadhu Posted June 29, 2013 Author Share Posted June 29, 2013 (edited) Hi Magneto. I tried that. I am creating "chk" attrib using attribcreate node. but still i could not bring its value for a specific point by point expression. f@chk = random(ptnum);f@a = point("/obj/grid_object1/attribcreate1","chk",15);printf("%f",@a);[/CODE]I am learning vex. I was doing for and while loop. What I want to do actually is find out the min and max value of "chk" through these loops. So i was using loop iteration value as point number in point expression but it is not working in pointwrangler sop. Edited June 29, 2013 by sadhu 1 Quote Link to comment Share on other sites More sharing options...
bloomendale Posted June 29, 2013 Share Posted June 29, 2013 1) i think you need to use op: fullpath in point vex func 2) you can use import func instead to avoid all these op: and yes, magneto is right - try using 2 nodes. 1 Quote Link to comment Share on other sites More sharing options...
sadhu Posted June 29, 2013 Author Share Posted June 29, 2013 Hi bloomendale, Thanks for you reply, yes with op: it started working. f@a = point("op:/obj/grid_object1/attribcreate1","chk",15); Can you tell me how to use import vex function? int import(string attrib_name, type result&; int input; int pt_num) What is type result& import("chk", float; 0 ; 15); 1 Quote Link to comment Share on other sites More sharing options...
bloomendale Posted June 29, 2013 Share Posted June 29, 2013 (edited) you can use something like int res; res = import ("chk", f@a, 0, 15); in point wrangle sop. or just import("chk", f@a, 0, 15); if you don't need the result of import func (success or fail) Edited June 29, 2013 by bloomendale Quote Link to comment Share on other sites More sharing options...
sadhu Posted June 29, 2013 Author Share Posted June 29, 2013 Yes it is working. I have one more question. How come it is working with comma ? It expects semicolon after type result& and int input int import(string attrib_name, type result&; int input) int import(string attrib_name, type result&; int input; int pt_num) int import(string attrib_name; float values[] &; int input; int pt_num) Quote Link to comment Share on other sites More sharing options...
bloomendale Posted June 29, 2013 Share Posted June 29, 2013 imo it's bad formatting in manual. use "," instead. afaik ";" is end of token in vex Quote Link to comment Share on other sites More sharing options...
sadhu Posted June 29, 2013 Author Share Posted June 29, 2013 Thanks bloomendale. 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.