Jump to content
lugnut

Wire constraint network Question

Recommended Posts

Hi all-

Building a procedural constraint network for wires by connecting the interior points in a grid. It works fine for some grid dimensions, but not others, where the sim blows up. shown below a 5x5 and a 6x6 grid.

A 15x15 grid will work fine, but a 6x6 one won't. Curious!

I'm building zero-length constraints from the interior points and setting the anchor points as follows:

int wirepts[] = nearpoints(1,@P,.0001);

foreach (int wpt; wirepts) {
    if(wpt != wirepts[0]) {
        int pt1 = addpoint(0,v@P);
        int pt2 = addpoint(0,v@P);
        setpointattrib(0,"anchor_id",pt1,wirepts[0]);
        setpointattrib(0,"anchor_id",pt2,wpt);    
        int newprim = addprim(0,"polyline",pt1,pt2);
        setprimattrib(0,"constraint_name",newprim, "WireGlue");
        setprimattrib(0,"constraint_type",newprim, "position");
    }
}
setpointgroup(0,"delete",@ptnum,1,"set");

I delete the original points later - I'm not using the first of the nearpoints to avoid a prim with the same anchor points, I thought that might be  the problem, but it didn't seem to matter. Does anybody know the reason why this happens? Am I missing something?

Thanks -  I'm including a sample file.

 

wiregrid1.png

wiregrid2.png

wireGridConstraints.hiplc

Share this post


Link to post
Share on other sites

it's your time dependent nodes, ie. the transform

because you transform, then do attribtransfer...I think this is causing things to go awry, so I disabled your transform and moved it to AFTER the transfer

(quickest way to pinpoint the culprit is in your orig file, simply disable the transform, it works straightaway, just without the movement)

wireGridConstraints_fix.hipnc

Edited by Noobini

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×