public static Wall Wall(Line line, double height, IConstruction construction, Offset offset = Offset.Undefined, string name = "") { if (line == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a Physical.Wall from a null line."); return(null); } Polyline boundary = new Polyline(); Vector move = Vector.ZAxis * height; boundary.ControlPoints.Add(line.Start); boundary.ControlPoints.Add(line.End); boundary.ControlPoints.Add(line.End + move); boundary.ControlPoints.Add(line.Start + move); boundary.ControlPoints.Add(line.Start); return(new Wall { Location = Geometry.Create.PlanarSurface(boundary), Construction = construction, Offset = offset, Name = name }); }
public static CurtainWall CurtainWall(IEnumerable <ICurve> outlines, IConstruction construction = null, FrameEdgeProperty frameEdgeProperty = null, string name = "") { if (outlines == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a CurtainWall from a null collection of outlines."); return(null); } List <Opening> openings = new List <Opening>(); for (int i = 0; i < outlines.Count(); i++) { ICurve outline = outlines.ElementAt(i); if (outline.IIsClosed() != true) { BH.Engine.Reflection.Compute.RecordError("Outline at index " + i + " was not closed and was excluded from the created CurtainWall. This method only works with closed outlines which each represent one opening in the CurtainWall."); } else { Opening opening = Create.Opening(new List <ICurve> { outline }, construction, frameEdgeProperty, name + "_" + i); openings.Add(opening); } } List <IElement1D> externalEdges = Query.ExternalEdges(openings); List <FrameEdge> extFrameEdges = externalEdges.OfType <ICurve>().Select(x => new FrameEdge { Curve = x }).ToList(); return(new CurtainWall { ExternalEdges = extFrameEdges, Openings = openings, Name = name }); }
public static List <Panel> SetConstructions(this List <Panel> panels, IConstruction newConstruction, List <string> typeNames = null) { List <Panel> clones = new List <Panel>(panels.Select(x => x.DeepClone <Panel>()).ToList()); List <Panel> returnPanels = new List <Panel>(); foreach (Panel p in clones) { if (typeNames == null || typeNames.Count() == 0) { p.Construction = newConstruction; } else { OriginContextFragment context = p.FindFragment <OriginContextFragment>(typeof(OriginContextFragment)); if (context != null && typeNames.Contains(context.TypeName)) { p.Construction = newConstruction; } } returnPanels.Add(p); } return(returnPanels); }
public static List <Opening> SetConstructions(this List <Opening> openings, IConstruction newConstruction, List <string> typeNames = null) { List <Opening> clones = new List <Opening>(openings.Select(x => x.DeepClone <Opening>()).ToList()); List <Opening> returnOpenings = new List <Opening>(); foreach (Opening o in clones) { if (typeNames == null) { o.OpeningConstruction = newConstruction; } else { OriginContextFragment context = o.FindFragment <OriginContextFragment>(typeof(OriginContextFragment)); if (context != null && typeNames.Contains(context.TypeName)) { o.OpeningConstruction = newConstruction; } } returnOpenings.Add(o); } return(returnOpenings); }
public static Wall Wall(IConstruction construction, ICurve bottomEdge, double height) { if (construction == null || bottomEdge == null || height <= 0) { Reflection.Compute.RecordError("Physical Wall could not be created because some input data are null"); return(null); } if (Geometry.Query.IIsClosed(bottomEdge)) { Reflection.Compute.RecordError("Physical Wall could not be created because bottom edge cannot be closed curve"); return(null); } ICurve aICurve = bottomEdge.ITranslate(Geometry.Create.Vector(0, 0, height)).IFlip(); Line aLine_1 = Geometry.Create.Line(bottomEdge.IEndPoint(), aICurve.IStartPoint()); Line aLine_2 = Geometry.Create.Line(aICurve.IEndPoint(), bottomEdge.IStartPoint()); PolyCurve aPolyCurve = Geometry.Create.PolyCurve(new ICurve[] { bottomEdge, aLine_1, aICurve, aLine_2 }); return(new Wall() { Construction = construction, Location = Geometry.Create.PlanarSurface(aPolyCurve) }); }
public static Roof Roof(IConstruction construction, ICurve edges, IEnumerable <ICurve> internalEdges) { if (construction == null || edges == null) { Reflection.Compute.RecordError("Physical Roof could not be created because some input data are null"); return(null); } List <ICurve> aInternalCurveList = null; if (internalEdges != null && internalEdges.Count() > 0) { aInternalCurveList = internalEdges.ToList().ConvertAll(x => x as ICurve); } PlanarSurface aPlanarSurface = Geometry.Create.PlanarSurface(edges, aInternalCurveList); if (aPlanarSurface == null) { Reflection.Compute.RecordError("Physical Roof could not be created because invalid geometry of edges"); return(null); } return(new Roof() { Construction = construction, Location = aPlanarSurface }); }
public static ModelEnergyProperties GetResourcesByStandardConstructionSetIdentifier(string standardConstructionSet) { var year = standardConstructionSet.Split(':').First(); if (string.IsNullOrEmpty(year)) { throw new ArgumentException($"Invalid {standardConstructionSet}"); } var found = StandardsConstructionSets.TryGetValue(standardConstructionSet, out ConstructionSetAbridged cSet); if (!found) { throw new ArgumentException($"Cannot find {standardConstructionSet}"); } // get constructions var cNames = cSet.GetAllConstructions(); var constructions = cNames.Select(_ => { IConstruction con = null; if (StandardsOpaqueConstructions.TryGetValue(_, out var opaque)) { con = opaque; } else if (StandardsWindowConstructions.TryGetValue(_, out var window)) { con = window; } //TODO: Shade, AirBoundary, WindowDynamic return(con); }); var materials = constructions .SelectMany(_ => _.GetAbridgedConstructionMaterials()) .Select(_ => { IMaterial mat = null; if (StandardsOpaqueMaterials.TryGetValue(_, out var opaque)) { mat = opaque; } else if (StandardsWindowMaterials.TryGetValue(_, out var window)) { mat = window; } return(mat); }); var res = new ModelEnergyProperties(); res.AddConstructionSet(cSet); res.AddConstructions(constructions); res.AddMaterials(materials); return(res); }
public static List <Panel> SetOpeningConstruction(this List <Panel> panels, IConstruction newConstruction, List <string> typeNames = null) { foreach (Panel p in panels) { p.Openings = p.Openings.SetConstructions(newConstruction, typeNames); } return(panels); }
public static List <Panel> SetOpeningConstruction(this List <Panel> panels, IConstruction newConstruction, List <string> typeNames = null) { List <Panel> clones = new List <Panel>(panels.Select(x => x.DeepClone <Panel>()).ToList()); foreach (Panel p in clones) { p.Openings = p.Openings.SetConstructions(newConstruction, typeNames); } return(clones); }
public static string UniqueConstructionName(this IConstruction construction, bool includeConstructionName = false) { string name = includeConstructionName ? construction.Name : "construction-"; Construction c = construction as Construction; foreach (Layer l in c.Layers) { name += l.Material.Name + "-"; } return(name); }
public static string UniqueConstructionName(this IConstruction construction) { string name = "construction-"; Construction c = construction as Construction; foreach (Layer l in c.Layers) { name += l.Material.Name + "-"; } return(name); }
public static Roof Roof(IConstruction construction, oM.Geometry.ISurface location, List <IOpening> openings = null, Offset offset = Offset.Undefined, string name = "") { openings = openings ?? new List <IOpening>(); return(new Roof { Location = location, Construction = construction, Openings = openings, Offset = offset, Name = name }); }
public static ApertureConstruction ToSAM_ApertureConstruction(this IConstruction construction, Core.MaterialLibrary materialLibrary = null) { if (construction == null) { return(null); } if (construction is WindowConstructionAbridged) { return(((WindowConstructionAbridged)construction).ToSAM(materialLibrary)); } return(null); }
public static Construction ToSAM_Construction(this IConstruction construction, Core.MaterialLibrary materialLibrary = null) { if (construction == null) { return(null); } if (construction is OpaqueConstructionAbridged) { return(((OpaqueConstructionAbridged)construction).ToSAM(materialLibrary)); } return(null); }
public static Opening Opening(IEnumerable <ICurve> edges, IConstruction construction = null, FrameEdgeProperty frameEdgeProperty = null, string name = "") { if (edges == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create an opening from a null collection of edges."); return(null); } List <ICurve> externalEdges = new List <ICurve>(); foreach (ICurve edge in edges) { externalEdges.AddRange(edge.ISubParts()); } List <PolyCurve> joined = Geometry.Compute.IJoin(edges.ToList()); if (joined.Count == 0) { Reflection.Compute.RecordError("Could not join Curves. Opening not Created."); return(null); } else if (joined.Count > 1) { Reflection.Compute.RecordError("Provided curves could not be joined to a single curve. Opening not created."); return(null); } //Single joined curve if (joined[0].IIsClosed()) { return new Opening { Edges = externalEdges.Select(x => new FrameEdge { Curve = x, FrameEdgeProperty = frameEdgeProperty }).ToList(), OpeningConstruction = construction, Name = name } } ; else { Reflection.Compute.RecordError("Provided curves do not form a closed loop. Could not create opening."); return(null); } }
public static Wall Wall(Line line, double height, IConstruction construction, Offset offset = Offset.Undefined, string name = "") { Polyline boundary = new Polyline(); Vector move = Vector.ZAxis * height; boundary.ControlPoints.Add(line.Start); boundary.ControlPoints.Add(line.End); boundary.ControlPoints.Add(line.End + move); boundary.ControlPoints.Add(line.Start + move); boundary.ControlPoints.Add(line.Start); return(new Wall { Location = Geometry.Create.PlanarSurface(boundary), Construction = construction, Offset = offset, Name = name }); }
public static Wall Wall(IConstruction construction, ICurve edges, IEnumerable <ICurve> internalEdges) { if (construction == null || edges == null) { Reflection.Compute.RecordError("Physical Wall could not be created because some input data are null"); return(null); } PlanarSurface aPlanarSurface = Geometry.Create.PlanarSurface(edges); if (aPlanarSurface == null) { Reflection.Compute.RecordError("Physical Wall could not be created because invalid geometry of edges"); return(null); } return(new Wall() { Construction = construction, Location = aPlanarSurface }); }
public static Panel Panel(ICurve outline, List <ICurve> openings = null, IConstruction construction = null, FrameEdgeProperty frameEdgeProperty = null, PanelType panelType = PanelType.Undefined, IConstruction openingConstruction = null, FrameEdgeProperty openingFrameEdgeProperty = null, string name = "") { if (outline == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a panel from a null outline."); return(null); } if (!outline.IIsClosed()) { Reflection.Compute.RecordError("Outline not closed. Could not create Panel."); return(null); } List <Opening> pOpenings = openings != null?openings.Select(o => Create.Opening(new List <ICurve> { o }, openingConstruction, frameEdgeProperty)).Where(x => x != null).ToList() : new List <Opening>(); List <FrameEdge> externalEdges = outline.ISubParts().Select(x => new FrameEdge { Curve = x, FrameEdgeProperty = frameEdgeProperty }).ToList(); return(Create.Panel(externalEdges, pOpenings, construction, panelType, name)); }
public static List <Panel> SetConstructions(this List <Panel> panels, IConstruction newConstruction, List <string> typeNames = null) { List <Panel> returnPanels = new List <Panel>(); foreach (Panel p in panels) { if (typeNames == null) { p.Construction = newConstruction; } else { OriginContextFragment context = p.FindFragment <OriginContextFragment>(typeof(OriginContextFragment)); if (context != null && typeNames.Contains(context.TypeName)) { p.Construction = newConstruction; } } returnPanels.Add(p); } return(returnPanels); }
public Source(IConstruction _iSource) { iSource = _iSource; }
public static Opening Opening(string name = "", List <Edge> externalEdges = null, List <Edge> innerEdges = null, IConstruction frameConstruction = null, IConstruction openingConstruction = null, OpeningType type = OpeningType.Undefined) { externalEdges = externalEdges ?? new List <Edge>(); innerEdges = innerEdges ?? new List <Edge>(); return(new Opening { Name = name, Edges = externalEdges, InnerEdges = innerEdges, FrameConstruction = frameConstruction, OpeningConstruction = openingConstruction, Type = type, }); }
public static Opening Opening(IEnumerable <ICurve> edges, FrameEdgeProperty headProperty = null, FrameEdgeProperty jambProperty = null, FrameEdgeProperty sillProperty = null, IConstruction construction = null, string name = "") { if (edges == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create an opening from a null collection of edges."); return(null); } List <ICurve> externalEdges = edges.SelectMany(x => x.ISubParts()).ToList(); List <PolyCurve> joined = Geometry.Compute.IJoin(edges.ToList()); if (joined.Count == 0) { Reflection.Compute.RecordError("Could not join Curves. Opening not created."); return(null); } else if (joined.Count > 1) { Reflection.Compute.RecordError("Provided curves could not be joined to a single curve. Opening not created."); return(null); } //Single joined curve if (joined[0].IIsClosed()) { Opening opening = new Opening { Edges = externalEdges.Select(x => new FrameEdge { Curve = x }).ToList(), OpeningConstruction = construction, Name = name }; foreach (FrameEdge edge in opening.Edges) { string edgeType = edge.FrameEdgeType(opening); switch (edgeType) { case "Head": edge.FrameEdgeProperty = headProperty; break; case "Jamb": edge.FrameEdgeProperty = jambProperty; break; case "Sill": edge.FrameEdgeProperty = sillProperty; break; default: break; } } return(opening); } else { Reflection.Compute.RecordError("Provided curves do not form a closed loop. Could not create opening."); return(null); } }
public Stone(IConstruction iSource) : base(iSource) { kindOfStone = KindOfStone.BAZALT; }
public static Panel Panel(PlanarSurface surface, Construction construction = null, FrameEdgeProperty frameEdgeProperty = null, PanelType panelType = PanelType.Undefined, IConstruction openingConstruction = null, FrameEdgeProperty openingFrameEdgeProperty = null, string name = "") { if (surface == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a panel from a null surface."); return(null); } return(Panel(surface.ExternalBoundary, surface.InternalBoundaries.ToList(), construction, frameEdgeProperty, panelType, openingConstruction, openingFrameEdgeProperty, name)); }
public static Panel Panel(List <FrameEdge> externalEdges, List <Opening> openings = null, IConstruction construction = null, PanelType panelType = PanelType.Undefined, string name = "") { Panel panel = new Panel { ExternalEdges = externalEdges, Openings = openings ?? new List <Opening>(), Construction = construction, Type = panelType, Name = name }; return(panel); }
internal static void BuildAsync() { if (YamlBase.Modules == null) { return; } Task.Run(async() => { YamlBase.Modules.ForEach(async c => { switch (c.Launcher) { case nameof(Communication.CsvFile): await Task.Run(() => { if (c.Enable) { EnableCsvFile = true; GlobalApproach.PipeBuilder(true, Communication.CsvFile); } ; }); break; case nameof(Communication.ModbusTcp): await Task.Run(() => { if (c.Enable) { EnableModbusTcp = true; GlobalApproach.PipeBuilder(true, Communication.ModbusTcp); IConstruction factory = SimpleFactory.BuildService(c.Arguments.Replace(" ", "")); factory.Start(); } ; }); break; case nameof(Communication.OpcUa): await Task.Run(() => { if (c.Enable) { EnableOpcUa = true; GlobalApproach.PipeBuilder(true, Communication.OpcUa); } ; }); break; } }); while (!EnableEdgeService) { ; } if (EnableCsvFile == false) { GlobalApproach.PipeBuilder(false, Communication.CsvFile); } if (EnableModbusTcp == false) { GlobalApproach.PipeBuilder(false, Communication.ModbusTcp); } if (EnableOpcUa == false) { GlobalApproach.PipeBuilder(false, Communication.OpcUa); } Console.WriteLine("\n Local IP => " + GeneralTools.GetLocalIP()); string EquallyDivided = new('*', 14); Console.WriteLine($"{Welcome(WelcomeTitle)}\n {EquallyDivided} {ServiceTitle} {EquallyDivided}\n"); await Task.Run(async() => { await Task.Delay(TimeSpan.FromSeconds(5)); if (!YamlBase.Propertie.Debug) { ShowWindow(GetConsoleWindow(), 0); } });
public static Roof Roof(IConstruction construction, ICurve edges) { return(Roof(construction, edges, null)); }
/******************************************************/ /**** IConstruction Methods ****/ /******************************************************/ public static MaterialComposition IMaterialComposition(this IConstruction prop) { return(MaterialComposition(prop as dynamic)); }
public static Panel Panel(string name = "", List <Edge> externalEdges = null, List <Opening> openings = null, IConstruction construction = null, PanelType type = PanelType.Undefined, List <string> connectedSpaces = null) { externalEdges = externalEdges ?? new List <Edge>(); openings = openings ?? new List <Opening>(); connectedSpaces = connectedSpaces ?? new List <string>(); return(new Panel { Name = name, ExternalEdges = externalEdges, Openings = openings, Construction = construction, Type = type, ConnectedSpaces = connectedSpaces, }); }
/***************************************************/ /**** Private Fallback Methods ****/ /***************************************************/ private static MaterialComposition MaterialComposition(this IConstruction prop) { throw new NotImplementedException(); }