[Bug] Blocks created through scripting disappear intermittently


(Andrew Heumann) #1

When I add a new instance definition to the document instance definition table, and then create an instance of that block, it only appears in the rhino viewport intermittently - I can select it but can only see it sometimes. Zooming around it will occasionally reveal it. However, if I select it and run the “BlockEdit” command and then click OK, it seems to resolve the issue.
disappearingBlock.3dm(1.1 MB)

My code, in a GH C# script, to define the block, looks like this:

private void RunScript(bool activate, List<GeometryBase> geom, string name, Point3d basePt, List<object> atts, ref object A)
{
  if(activate){
    List<Rhino.DocObjects.ObjectAttributes> attsList = new List<Rhino.DocObjects.ObjectAttributes>();
    foreach(object o in atts){
      attsList.Add(o as Rhino.DocObjects.ObjectAttributes);
    }
    if (RhinoDocument.InstanceDefinitions.Find(name.Trim(), true) == null){
      RhinoDocument.InstanceDefinitions.Add(name, "", basePt, geom, attsList);
    } else {
      Print("A block by that name already exists");
    }
  }
  A = name;
}

(Andrew Heumann) #2

Bumping this - Can others reproduce? Any thoughts on what’s wrong?


(Steve Baer) #3

Do you have a sample GH component that reproduces this?


Block instance copy issue
(Andrew Heumann) #4

Here is a definition that reproduces the problem. It requires the Human GHA, also attached. To reproduce, enable the toggle highlighted in red, and then set it back to false. Then, in rhino, use the insert command to insert one of the generated blocks. on my machine, zooming in and out causes these blocks to sporadically disappear from the viewport.
Make Tiles_trblsht.gh(47.6 KB)
Human.gha(204.5 KB)


(Andrew Heumann) #5

this is an old one, but still appears to be a problem in the latest version of rhino + GH. @stevebaer - were you ever able to reproduce the issue I’m describing with the script I attached?