-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SwimmingPool): support SwimmingPoolIndoor
- Loading branch information
1 parent
a795fe8
commit e3d3c51
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions
47
src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SwimmingPoolIndoor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using Grasshopper.Kernel; | ||
using Ironbug.Grasshopper.Properties; | ||
using Ironbug.HVAC; | ||
|
||
namespace Ironbug.Grasshopper.Component | ||
{ | ||
public class Ironbug_SwimmingPoolIndoor : Ironbug_HVACWithParamComponent | ||
{ | ||
public Ironbug_SwimmingPoolIndoor() | ||
: base("IB_SwimmingPoolIndoor", "SwimmingPool", | ||
"Description", | ||
"Ironbug", "02:LoopComponents", typeof(IB_SwimmingPoolIndoor_FieldSet)) | ||
{ | ||
} | ||
|
||
public override GH_Exposure Exposure => GH_Exposure.septenary | GH_Exposure.obscure; | ||
|
||
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) | ||
{ | ||
pManager.AddTextParameter("poolSurfaceID", "_poolSrfId", "This is the name of the surface (floor) where the pool is located. Pools are not allowed on any surfaces other than a floor.", GH_ParamAccess.item); | ||
} | ||
|
||
|
||
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) | ||
{ | ||
pManager.AddGenericParameter("SwimmingPoolIndoor", "Pool", "TODO..", GH_ParamAccess.item); | ||
} | ||
|
||
protected override void SolveInstance(IGH_DataAccess DA) | ||
{ | ||
string srfId = string.Empty; | ||
if (!DA.GetData(0, ref srfId)) return; | ||
|
||
var obj = new IB_SwimmingPoolIndoor(); | ||
obj.SetWaterSufaceID(srfId); | ||
|
||
this.SetObjParamsTo(obj); | ||
DA.SetData(0, obj); | ||
|
||
} | ||
|
||
protected override System.Drawing.Bitmap Icon => Resources.SwimmingPool; | ||
|
||
public override Guid ComponentGuid => new Guid("{68E45483-E96D-4864-BB3E-A763DA14143A}"); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Ironbug.HVAC.BaseClass; | ||
using OpenStudio; | ||
|
||
namespace Ironbug.HVAC | ||
{ | ||
public class IB_SwimmingPoolIndoor : IB_HVACObject | ||
{ | ||
private string _surfaceID { get => this.Get(string.Empty); set => this.Set(value); } | ||
protected override Func<IB_ModelObject> IB_InitSelf => () => new IB_SwimmingPoolIndoor(); | ||
|
||
private static SwimmingPoolIndoor NewDefaultOpsObj(Model model) => new SwimmingPoolIndoor(model, new Surface(new Point3dVector(new List<Point3d>() { new Point3d(0,0,0), new Point3d(0,1,0), new Point3d(1,0,0)}), model)); | ||
public IB_SwimmingPoolIndoor() : base(NewDefaultOpsObj(new Model())) | ||
{ | ||
} | ||
|
||
public void SetWaterSufaceID(string waterSuface) | ||
{ | ||
if (string.IsNullOrEmpty(waterSuface)) | ||
throw new ArgumentException("Invalid water surface ID"); | ||
_surfaceID = waterSuface; | ||
} | ||
|
||
public override HVACComponent ToOS(Model model) | ||
{ | ||
var newObj = this.OnNewOpsObj(NewDefaultOpsObj, model); | ||
//var srfs = model.getSurfaces(); | ||
//var nn = srfs.Select(_=>_.nameString(true)).ToList(); | ||
var srf = model.getSurfaceByName(_surfaceID); | ||
if (srf == null || !srf.is_initialized()) | ||
throw new ArgumentException("Failed to find water surface for SwimmingPoolIndoor"); | ||
|
||
newObj.setSurface(srf.get()); | ||
return newObj; | ||
} | ||
} | ||
|
||
public sealed class IB_SwimmingPoolIndoor_FieldSet | ||
: IB_FieldSet<IB_SwimmingPoolIndoor_FieldSet, SwimmingPoolIndoor> | ||
{ | ||
private IB_SwimmingPoolIndoor_FieldSet() {} | ||
|
||
} | ||
} |