addpoint VEX function malfunction?

   2514   7   2
User Avatar
Member
40 posts
Joined: March 2018
Offline
Hello everyone,

I need to create a point in the center of the prims with @balcon=0 (the prims in the left-back)

I tried using addpoint but it ends up creating the center points only in the prims with @balcon=1(the prims in the rigth-front) Furthermore it creates twice the center point.

Also the geohandle parameter seems to have no inluence at all whatever value I set, so I am getting quite confuse.

Can somebody help me to understand what am I doing wrong?
How can I use the addpoint function to create the center points in the prims with @balcon=0?

Thanks in advance.
Edited by Dav_Rod - June 30, 2018 16:23:18

Attachments:
Davinia_addpoint.hiplc (261.9 KB)
duda.JPG (148.5 KB)

User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Remove the semicolon after
if(at_balconvecino == 0)
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
40 posts
Joined: March 2018
Offline
Ouchhh! yes that solved the dopple creation of the center points. But still dont understand whats going on with the addpoint().

Thanks a lot.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
That's because your addpoint is within a for loop, and those for loops depend on the size of the array.

The prims associated with @balcon = 0 never get looped because the array is empty, so addpoints never gets executed.

I could say more, perhaps I'm not being as clear…but I'm needing to leave my computer for a while.
User Avatar
Member
40 posts
Joined: March 2018
Offline
Thanks Babaj, I understand what you mean: The addpoint() is only executed on the prims that have @balcon = 1. and for that reasson only in that prims is created the center point. Now the question is: Is it possible to force the addpoint function to run on a different prim?

I mean:
In the documentation I can read:

“int addpoint(int geohandle, vector pos)
Creates a new point with the given position.”

For me it seems that “int geohandle” has no function at all. Whatever number I use, it doesnt affect the result

Is it possibly to use the “geohandle” to specify a prim on which to be run the addpoint?.
For example:
if(@balcon == 1){
        if(at_balconvecino == 0)
            {
            addpoint(some other primitive, @P);
            }
        
        }

How should be specified that “some other primitive”?


One last stuff I need to make sure that I understand: The prim wrangler doesnt run in a prim after another, rigth? It seems that it is executed on all prims at the same time, is it rigth?

Thanks everyone for the help and time.
Edited by Dav_Rod - June 30, 2018 18:27:28
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Is it possible to force the addpoint function to run on a different prim?

Yes, but you don't have to ‘force’…your running over prims already - each one is looked at; So depending on the condtions you want as to whether an addpoint is executed per prim - you code it that way.

And if the condition you want for a specific prim is met but your addpoint is the position of another prim, just use the return of the primattrib function that has “P” for its attribute_name argument.

From your file it looks like your trying to check two conditions before you execute so you could do something like:

vector AddPos;
int Success;

if( (Condtion_A == This) && (Condition_B == That) )
{
AddPos = primattrib(geoself(), “P”, primnum, Success);
addpoint(geoself(), AddPos);
}

geohandle is not for assigning the addpoint to anything like a primitive or such.

At the moment, since I've not seen it used by anyone, it might just be that the function was created in a way that if in the future if the functionality of using handles was introduced, the function will have already been set up to take advantage of it.

In the future you might be able to get the ‘handle’ of a geometry file, which would be the int number. Then the function would add a point to that file instead of the scene; basically acting like a pointer.

The prim wrangler doesnt run in a prim after another, rigth? It seems that it is executed on all prims at the same time, is it rigth?

I don't know for sure, but I think I remember reading a thread where it was stated, at the moment wrangles will look at 6 at a time.
Edited by BabaJ - July 1, 2018 00:31:09
User Avatar
Member
40 posts
Joined: March 2018
Offline
That helped me a lot!!

Thanks a lot BabaJ for the extense answer and such a clear explanation.

A few people like you should be payed by Sidefx to keep oiling in this forum the hard inerta engine that it suposses getting in touch with Houdini.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Thank you for your appreciation….

It's payback (my answering others questions) for all the feedback I've received here, and still continue to benefit from.

There's a number of things I have learned through various tutorials/website articles that have been vary informative for me.

But it's this forum and the posters here who if had not provided the feedback they did, would have left me ‘stuck’ for a long time on certain aspects of Houdini that otherwise would have taken me much longer to figure out.
  • Quick Links