Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean Polyline #337

Merged
merged 5 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions XML_Adapter/Serialise/Opening.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ public partial class GBXMLSerializer

foreach (BH.oM.Environment.Elements.Opening opening in openings)
{
if (opening.Polyline() == null) continue;
Polyline openingPoly = opening.Polyline();

if (openingPoly == null || openingPoly.CleanPolyline(distanceTolerance: settings.DistanceTolerance) == null) continue;

openingPoly = openingPoly.CleanPolyline(distanceTolerance: settings.DistanceTolerance);

BH.oM.XML.Opening gbOpening = BH.Engine.XML.Convert.ToGBXML(opening);

//Normals away from space
if (!BH.Engine.Environment.Query.NormalAwayFromSpace(opening.Polyline(), space))
gbOpening.PlanarGeometry.PolyLoop = BH.Engine.XML.Convert.ToGBXML(opening.Polyline().Flip());
if (!BH.Engine.Environment.Query.NormalAwayFromSpace(openingPoly, space))
gbOpening.PlanarGeometry.PolyLoop = BH.Engine.XML.Convert.ToGBXML(openingPoly.Flip());

Panel buildingElement = new Panel();
;
Expand Down
4 changes: 3 additions & 1 deletion XML_Engine/Create/XMLSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public static partial class Create
[Input("newFile", "Set to false if you want to append to a file when pushing XML. If set to true then a file will be created. If a file exists, it will be overwritten. Default true")]
[Input("unitType", "Set the unit type for the export to be either SI or Imperial. Default SI")]
[Input("exportDetail", "Set the detail of your export to be either full (whole building), shell (exterior walls only), or spaces (each individual space as its own XML file). Default full")]
[Input("distanceTolerance", "distanceTolerance is used as input for CleanPolyline method used for opening")]
[Output("xmlSettings", "The XML settings to use with the XML adapter push")]
public static XMLSettings XMLSettings(bool replaceCurtainWalls = false, bool replaceSolidOpeningsIntoDoors = false, bool includeConstructions = false, bool fixIncorrectAirTypes = false, bool newFile = true, UnitType unitType = UnitType.SI, ExportDetail exportDetail = ExportDetail.Full)
public static XMLSettings XMLSettings(bool replaceCurtainWalls = false, bool replaceSolidOpeningsIntoDoors = false, bool includeConstructions = false, bool fixIncorrectAirTypes = false, bool newFile = true, UnitType unitType = UnitType.SI, ExportDetail exportDetail = ExportDetail.Full, double distanceTolerance = 0.01)
{
return new XMLSettings
{
Expand All @@ -60,6 +61,7 @@ public static XMLSettings XMLSettings(bool replaceCurtainWalls = false, bool rep
NewFile = newFile,
UnitType = unitType,
ExportDetail = exportDetail,
DistanceTolerance = distanceTolerance
};
}
}
Expand Down
1 change: 1 addition & 0 deletions XML_oM/XMLSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class XMLSettings : BHoMObject
public bool NewFile { get; set; } = true;
public UnitType UnitType { get; set; } = UnitType.SI;
public ExportDetail ExportDetail { get; set; } = ExportDetail.Full;
public double DistanceTolerance { get; set; } = 0.01;

/***************************************************/
}
Expand Down