예제 #1
0
        public bool AddGrasshopperData(GrasshopperData grasshopperData)
        {
            var objId = grasshopperData.ObjectId;

            if (objId.IsNull || _grasshopperData.ContainsKey(objId))
            {
                return(false);
            }

            DefinitionManager.Load(grasshopperData.Definition, new string[] { DwgPath });
            var definition = DefinitionManager.Definition(grasshopperData.Definition);

            if (definition == null)
            {
                return(false);
            }

            foreach (var param in GrasshopperPlayer.GetInputParametersValues(definition))
            {
                if (param.Item2 is Type type)
                {
                    grasshopperData.AddProperty(param.Item1, type);
                }
                else
                {
                    grasshopperData.AddProperty(param.Item1, param.Item2);
                }
            }
            definition.Dispose();
            return(true);
        }