protected override void SolveInstance(IGH_DataAccess DA) { Types.BcEntity bcEnt = null; if (!DA.GetData("BuildingElement", ref bcEnt)) { return; } Types.PropCategory propertyCategory = null; DA.GetData("PropCategory", ref propertyCategory); var objectId = bcEnt.ObjectId; if (propertyCategory != null) { var props = Bricscad.Bim.BIMClassification.GetPropertiesMap(objectId); var catStr = propertyCategory.Value.ToCategoryString(); var res = props.Where(propData => propData.Value == catStr) .Select(propData => propData.Key) .ToList(); DA.SetDataList("Names", res); } else { DA.SetDataList("Names", Bricscad.Bim.BIMClassification.GetPropertiesString(objectId)); } }
protected override void SolveInstance(IGH_DataAccess DA) { Types.BcEntity bcEnt = null; string propertyName = null; Types.PropCategory propertyCategory = null; if (!DA.GetData("BuildingElement", ref bcEnt) || !DA.GetData("PropName", ref propertyName) || !DA.GetData("PropCategory", ref propertyCategory)) { return; } var objectId = bcEnt.ObjectId; if (!Bricscad.Bim.BIMClassification.HasProperty(objectId, propertyName, propertyCategory.Value)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Property with name \"{0}\" does not exist", propertyName)); return; } try { var propertyValue = Bricscad.Bim.BIMClassification.GetProperty(objectId, propertyName, propertyCategory.Value); if (propertyValue == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Failed to obtain property with name \"{0}\"", propertyName)); return; } DA.SetData("PropVal", propertyValue); } catch { } }
protected override void SolveInstance(IGH_DataAccess DA) { Types.BcEntity bcEnt = null; string propertyName = null; IGH_Goo propertyValue = null; Types.PropCategory propertyCategory = null; if (!DA.GetData("BuildingElement", ref bcEnt) || !DA.GetData("PropName", ref propertyName) || !DA.GetData("PropVal", ref propertyValue) || !DA.GetData("PropCategory", ref propertyCategory)) { return; } var objectId = bcEnt.ObjectId; object val = null; switch (propertyValue.ScriptVariable()) { case string strVal: val = strVal; break; case int intVal: val = intVal; break; case double dblVal: val = dblVal; break; } if (val == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Conversion failed from {0} to string, int or double", propertyValue.TypeName)); return; } if (!Bricscad.Bim.BIMClassification.HasProperty(objectId, propertyName, propertyCategory.Value)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Property with name \"{0}\" does not exist", propertyName)); return; } if (Bricscad.Bim.BIMClassification.SetProperty(objectId, propertyName, val, propertyCategory.Value) != Bricscad.Bim.BimResStatus.Ok) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Failed to set property \"{0}\" for object {1}", propertyName, bcEnt.PersistentRef)); } }