public void ShowSolution(Objects.Solution sol, IList <Objects.Node> nodes, string colorBy) { Utilities.AVFUtility.Clear(_uiDoc); List <Solid> solids = new List <Solid>(); List <Double> values = new List <double>(); foreach (var edge in sol.Edges) { Objects.Node n1 = nodes.Single(n => n.Id == edge.Node1); Objects.Node n2 = nodes.Single(n => n.Id == edge.Node2); var cyl = Utilities.GeometryCreationUtils.CreateCylinder(_uiDoc.Application.Application, n1.Location, n2.Location.Subtract(n1.Location).Normalize(), edge.Diameter / 2.0, n1.Location.DistanceTo(n2.Location)); solids.Add(cyl); double val = 0; switch (colorBy) { case "Diameter": val = edge.Diameter; break; case "Airflow": val = edge.Airflow; break; } values.Add(val); } Utilities.AVFUtility.ShowSolids(_uiDoc.Document, solids, values); }
private void CartesianChart1_DataClick(object sender, ChartPoint chartPoint) { // lookup a solution. _selectedSolution = getSolution(chartPoint.X, chartPoint.Y); _action = ActionEnum.Show; }
private void onRowSelected(object sender, EventArgs e) { _selectedSolution = null; if (dataGridView1.SelectedRows.Count > 0) { _selectedSolution = dataGridView1.SelectedRows[0].DataBoundItem as Objects.Solution; } _action = ActionEnum.Show; }
public CreateForm(Controllers.Controller c, Objects.Solution sol, IList <Objects.Node> nodes) { InitializeComponent(); _controller = c; _nodes = nodes; _sol = sol; var ductSystems = Controllers.MEPController.GetDuctSystemTypes(c.GetDocument()); cbSystem.Items.AddRange(ductSystems.ToArray()); cbDuctTypes.Items.AddRange(Controllers.MEPController.GetDuctTypes(c.GetDocument(), Controllers.MEPController.DuctShapeEnum.Round).ToArray()); cbSystem.SelectedItem = ductSystems.FirstOrDefault(s => s.Name.ToUpper().Contains("SUPPLY")); cbDuctTypes.SelectedIndex = 0; }
private void performCreate() { try { if (dataGridView1.SelectedRows.Count > 0) { Objects.Solution sol = dataGridView1.SelectedRows[0].DataBoundItem as Objects.Solution; if (sol != null) { UI.CreateForm create = new CreateForm(_controller, sol, _results.Nodes); if (create.ShowDialog(this) == DialogResult.OK) { this.DialogResult = DialogResult.OK; this.Close(); } } } } catch (Exception ex) { MessageBox.Show("Error: " + ex.GetType().Name + ": " + ex.Message); } }
public void DrawSolution(Objects.Solution sol, IList <Objects.Node> nodes, ElementId system, ElementId ductType) { Transaction t = null; if (_uiDoc.Document.IsModifiable == false) { t = new Transaction(_uiDoc.Document, "Create Ductwork"); t.Start(); } Utilities.AVFUtility.Clear(_uiDoc); // start with the corridor IList <Objects.Edge> corrEdges = sol.GetCorridorEdges(nodes); List <Duct> corrDucts = new List <Duct>(); List <Duct> allDucts = new List <Duct>(); SubTransaction st = new SubTransaction(_uiDoc.Document); st.Start(); foreach (var edge in corrEdges) { Objects.Node n1 = nodes.Single(n => n.Id == edge.Node1); Objects.Node n2 = nodes.Single(n => n.Id == edge.Node2); Duct d = MEPController.MakeDuct(_uiDoc.Document, n1.Location, n2.Location, ductType, system, edge.Diameter, 0.0); corrDucts.Add(d); allDucts.Add(d); } st.Commit(); _uiDoc.Document.Regenerate(); IList <FamilyInstance> fittings = MEPController.JoinDucts(corrDucts); IList <Objects.Edge> vavEdges = sol.GetVAVEdges(nodes); IList <MEPCurve> crvDucts = corrDucts.Cast <MEPCurve>().ToList(); var vavInstances = GetAllVAVs(); foreach (var edge in vavEdges) { //Objects.Node n1 = nodes.Single(n => n.Id == edge.Node1); //Objects.Node n2 = nodes.Single(n => n.Id == edge.Node2); //MEPController.MakeDuct(_uiDoc.Document, n1.Location, n2.Location, ductType, system, edge.Diameter, 0.0); Duct d = createVAVConnection(edge, ductType, system, nodes, crvDucts, vavInstances, fittings); } IList <Objects.Edge> shaftEdges = sol.GetShaftEdges(nodes); foreach (var edge in shaftEdges) { Objects.Node n1 = nodes.Single(n => n.Id == edge.Node1); Objects.Node n2 = nodes.Single(n => n.Id == edge.Node2); MEPController.MakeDuct(_uiDoc.Document, n1.Location, n2.Location, ductType, system, edge.Diameter, 0.0); } if (t != null) { t.Commit(); } }