public override string ExecuteRequest() { GetElementInfo elementInfo = new GetElementInfo(); BIM_Service.Element e = elementInfo.Get(Pamareters["elementID"]); string response = ""; response += "{"; response += "id:" + e.id + ";"; response += "name:" + e.name + ";"; response += "category:" + e.category + ";"; response += "type:" + e.type + ";"; response += "obs:" + e.obs + ";}#"; return(response); }
public BIM_Service.Element Get(string elementID) { try { Document doc; if (ModelService.Service.IsActive) { doc = ModelService.Service.RvtDoc; } else if (TCPServer.Server.IsActive) { doc = TCPServer.Server.RvtDoc; } else { throw new Exception("Server not running..."); } Element element = doc.GetElement(new ElementId(Convert.ToInt32(elementID))); BIM_Service.Element result = new BIM_Service.Element(); result.id = element.Id.IntegerValue; result.name = element.Name; result.type = IdentifyElement(element); result.category = element.Category.Name; result.obs = ""; if (result.type == "Door") { ElementId elemTypeId = element.GetTypeId(); ElementType elemType = (ElementType)doc.GetElement(elemTypeId); Parameter parameter = GetParameter(elemType, "Frame Material"); result.obs = (parameter != null && ParameterToString(parameter) != "") ? "Contain Frame" : "No Frame"; } return(result); } catch (Exception e) { TaskDialog.Show("Ups...", e.Message); } return(null); }