Hi All,
Just a quick one, is it possible to publish the geometry cache function to the remote control panel, would be very useful when having to update a lot, or have it set to an auto update when a command in rhino is executed etc.
Cheers,
Brad
Hi All,
Just a quick one, is it possible to publish the geometry cache function to the remote control panel, would be very useful when having to update a lot, or have it set to an auto update when a command in rhino is executed etc.
Cheers,
Brad
private void RunScript(string nickName, bool point, bool curve, bool brep, bool mesh, string Layer, string Name)
{
var typeFilter = 0;
if (point) typeFilter += 1;
if (curve) typeFilter += 4;
if (brep) typeFilter += 16;
if (mesh) typeFilter += 32;
foreach (IGH_DocumentObject obj in GrasshopperDocument.Objects)
{
if(obj is GH_GeometryPipeline && obj.NickName == nickName)
{
var pipeline = obj as GH_GeometryPipeline;
pipeline.TypeFilter = (Rhino.DocObjects.ObjectType) typeFilter;
pipeline.LayerFilter = Layer;
pipeline.NameFilter = Name;
}
}
}
pipeline.gh (7.9 KB)
Amazing, do yo know the process for the geometry cache function as well? This’ll definitely be useful for the pipeline function. screenshotted the one I mean below.
My GH scripting knowledge is basic at best, I know python from other projects but not had a go at it in grasshopper yet, looks like a fun rabbit hole to dive down for the next project
private void RunScript(string nickName, bool update)
{
if (!update) return;
foreach (var obj in GrasshopperDocument.Objects)
{
if(obj is GH_GeometryCache && obj.NickName == nickName)
{
var cache = obj as GH_GeometryCache;
if (cache.SourceCount > 0)
cache.WriteGeometryCache();
else
{
cache.ReadGeometryCache();
cache.ExpireSolution(true);
}
}
}
}
geometryCache.gh (6.9 KB)
That’s exactly what I was wanting to do, thanks!
So this successfully bakes the changes before the cache command, the way I’m using geometry cache is the user would change something in rhino, and click the green “Load Geometry arrow” to quickly update the definition down the line. Is there a way to have both the Bake & Load command pulled through to the Remote control panel.
Appreciate the help, out of interest do you have a recourse you use to find the correct syntax and naming’s for things, I had a look on the rhino api site and couldn’t find anything specific, could just be I’m hunting in the wrong place
private void RunScript(string nickName, bool bake, bool load)
{
if (!(bake || load)) return;
foreach (var obj in GrasshopperDocument.Objects)
{
if(obj is GH_GeometryCache && obj.NickName == nickName)
{
var cache = obj as GH_GeometryCache;
if (bake && cache.SourceCount > 0)
cache.WriteGeometryCache();
else if(load)
{
cache.ReadGeometryCache();
cache.ExpireSolution(true);
}
}
}
}
geometryCache.gh (6.9 KB)