diff --git a/Bowerbird/Components/PathfinderComponents/ConstructPathfinder.cs b/Bowerbird/Components/PathfinderComponents/ConstructPathfinder.cs index f3caf47..b5a1e68 100644 --- a/Bowerbird/Components/PathfinderComponents/ConstructPathfinder.cs +++ b/Bowerbird/Components/PathfinderComponents/ConstructPathfinder.cs @@ -23,6 +23,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) pManager.AddBrepParameter("Surface", "S", "", GH_ParamAccess.item); pManager.AddVectorParameter("Point", "P", "", GH_ParamAccess.item); pManager.AddNumberParameter("Step Size", "H", "", GH_ParamAccess.item, 0.1); + pManager.AddIntegerParameter("Maximum number of Points", "N", "", GH_ParamAccess.item, 10000); } protected override void RegisterOutputParams(GH_OutputParamManager pManager) @@ -38,11 +39,13 @@ protected override void SolveInstance(IGH_DataAccess DA) var brep = default(Brep); var startingPoint = default(Vector3d); var stepSize = default(double); + var maxPoints = default(int); if (!DA.GetData(0, ref path)) return; if (!DA.GetData(1, ref brep)) return; if (!DA.GetData(2, ref startingPoint)) return; if (!DA.GetData(3, ref stepSize)) return; + if (!DA.GetData(4, ref maxPoints)) return; if (brep.Faces.Count > 1) throw new Exception("Multipatches not yet supported"); @@ -122,24 +125,20 @@ protected override void SolveInstance(IGH_DataAccess DA) uv = new Vector2d(u, v); } - //var type = (path as NormalCurvaturePath)?.Type ?? (path as GeodesicTorsionPath)?.Type ?? (path as DGridPath)?.Type ?? (path as PSPath).Type; - - var type = (path as NormalCurvaturePath)?.Type ?? Path.Types.Both; - var curves = new List(2); - if (type.HasFlag(Path.Types.First)) + if (path.Type.HasFlag(Path.Types.First)) { - var pathfinder = Pathfinder.Create(path, face, uv, false, stepSize, tolerance); + var pathfinder = Pathfinder.Create(path, face, uv, false, stepSize, tolerance, maxPoints); var curve = new PolylineCurve(pathfinder.Parameters); curves.Add(CurveOnSurface.Create(surface, curve)); } - if (type.HasFlag(Path.Types.Second)) + if (path.Type.HasFlag(Path.Types.Second)) { - var pathfinder = Pathfinder.Create(path, face, uv, true, stepSize, tolerance); + var pathfinder = Pathfinder.Create(path, face, uv, true, stepSize, tolerance, maxPoints); var curve = new PolylineCurve(pathfinder.Parameters); diff --git a/Bowerbird/Curvature/DGridPath.cs b/Bowerbird/Curvature/DGridPath.cs index 24cef4a..0b480ca 100644 --- a/Bowerbird/Curvature/DGridPath.cs +++ b/Bowerbird/Curvature/DGridPath.cs @@ -11,8 +11,6 @@ public class DGridPath : Path public Transform Material { get; private set; } - public Types Type { get; private set; } - private DGridPath(NurbsSurface refSurface, NurbsSurface actSurface, Transform material, Types type) { RefSurface = refSurface; diff --git a/Bowerbird/Curvature/GeodesicTorsionPath.cs b/Bowerbird/Curvature/GeodesicTorsionPath.cs index 102fa36..d68ef54 100644 --- a/Bowerbird/Curvature/GeodesicTorsionPath.cs +++ b/Bowerbird/Curvature/GeodesicTorsionPath.cs @@ -10,8 +10,6 @@ public class GeodesicTorsionPath : Path public double Angle { get; private set; } - public Types Type { get; private set; } - private GeodesicTorsionPath(double value, double angle, Types type) { Value = value; diff --git a/Bowerbird/Curvature/NormalCurvaturePath.cs b/Bowerbird/Curvature/NormalCurvaturePath.cs index 4c88401..ee4eca2 100644 --- a/Bowerbird/Curvature/NormalCurvaturePath.cs +++ b/Bowerbird/Curvature/NormalCurvaturePath.cs @@ -9,8 +9,6 @@ public class NormalCurvaturePath : Path public double Angle { get; private set; } - public Types Type { get; private set; } - private NormalCurvaturePath(double value, double angle, Types type) { Value = value; diff --git a/Bowerbird/Curvature/Path.cs b/Bowerbird/Curvature/Path.cs index 97ff2bf..5d87c97 100644 --- a/Bowerbird/Curvature/Path.cs +++ b/Bowerbird/Curvature/Path.cs @@ -13,6 +13,8 @@ public enum Types Both = 3 } + public Types Type { get; protected set; } + public abstract Vector3d InitialDirection(Surface surface, Vector2d uv, bool type); public abstract Vector2d Direction(Surface surface, Vector2d uv, Vector3d lastDirection, double stepSize); diff --git a/Bowerbird/Curvature/Pathfinder.cs b/Bowerbird/Curvature/Pathfinder.cs index 2f774bd..d9d2328 100644 --- a/Bowerbird/Curvature/Pathfinder.cs +++ b/Bowerbird/Curvature/Pathfinder.cs @@ -16,7 +16,7 @@ public Pathfinder(List parameters, List points) Points = points; } - public static Pathfinder Create(Path path, BrepFace face, Vector2d uv, bool type, double stepSize, double tolerance, int maxPoints = 10000) + public static Pathfinder Create(Path path, BrepFace face, Vector2d uv, bool type, double stepSize, double tolerance, int maxPoints) { var parameters = new List(); var points = new List(); diff --git a/Bowerbird/Curvature/PrincipalStressPath.cs b/Bowerbird/Curvature/PrincipalStressPath.cs index 222e4bd..55e4404 100644 --- a/Bowerbird/Curvature/PrincipalStressPath.cs +++ b/Bowerbird/Curvature/PrincipalStressPath.cs @@ -11,8 +11,6 @@ public class PrincipalStressPath : Path public Transform Material { get; private set; } - public Types Type { get; private set; } - private PrincipalStressPath(NurbsSurface refSurface, NurbsSurface actSurface, Transform material, Types type) { RefSurface = refSurface;