//Revit에서 추출가능한 정보를 Parameter 내부에 저장하도록 구현. public Result Create(ExternalCommandData commandData, ref string message, DataCtrl.DataCtrlInterface dataCtrl) { PCFData.Application = commandData.Application; PCFData.Document = PCFData.Application.ActiveUIDocument.Document; //PCF를 작성하기 위해 필요한 element를 찾아 낸다. FilteredElementCollector collector = PCFData.CollectPipeElements(PCFData.Document); try { //Revit에 있는 정보를 활용하여, PCF에 쓰일 Component 정보를 수집한다. foreach (Autodesk.Revit.DB.Element element in collector) { //Host 역할을 하는 FamilyInstance if (element is Autodesk.Revit.DB.Plumbing.Pipe || (element is FamilyInstance && (element as FamilyInstance).SuperComponent == null)) { this.CreateComponents(element); } } //Excel에 있는 Material 정보를 수집하여 저장한다. this.Materials = dataCtrl.GetMaterials(); } catch (Autodesk.Revit.Exceptions.OperationCanceledException) { return(Result.Cancelled); } catch (Exception ex) { message = ex.Message; return(Result.Failed); } return(Result.Succeeded); }
public Pipe(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { ConnectorSet connectorSet = (element as Autodesk.Revit.DB.Plumbing.Pipe).ConnectorManager.Connectors; IList <Connector> connectorEnd = (from Connector connector in connectorSet where connector.ConnectorType == ConnectorType.End select connector).ToList(); //Primary this.KeyPoints.Add(new DataType.ExternalKeyPoint(DataType.KeypointType.END, connectorEnd.First().Origin, connectorEnd.First().Radius, this.getEndtype(element, RevitParam.ParameterName.Primary_Endtype))); //Secondary this.KeyPoints.Add(new DataType.ExternalKeyPoint(DataType.KeypointType.END, connectorEnd.Last().Origin, connectorEnd.Last().Radius, this.getEndtype(element, RevitParam.ParameterName.Secondary_Endtype))); }
public Tee(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { //남은 Connector은 모두 Branch Point로 취급한다. IList <Connector> leftOver = this.getPrimaryandSecondaryPoint(element); int branchNumber = 0; foreach (Connector connector in leftOver) { this.KeyPoints.Add(new DataType.BranchPoint(++branchNumber, DataType.KeypointType.BRANCH, connector.Origin, connector.Radius, this.getEndtype(element, RevitParam.ParameterName.Branch_Endtype))); } this.getCentrePoint(element); }
public Elbow(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getPrimaryandSecondaryPoint(element); this.getCentrePoint(element); //TODO: (하) 패밀리의 변수 이름 "각도"가 한글이면 한글로 변수 값을 찾아야 하는 문제가 있다. if (element.LookupParameter("Angle") == null) { this.Angle = element.LookupParameter("각도").AsDouble(); } else { this.Angle = element.LookupParameter("Angle").AsDouble(); } }
public AppUI(ExternalCommandData revit, ref string message) { InitializeComponent(); this.Revit = revit; this.Message = message; this.Paramters = new PCFData(); this.Writer = new PCFWriter(); //Excel 파일만 열 수 있도록 한정 this.openExcelDialog.Filter = "Excel files (*.xlsx)|*.xlsx"; if (!string.IsNullOrEmpty(Properties.Settings.Default.ExcelPath)) { this.ExcelName.Text = Properties.Settings.Default.ExcelPath; this.DataCtrl = new DataCtrl.ExcelCtrl(Revit, Properties.Settings.Default.ExcelPath); } }
//Component가 Element로 부터 정보를 얻는다! public Component(PCFData data, Autodesk.Revit.DB.Element element) { this.Data = data; //초기화 this.Misc_Spec = new List <string>(5); this.KeyPoints = new List <DataType.KeyPoint>(); //파라미터 값을 추가하는 과정 this.Component_Type = RevitParam.GetParameter(element, RevitParam.ParameterName.Type).AsString(); this.Component_Identifier = ++elementIdentificationNumber; //Material 처리 this.Material_Identifier = this.Data.GetMaterialData(RevitParam.GetParameter(element, RevitParam.ParameterName.Item_Code).AsString()).Material_Identifier; this.Category = DataType.EnumString.CATEGORY.GetBySecond(RevitParam.GetParameter(element, RevitParam.ParameterName.Category).AsString()); this.Piping_Spec = RevitParam.GetParameter(element, RevitParam.ParameterName.Piping_Spec).AsString(); this.Unique_Component_Identifier = element.UniqueId; }
public Result WriteFile(string filename, PCFData param) { try { param.BasicHeader.Write(this.Writer); param.PipelineHeader.Write(this.Writer); foreach (Writable cp in param.Components) { cp.Write(this.Writer); } this.Writer.Append("MATERIALS").AppendLine(); foreach (MaterialData md in param.Materials.Values) { md.Write(this.Writer); } System.IO.File.WriteAllBytes(filename, new byte[0]); using (StreamWriter w = File.AppendText(filename)) { w.Write(this.Writer); w.Close(); } return(Result.Succeeded); } catch (Autodesk.Revit.Exceptions.OperationCanceledException) { return(Result.Cancelled); } catch (Exception exception) { MessageBox.Show(exception.Message); return(Result.Failed); } }
public Gasket(PCFData data, Autodesk.Revit.DB.Element element, IList <Component> components) : base(data, element, components) { this.getPrimaryandSecondaryPoint(element); }
public AssociatedComponent(PCFData data, Autodesk.Revit.DB.Element element, IList <Component> components) : base(data, element) { this.Mater_Component_Identifier = this.GetMaterComponentIdentifier(element, components); }
public Instrument(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getPrimaryandSecondaryPoint(element); this.getCentrePoint(element); }
public Filter(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getPrimaryandSecondaryPoint(element); }
public Cap(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getEndPointsWithSingleConnector(element); }
public Reducer_Eccentric(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getPrimaryandSecondaryPoint(element); }
public Element(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.Skey = RevitParam.GetParameter(element, RevitParam.ParameterName.Skey).AsString(); }