Jump to content

Wire constraint network Question


lugnut

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

Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...