Custom Unit Cell Bug in IntraLattice Plug-In - Grasshopper2024-03-28T20:05:53Zhttps://www.grasshopper3d.com/forum/topics/custom-unit-cell-bug-in-intralattice-plug-in?commentId=2985220%3AComment%3A1828939&feed=yes&xn_auth=noNice! ZBrush is also my go to…tag:www.grasshopper3d.com,2017-10-12:2985220:Comment:18304392017-10-12T14:33:28.623ZMichael Pryorhttps://www.grasshopper3d.com/profile/MikePryor
<p>Nice! ZBrush is also my go to when Booling meshes. It just always works :D</p>
<p>Nice! ZBrush is also my go to when Booling meshes. It just always works :D</p> Springs in a unit celll are a…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18299802017-10-11T23:32:05.913ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>Springs in a unit celll are an extreme example of hubs being formed from impossibly overlapping mesh geometry, via ZBrush Remesh:…<a href="http://storage.ning.com/topology/rest/1.0/file/get/2769329952?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769329952?profile=original" width="655"></img></a> <a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330043?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330043?profile=RESIZE_1024x1024" width="721"></img></a> <a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331054?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769331054?profile=RESIZE_1024x1024" width="721"></img></a></p>
<p>Springs in a unit celll are an extreme example of hubs being formed from impossibly overlapping mesh geometry, via ZBrush Remesh:<a href="http://storage.ning.com/topology/rest/1.0/file/get/2769329952?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769329952?profile=original" width="655" class="align-full"/></a><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330043?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330043?profile=RESIZE_1024x1024" width="721" class="align-full"/></a><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331054?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769331054?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p> The ZBrush strategy, now that…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18302322017-10-11T22:23:12.910ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>The ZBrush strategy, now that ZBrush has a sort of hard core, very fast, marching cubes routine, becomes a new quest for automation, since ZBrush has ZScript and can be launched from the command line (and thus Python) with a selected script as an argument. It uses OBJ files, which are ASCII so I can write them easily with Python. Usually you then have to invoke a button though, but I think an 'if' statement that is always true will also do.</p>
<p></p>
<p>The ZBrush rapid remeshing is a form…</p>
<p>The ZBrush strategy, now that ZBrush has a sort of hard core, very fast, marching cubes routine, becomes a new quest for automation, since ZBrush has ZScript and can be launched from the command line (and thus Python) with a selected script as an argument. It uses OBJ files, which are ASCII so I can write them easily with Python. Usually you then have to invoke a button though, but I think an 'if' statement that is always true will also do.</p>
<p></p>
<p>The ZBrush rapid remeshing is a form of Boolean union that Rhino will simply not do, let alone fast. But also, crucially, now that I'm playing with IntraLattice custom unit cells, I realize that some interesting curved wire cells not only won't work for existing IntraLattice, but won't work in principle because they smoothly merge into hubs via fattened strut *overlap*.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769329999?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769329999?profile=original" width="654" class="align-full"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330254?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330254?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p>
<p></p>
<p>ZBrush in few seconds:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330276?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330276?profile=RESIZE_1024x1024" width="721" class="align-full"/></a>You cannot find this performance in open source code out there, code that works, that you can make easy for a client or a coworker to install in a few minutes. This quality of code is in programs and is often a trade secret, let alone possibly patented instead of open source.</p>
<p></p> Updated script that converts…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18301252017-10-11T21:41:09.244ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p><span>Updated script that converts curves in the unit cell to polylines.</span></p>
<p><span>Updated script that converts curves in the unit cell to polylines.</span></p> ...so what's needed is a ZBru…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18289392017-10-11T07:58:36.233ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>...so what's needed is a ZBrush remote control from Grasshopper. ZBrush has a ZScript language but is a very odd program so that would require lots of kludges if it will work at all. It's also expensive for clients, as an addition to any script I make them.</p>
<p></p>
<p>Though Mesh Pipes works fine for that strategy, seen here, IntraLattice is still twice as fast.…</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330402?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330402?profile=RESIZE_1024x1024" width="721"></img></a></p>
<p>...so what's needed is a ZBrush remote control from Grasshopper. ZBrush has a ZScript language but is a very odd program so that would require lots of kludges if it will work at all. It's also expensive for clients, as an addition to any script I make them.</p>
<p></p>
<p>Though Mesh Pipes works fine for that strategy, seen here, IntraLattice is still twice as fast.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330402?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330402?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p> In fact ZBrush 4R8P2 can reme…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18288372017-10-11T07:33:15.413ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>In fact ZBrush 4R8P2 can remesh it while adding great smoothing body, akin to a marching cubes result:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330432?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330432?profile=original" width="718"></img></a></p>
<p>That was from the Subtool palette:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330566?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769330566?profile=original" width="217"></img></a> Oh, wow, they have vastly improved their old Unified Skin command that couldn't do super-fine…</p>
<p>In fact ZBrush 4R8P2 can remesh it while adding great smoothing body, akin to a marching cubes result:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330432?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769330432?profile=original" width="718" class="align-full"/></a></p>
<p>That was from the Subtool palette:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769330566?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769330566?profile=original" width="217" class="align-full"/></a>Oh, wow, they have vastly improved their old Unified Skin command that couldn't do super-fine resolution, and added smoothing to it. If I turn off Polish, the voxels appear:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331906?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769331906?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p> A twisty unit cell, anybody?…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18286092017-10-11T07:03:56.588ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>A twisty unit cell, anybody? Alas, IntraLattice Homogen is now failing for the entire array even though over half of it at a time will work fine, with perfect hubs. I can't isolate anything, it's just larger collections that are poison. So I had to graft the input to IntraLattice, to force it to not make any hubs, just struts.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331799?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769331799?profile=original" width="716"></img></a></p>
<p>ZBrush is happy to Boolean this…</p>
<p>A twisty unit cell, anybody? Alas, IntraLattice Homogen is now failing for the entire array even though over half of it at a time will work fine, with perfect hubs. I can't isolate anything, it's just larger collections that are poison. So I had to graft the input to IntraLattice, to force it to not make any hubs, just struts.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331799?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769331799?profile=original" width="716" class="align-full"/></a></p>
<p>ZBrush is happy to Boolean this though, where Rhino and Rhino 6 WIP fail.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769332560?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769333671?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p>
<p>Here is a raw test script with the arrayed curves (which were converted to polylines to get IntraLattice to work at all) running into IntraLattice.</p> To not be such a perfectionis…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18286072017-10-11T05:56:58.322ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p><span>To not be such a perfectionist, I just wrapped the offending line in a try statement and it now works on large bodies, albeit after ~7 minutes, only failing to find a curve pair to join a single time:</span></p>
<p><span><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769332264?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769332264?profile=original" width="719" class="align-full"/></a></span></p>
<p><span>To not be such a perfectionist, I just wrapped the offending line in a try statement and it now works on large bodies, albeit after ~7 minutes, only failing to find a curve pair to join a single time:</span></p>
<p><span><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769332264?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769332264?profile=original" width="719" class="align-full"/></a></span></p> Sadly, if I ramp up the size…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18288132017-10-11T05:04:32.471ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>Sadly, if I ramp up the size of the mesh balloon to even just three times bigger, I get a final Python script, the one that joins line pairs, error, which occurs immediately when I try to test the script, not after any churning:</p>
<p></p>
<p>Runtime error (IndexOutOfRangeException): index out of range: 0</p>
<p>Traceback:<br></br>line 13, in script</p>
<p></p>
<p>Before that step, the curve array forms fine in Grasshopper, all 13K of them. It does churn extremely slowly away if I comment out…</p>
<p>Sadly, if I ramp up the size of the mesh balloon to even just three times bigger, I get a final Python script, the one that joins line pairs, error, which occurs immediately when I try to test the script, not after any churning:</p>
<p></p>
<p>Runtime error (IndexOutOfRangeException): index out of range: 0</p>
<p>Traceback:<br/>line 13, in script</p>
<p></p>
<p>Before that step, the curve array forms fine in Grasshopper, all 13K of them. It does churn extremely slowly away if I comment out line 13, and I can have it print the CURVES_CONTAINER size to see it grab two curves at a time out of it:</p>
<p></p>
<p>CURVES_CONTAINER.Add(Rhino.Geometry.Curve.JoinCurves(pair)[0])</p>
<p></p>
<p>Ah, it's the [0] part which I use since Rhinocommon so often spits out a list of outputs instead of just giving me my geometry.</p>
<p></p>
<p>I get the same error with just:</p>
<p></p>
<p>print Rhino.Geometry.Curve.JoinCurves(pair)[0]</p>
<p></p>
<p>Taking off the [0] which grabs the first item says the pair is empty:</p>
<p></p>
<p>Array[Curve](())</p>
<p></p>
<p>Switching back to a smaller balloon mesh, I see the healthy output:</p>
<p></p>
<p>Array[Curve]((<Rhino.Geometry.PolyCurve object at 0x00000000000000E3 [Rhino.Geometry.PolyCurve]>))</p>
<p></p>
<p>...and after adding [0] back, it prints:</p>
<p></p>
<p><Rhino.Geometry.PolyCurve object at 0x0000000000000253 [Rhino.Geometry.PolyCurve]></p>
<p></p>
<p>Ah, it's because my little point comparison loop is getting no hits, no matches of points to endpoints. It may just be a tolerance thing on a bigger scale. The endpoints are returning with 14 decimal places.</p>
<p></p>
<p>...yet if I try to test for distance being less than 0.001 instead point equality, same thing happens.</p>
<p></p>
<p>Do I need an RTree?</p> ...indeed, if I remove my int…tag:www.grasshopper3d.com,2017-10-11:2985220:Comment:18285842017-10-11T03:34:19.357ZNik Willmorehttps://www.grasshopper3d.com/profile/NikFromNYC
<p>...indeed, if I remove my intermediary Grasshopper line nodes from between the clusters, and I use Rhino to convert a unit cell curve into a polyline, it works fine:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331571?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2769331571?profile=original" width="636"></img></a></p>
<p>It's not desirable how oddly it gives a more crude mesh of anti-prisms where my polyline has less curvature. That means I can't smooth via single subdivision to an even mesh unless I remesh the…</p>
<p>...indeed, if I remove my intermediary Grasshopper line nodes from between the clusters, and I use Rhino to convert a unit cell curve into a polyline, it works fine:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769331571?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769331571?profile=original" width="636" class="align-full"/></a></p>
<p>It's not desirable how oddly it gives a more crude mesh of anti-prisms where my polyline has less curvature. That means I can't smooth via single subdivision to an even mesh unless I remesh the whole thing.</p>
<p></p>