Example #1
0
        // This is the automagic method
        protected static void ApplySchemas(List <RhinoObject> objs, RhinoDoc ActiveDoc)
        {
            var schemaFilter     = new SchemaObjectFilter(objs, ActiveDoc);
            var schemaDictionary = schemaFilter.SchemaDictionary;

            foreach (string schema in schemaDictionary.Keys)
            {
                foreach (RhinoObject obj in schemaDictionary[schema])
                {
                    WriteUserString(obj, schema);
                }
            }
        }
        protected void ApplySchemas(List <RhinoObject> objs)
        {
            SchemaObjectFilter schemaFilter = new SchemaObjectFilter(objs, ActiveDoc);
            var schemaDictionary            = schemaFilter.SchemaDictionary;

            foreach (string schema in schemaDictionary.Keys)
            {
                foreach (RhinoObject obj in schemaDictionary[schema])
                {
                    obj.Attributes.SetUserString(SpeckleSchemaKey, schema);
                }
            }
        }
Example #3
0
 // This is the manual method
 protected static void ApplySchema(List <RhinoObject> objs, string schema, RhinoDoc ActiveDoc, bool asDirectShape = false)
 {
     // test for direct shape - apply user string as long as objs are breps and meshes
     if (asDirectShape)
     {
         foreach (RhinoObject obj in objs)
         {
             if (obj.ObjectType == ObjectType.Brep || obj.ObjectType == ObjectType.Extrusion || obj.ObjectType == ObjectType.Mesh)
             {
                 WriteUserString(obj, schema, true);
             }
         }
     }
     else
     {
         var schemaFilter = new SchemaObjectFilter(objs, ActiveDoc, schema);
         foreach (RhinoObject obj in schemaFilter.SchemaDictionary[schema])
         {
             WriteUserString(obj, schema);
         }
     }
 }