Create polycurve from multiple Curve[] loops

Hi All,

I am working on a method to create multiple closed polycurves when the OffsetMany method returns multiple Curve[] loops. I’m having trouble determining the correct implementation in the else-if block. I would appreciate any assistance.

Thank you!

@jacob.small @chuongmep

        /// <summary>
        /// Offset a planar surface and round the edges if required.
        /// </summary>
        /// <param name="surface">The surface input.</param>
        /// <param name="offsetDistance">The perimeter offset distance.</param>
        /// <param name="concaveFillet">The fillet radius at the concave corner.</param>
        /// <param name="convexFillet">The fillet radius at the convex corner.</param>
        /// <returns>The offset surface.</returns>
        /// <exception cref="Exception"></exception>
        public static Surface OffsetSurface(
            Surface surface,
            float offsetDistance,
            float concaveFillet = 0,
            float convexFillet = 0)
        {
            // Check if the surface is planar and horizontal.
            Surface _surface = CheckSurfacePlanarity(surface);

            // Get the surface perimeter curve.
            PolyCurve perimeterCurve = SurfacePerimeter(_surface);

            // Offset the perimeter curve.
            List<PolyCurve> joinedCurves = new List<PolyCurve>();
            //try
            //{
                Curve[] offsetCurves = perimeterCurve.OffsetMany(offsetDistance, SurfacePlane(_surface).Normal);

                // Check if offset many creates one curve loop.
                if (offsetCurves.Length == 1)
                {
                    PolyCurve placeHolderCurve = PolyCurve.ByJoinedCurves(offsetCurves, 0.001, false, 0);

                    // Check if the area of the offset curve is greater than that of the original surface.
                    if (Surface.ByPatch(placeHolderCurve).Area > surface.Area)
                    {
                        Curve[] offsetCurvesAlt = perimeterCurve.OffsetMany(-offsetDistance, SurfacePlane(_surface).Normal);
                        placeHolderCurve = PolyCurve.ByJoinedCurves(offsetCurvesAlt, 0.001, false, 0);
                    }
                    joinedCurves.Add(placeHolderCurve);
                }
                // Check if offset many creates more than one curve loop.
                else if (offsetCurves.Length > 1)
                {
                    List<Curve[]> newCurves = new List<Curve[]>();
                    newCurves.Add(offsetCurves);
                    foreach (Curve[] curve in newCurves)
                    {
                        PolyCurve placeHolderCurve = PolyCurve.ByJoinedCurves(curve, 0.001, false, 0);
                        joinedCurves.Add(placeHolderCurve);
                    }
                }
            //}
            //catch (Exception ex)
            //{
                //throw new Exception("The surface cannot be offset. Reduce the offset distance.", ex);
            //}

            // Round the concave corners of the offset curves.
            List<PolyCurve> concaveRoundedCurves = new List<PolyCurve>();
            foreach (PolyCurve curve in joinedCurves)
            {
                if (concaveFillet > 0)
                {
                    try
                    {
                        concaveRoundedCurves.Add(curve.Fillet(concaveFillet, false));
                    }
                    catch
                    {
                        concaveRoundedCurves.Add(curve);
                    }
                }
                else
                {
                    concaveRoundedCurves.Add(curve);
                }
            }

            // Round the convex corners of the concave rounded curves.
            List<PolyCurve> convexRoundedCurves = new List<PolyCurve>();
            foreach (PolyCurve curve in concaveRoundedCurves)
            {
                if (convexFillet > 0)
                {
                    try
                    {
                        convexRoundedCurves.Add(curve.Fillet(convexFillet, true));
                    }
                    catch
                    {
                        convexRoundedCurves.Add(curve);
                    }
                }
                else
                {
                    convexRoundedCurves.Add(curve);
                }
            }

            // Create surfaces from the curve loops.
            List<Surface> offsetSurfaces = new List<Surface>();
            foreach (PolyCurve curve in convexRoundedCurves)
            {
                offsetSurfaces.Add(Surface.ByPatch(curve));
            }

            // Join the surfaces into a single surface.
            Surface finalSurface = Surface.ByUnion(offsetSurfaces);

            return finalSurface;
        }

Can you show a geometry condition in a sketch form? If memory serves PolyCurve.OffsetMany returns closed PolyCurves.

Hi Jacob

Thanks for the response.
Please see the sketch below.

Here is a JSON string of the surface

"{\"typeid\": \"autodesk.soliddef:model-1.0.0\",\"map<autodesk.soliddef:basegeometry-1.0.0>\": {\"geometries\": {\"insert\": {\"autodesk.soliddef:point-1.0.0\": {\"05f3c48f-48c0-43fc-aefc-510b6cd38115\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 358.5948039213681,\"y\": -47.26267080307053,\"z\": 0}}}},\"08f039de-5de3-4614-a8be-1ef63f45aa7b\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 354.4678592713909,\"y\": 33.05564789057331,\"z\": 0}}}},\"0cceeb03-6915-454c-94f0-2bf79cb9c1ef\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 372.4222564781883,\"y\": -12.27585355076551,\"z\": 0}}}},\"14c41e03-f07a-4a84-95c6-6a90e64ecd1b\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 375.6232396488192,\"y\": -55.20316078918123,\"z\": 0}}}},\"36817409-6d86-4e7c-a9c3-34df4b56f660\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 373.5597423634276,\"y\": 38.00539535887911,\"z\": 0}}}},\"44dbda7c-e388-45e7-b44e-5476a19b2e22\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 344.7476392513547,\"y\": 12.21056878873036,\"z\": 0}}}},\"572f1acf-e133-4d71-a224-c7a501df333b\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 390.135850260932,\"y\": 8.101305115249284,\"z\": 0}}}},\"5e8ac5e2-45e8-44e3-a2c6-e73938dd3786\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 361.5389270832563,\"y\": 25.98458007870781,\"z\": 0}}}},\"79742c85-5bf4-4a69-841c-6a1cdb1105d2\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 369.4963765928838,\"y\": -12.53816855279884,\"z\": 0}}}},\"8352469e-63d8-40b1-832e-2a80ca25c115\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 393.644584623177,\"y\": -42.58447918945826,\"z\": 0}}}},\"9479028a-5493-4013-ba7d-afe3efcc510c\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 350.4380338380383,\"y\": -43.45910644740418,\"z\": 0}}}},\"f214bba6-94c1-410c-ad97-1d4a1b73f972\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 345.5482657571029,\"y\": -53.94524793665673,\"z\": 0}}}},\"f50de91b-a91e-4bf5-ab4f-aa227868255e\": {\"typeid\": \"autodesk.soliddef:point-1.0.0\",\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 362.9349306303061,\"y\": -49.28650512481138,\"z\": 0}}}}},\"autodesk.soliddef:line-1.0.0\": {\"07a052ff-e2c5-4b82-9199-15819cd83b5a\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.1288140461785663,\"y\": -0.2762426134887704,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 350.4380338380383,\"y\": -43.45910644740418,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 37.9598982098351},\"enum<Enum>\": {\"type\": 1}}}} ,\"132afa27-413f-43c5-9181-d723f4f02ebf\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.1288140461785656,\"y\": -0.2762426134887708,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 354.4678592713909,\"y\": 33.05564789057334,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 1.030352663106725e-13,\"high\": 75.45931758530203},\"enum<Enum>\": {\"type\": 1}}}} ,\"1add52ef-ff19-4649-a510-6ad0ebb533e6\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": 0.1999667920363069,\"y\": 0.2300354800519007,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 372.4222564781883,\"y\": -12.27585355076551,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -5.362534098358447e-15,\"high\": 88.5826771653542},\"enum<Enum>\": {\"type\": 1}}}} ,\"58bfc320-6979-452e-8031-69e3f10a822d\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.1748260977997985,\"y\": 0.249677543099285,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 393.644584623177,\"y\": -42.58447918945826,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 121.3910761154856},\"enum<Enum>\": {\"type\": 1}}}} ,\"63cca116-2b31-489a-b669-dbfe367a9ee0\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.2155261469056602,\"y\": -0.2155261469056592,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 373.5597423634276,\"y\": 38.00539535887912,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 2.009718347115228e-14,\"high\": 55.77427821522321},\"enum<Enum>\": {\"type\": 1}}}} ,\"6eeab57a-5226-4d24-93b8-547fb1f42c1b\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": 0.2762426134887704,\"y\": -0.1288140461785663,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 362.9349306303061,\"y\": -49.28650512481139,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -1.201153343517669e-14,\"high\": 45.93175853018365},\"enum<Enum>\": {\"type\": 1}}}} ,\"8e479c05-7bd2-4685-a601-dcc5f61f0d23\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.1477699722510827,\"y\": 0.2665840867360883,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 390.135850260932,\"y\": 8.101305115249287,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -6.21454679460525e-15,\"high\": 112.1750762011318},\"enum<Enum>\": {\"type\": 1}}}} ,\"99ab603f-d065-4f73-bb4d-de8c45fa7e5e\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.2155261469056592,\"y\": 0.2155261469056602,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 361.5389270832563,\"y\": 25.98458007870782,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -2.009718347115237e-14,\"high\": 32.80839895013121},\"enum<Enum>\": {\"type\": 1}}}} ,\"ce0b3253-2ee5-443c-af9f-c76b884166f7\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.27624261348877,\"y\": 0.1288140461785673,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 358.5948039213681,\"y\": -47.26267080307053,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 29.52755905511811},\"enum<Enum>\": {\"type\": 1}}}} ,\"d7025ca9-4365-4e23-8281-e4a0b115f2f1\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": 0.2944141918529081,\"y\": 0.07888804494724799,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 345.5482657571029,\"y\": -53.94524793665673,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 59.05511811023612},\"enum<Enum>\": {\"type\": 1}}}} ,\"e1fa27a7-c5cd-4a40-a2bc-58ec2940f488\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": 0.2155261469056593,\"y\": -0.21552614690566,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 344.7476392513547,\"y\": 12.21056878873036,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 114.8293963254593},\"enum<Enum>\": {\"type\": 1}}}} ,\"e8566b5e-c3ee-404e-937c-4d379fc3046e\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": 0.2496775430992851,\"y\": 0.1748260977997983,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 375.6232396488192,\"y\": -55.2031607891812,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -3.260404562019199e-14,\"high\": 72.17847769028857},\"enum<Enum>\": {\"type\": 1}}}} ,\"e8f77985-b949-4883-8994-05cf8a546022\": {\"typeid\": \"autodesk.soliddef:line-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"direction\": {\"Float64\": {\"x\": -0.09129688242138019,\"y\": -0.2908056382880784,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"position\": {\"Float64\": {\"x\": 369.4963765928838,\"y\": -12.53816855279884,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -1.355838804486046e-14,\"high\": 119.407940144107},\"enum<Enum>\": {\"type\": 1}}}} },\"autodesk.soliddef:plane-1.0.0\": {\"fd5df98a-eb44-42c5-ab83-241091c3ffc6\": {\"typeid\": \"autodesk.soliddef:plane-1.0.0\",\"autodesk.math:vector3d-1.0.0\": {\"normal\": {\"Float64\": {\"x\": 0,\"y\": 0,\"z\": 1}},\"uAxis\": {\"Float64\": {\"x\": 0.3048,\"y\": 0,\"z\": 0}}},\"autodesk.math:point3d-1.0.0\": {\"origin\": {\"Float64\": {\"x\": 344.7476392513545,\"y\": 12.2105687887304,\"z\": 0}}},\"autodesk.soliddef:paramrange-1.0.0\": {\"uRange\": {\"Float64\": {\"low\": 5.594824691024411e-13,\"high\": 160.4230491201524},\"enum<Enum>\": {\"type\": 1}},\"vRange\": {\"Float64\": {\"low\": -221.1736534708387,\"high\": 84.62869609628842},\"enum<Enum>\": {\"type\": 1}}}} }}}},\"map<autodesk.soliddef:basetopology-1.0.0>\": {\"topologies\": {\"insert\": {\"autodesk.soliddef:body-1.0.0\": {\"a161f58e-f6dd-40a5-be12-2194e479dfd0\": {\"typeid\": \"autodesk.soliddef:body-1.0.0\",\"array<String>\": {\"lumps\": {\"insert\": [[0,[\"b6e4f157-e7fc-4500-9dca-7813b2634b74\"]]]}}} },\"autodesk.soliddef:lump-1.0.0\": {\"b6e4f157-e7fc-4500-9dca-7813b2634b74\": {\"typeid\": \"autodesk.soliddef:lump-1.0.0\",\"array<String>\": {\"shells\": {\"insert\": [[0,[\"ae9f1b6a-8c34-4e4c-813d-547d734b6cd5\"]]]}}} },\"autodesk.soliddef:shell-1.0.0\": {\"ae9f1b6a-8c34-4e4c-813d-547d734b6cd5\": {\"typeid\": \"autodesk.soliddef:shell-1.0.0\",\"array<String>\": {\"faces\": {\"insert\": [[0,[\"e9498733-7ee4-46d0-a6d6-542aedecc3da\"]]]}}} },\"autodesk.soliddef:face-1.0.0\": {\"e9498733-7ee4-46d0-a6d6-542aedecc3da\": {\"typeid\": \"autodesk.soliddef:face-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"fd5df98a-eb44-42c5-ab83-241091c3ffc6\"},\"array<String>\": {\"loops\": {\"insert\": [[0,[\"b8e5af2c-5901-4312-a062-b046a698ab9e\"]]]}}} },\"autodesk.soliddef:loop-1.0.0\": {\"b8e5af2c-5901-4312-a062-b046a698ab9e\": {\"typeid\": \"autodesk.soliddef:loop-1.0.0\",\"array<String>\": {\"coedges\": {\"insert\": [[0,[\"160de00c-c04e-4985-bac8-a490139552ba\",\"2d320d78-d38a-42c4-a283-80bdf7d2e00d\",\"0f940b67-1840-4c07-920c-9f09d8e5ae27\",\"37ca8b29-6a9c-4108-b2f8-27d80dac7bec\",\"8c3a987a-3d51-4d80-bcdb-6754dc466c34\",\"11abbaef-e11c-4f2b-8842-60128c379ef5\",\"eb6c434b-50f8-49c8-af4e-79770e0bab97\",\"bded9544-1a9f-471b-b22f-1134be6f35dc\",\"d885ec37-6e3f-48b0-9149-799db6eff04e\",\"dfc61f0b-6aef-460d-8146-f6db61aaa9ed\",\"46327fcf-c517-42fa-8433-d60007e4e9af\",\"881787ba-e201-4bec-a1a2-5a17ad450b38\",\"21075a69-db86-477a-b1b3-32c3c7a9da05\"]]]}}} },\"autodesk.soliddef:coedge-1.0.0\": {\"0f940b67-1840-4c07-920c-9f09d8e5ae27\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"def241a3-9278-448e-9bb0-4147054ab18e\",\"partner\": \"\"}} ,\"11abbaef-e11c-4f2b-8842-60128c379ef5\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"07dfe709-6cd3-426a-8201-ebe377b3cf55\",\"partner\": \"\"}} ,\"160de00c-c04e-4985-bac8-a490139552ba\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"493eee5e-488b-4651-a2ad-9adb794e6073\",\"partner\": \"\"}} ,\"21075a69-db86-477a-b1b3-32c3c7a9da05\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"60a78017-2674-4351-8910-c3f75eff8edc\",\"partner\": \"\"}} ,\"2d320d78-d38a-42c4-a283-80bdf7d2e00d\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"219ad178-4ce6-4a98-b4a9-9c4177b7090f\",\"partner\": \"\"}} ,\"37ca8b29-6a9c-4108-b2f8-27d80dac7bec\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"badb6503-0a76-4085-a80f-8d4bea354cd4\",\"partner\": \"\"}} ,\"46327fcf-c517-42fa-8433-d60007e4e9af\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"49cce19f-6ae9-4931-b7b9-a81acfaf7288\",\"partner\": \"\"}} ,\"881787ba-e201-4bec-a1a2-5a17ad450b38\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"21e0f803-021a-428e-990b-dfc67d85ea8d\",\"partner\": \"\"}} ,\"8c3a987a-3d51-4d80-bcdb-6754dc466c34\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"21d7e9c7-87e2-4b3c-8956-30833468025d\",\"partner\": \"\"}} ,\"bded9544-1a9f-471b-b22f-1134be6f35dc\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"714b7a9b-1d45-42ad-8382-d0bbb39a47fd\",\"partner\": \"\"}} ,\"d885ec37-6e3f-48b0-9149-799db6eff04e\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"b6c28933-b76b-49cd-b8f2-707806a2291a\",\"partner\": \"\"}} ,\"dfc61f0b-6aef-460d-8146-f6db61aaa9ed\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"3ee11d39-8401-4d9a-906e-13335adb525d\",\"partner\": \"\"}} ,\"eb6c434b-50f8-49c8-af4e-79770e0bab97\": {\"typeid\": \"autodesk.soliddef:coedge-1.0.0\",\"Bool\": {\"reversed\": false},\"String\": {\"edge\": \"9120ee3b-83b3-4220-932f-5ecdb353e838\",\"partner\": \"\"}} },\"autodesk.soliddef:edge-1.0.0\": {\"07dfe709-6cd3-426a-8201-ebe377b3cf55\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"6eeab57a-5226-4d24-93b8-547fb1f42c1b\",\"vertex0\": \"29e26b57-00f6-4e41-9241-2d3d6390cafa\",\"vertex1\": \"7d3bc8f3-23f1-4d2b-92ca-f68154d48f55\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -1.201153343517669e-14,\"high\": 45.93175853018365},\"enum<Enum>\": {\"type\": 1}}}} ,\"219ad178-4ce6-4a98-b4a9-9c4177b7090f\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"e8f77985-b949-4883-8994-05cf8a546022\",\"vertex0\": \"d4dd6fa4-26f9-411f-818a-608f0f3db63e\",\"vertex1\": \"b26a8270-8872-44b0-abfa-4b737aa6517d\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -1.355838804486046e-14,\"high\": 119.407940144107},\"enum<Enum>\": {\"type\": 1}}}} ,\"21d7e9c7-87e2-4b3c-8956-30833468025d\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"d7025ca9-4365-4e23-8281-e4a0b115f2f1\",\"vertex0\": \"72aead5d-78e4-465b-bccc-9a1d4110c006\",\"vertex1\": \"29e26b57-00f6-4e41-9241-2d3d6390cafa\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 59.05511811023612},\"enum<Enum>\": {\"type\": 1}}}} ,\"21e0f803-021a-428e-990b-dfc67d85ea8d\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"99ab603f-d065-4f73-bb4d-de8c45fa7e5e\",\"vertex0\": \"38b828dc-eb2a-4c0f-872e-e81ac45f27e8\",\"vertex1\": \"d5a8b66e-1f24-47a8-812a-1f9bff1a47fd\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -2.009718347115237e-14,\"high\": 32.80839895013121},\"enum<Enum>\": {\"type\": 1}}}} ,\"3ee11d39-8401-4d9a-906e-13335adb525d\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"8e479c05-7bd2-4685-a601-dcc5f61f0d23\",\"vertex0\": \"c5a96c30-b226-432c-aaa4-26e73c41ed26\",\"vertex1\": \"1dba0dd1-9bef-4751-afe6-6bf14de9b010\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -6.21454679460525e-15,\"high\": 112.1750762011318},\"enum<Enum>\": {\"type\": 1}}}} ,\"493eee5e-488b-4651-a2ad-9adb794e6073\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"e1fa27a7-c5cd-4a40-a2bc-58ec2940f488\",\"vertex0\": \"888cf0b4-d0ba-4438-b18d-5cb7db3c6ee0\",\"vertex1\": \"d4dd6fa4-26f9-411f-818a-608f0f3db63e\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 114.8293963254593},\"enum<Enum>\": {\"type\": 1}}}} ,\"49cce19f-6ae9-4931-b7b9-a81acfaf7288\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"63cca116-2b31-489a-b669-dbfe367a9ee0\",\"vertex0\": \"1dba0dd1-9bef-4751-afe6-6bf14de9b010\",\"vertex1\": \"38b828dc-eb2a-4c0f-872e-e81ac45f27e8\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 2.009718347115228e-14,\"high\": 55.77427821522321},\"enum<Enum>\": {\"type\": 1}}}} ,\"60a78017-2674-4351-8910-c3f75eff8edc\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"132afa27-413f-43c5-9181-d723f4f02ebf\",\"vertex0\": \"d5a8b66e-1f24-47a8-812a-1f9bff1a47fd\",\"vertex1\": \"888cf0b4-d0ba-4438-b18d-5cb7db3c6ee0\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 1.030352663106725e-13,\"high\": 75.45931758530203},\"enum<Enum>\": {\"type\": 1}}}} ,\"714b7a9b-1d45-42ad-8382-d0bbb39a47fd\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"58bfc320-6979-452e-8031-69e3f10a822d\",\"vertex0\": \"3ae0babf-96c4-467a-8724-b94c0e50ce8a\",\"vertex1\": \"99f45ceb-9654-497f-bad8-52f66240f6fe\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 121.3910761154856},\"enum<Enum>\": {\"type\": 1}}}} ,\"9120ee3b-83b3-4220-932f-5ecdb353e838\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"e8566b5e-c3ee-404e-937c-4d379fc3046e\",\"vertex0\": \"7d3bc8f3-23f1-4d2b-92ca-f68154d48f55\",\"vertex1\": \"3ae0babf-96c4-467a-8724-b94c0e50ce8a\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -3.260404562019199e-14,\"high\": 72.17847769028857},\"enum<Enum>\": {\"type\": 1}}}} ,\"b6c28933-b76b-49cd-b8f2-707806a2291a\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"1add52ef-ff19-4649-a510-6ad0ebb533e6\",\"vertex0\": \"99f45ceb-9654-497f-bad8-52f66240f6fe\",\"vertex1\": \"c5a96c30-b226-432c-aaa4-26e73c41ed26\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": -5.362534098358447e-15,\"high\": 88.5826771653542},\"enum<Enum>\": {\"type\": 1}}}} ,\"badb6503-0a76-4085-a80f-8d4bea354cd4\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"07a052ff-e2c5-4b82-9199-15819cd83b5a\",\"vertex0\": \"e234d341-f6c7-41b6-ae61-ecad76c3b909\",\"vertex1\": \"72aead5d-78e4-465b-bccc-9a1d4110c006\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 37.9598982098351},\"enum<Enum>\": {\"type\": 1}}}} ,\"def241a3-9278-448e-9bb0-4147054ab18e\": {\"typeid\": \"autodesk.soliddef:edge-1.0.0\",\"Float64\": {\"precision\": 0},\"Bool\": {\"reversed\": false},\"String\": {\"geometry\": \"ce0b3253-2ee5-443c-af9f-c76b884166f7\",\"vertex0\": \"b26a8270-8872-44b0-abfa-4b737aa6517d\",\"vertex1\": \"e234d341-f6c7-41b6-ae61-ecad76c3b909\"},\"autodesk.soliddef:paramrange-1.0.0\": {\"range\": {\"Float64\": {\"low\": 0,\"high\": 29.52755905511811},\"enum<Enum>\": {\"type\": 1}}}} },\"autodesk.soliddef:vertex-1.0.0\": {\"1dba0dd1-9bef-4751-afe6-6bf14de9b010\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"36817409-6d86-4e7c-a9c3-34df4b56f660\"}} ,\"29e26b57-00f6-4e41-9241-2d3d6390cafa\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"f50de91b-a91e-4bf5-ab4f-aa227868255e\"}} ,\"38b828dc-eb2a-4c0f-872e-e81ac45f27e8\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"5e8ac5e2-45e8-44e3-a2c6-e73938dd3786\"}} ,\"3ae0babf-96c4-467a-8724-b94c0e50ce8a\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"8352469e-63d8-40b1-832e-2a80ca25c115\"}} ,\"72aead5d-78e4-465b-bccc-9a1d4110c006\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"f214bba6-94c1-410c-ad97-1d4a1b73f972\"}} ,\"7d3bc8f3-23f1-4d2b-92ca-f68154d48f55\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"14c41e03-f07a-4a84-95c6-6a90e64ecd1b\"}} ,\"888cf0b4-d0ba-4438-b18d-5cb7db3c6ee0\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"44dbda7c-e388-45e7-b44e-5476a19b2e22\"}} ,\"99f45ceb-9654-497f-bad8-52f66240f6fe\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"0cceeb03-6915-454c-94f0-2bf79cb9c1ef\"}} ,\"b26a8270-8872-44b0-abfa-4b737aa6517d\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"05f3c48f-48c0-43fc-aefc-510b6cd38115\"}} ,\"c5a96c30-b226-432c-aaa4-26e73c41ed26\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"572f1acf-e133-4d71-a224-c7a501df333b\"}} ,\"d4dd6fa4-26f9-411f-818a-608f0f3db63e\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"79742c85-5bf4-4a69-841c-6a1cdb1105d2\"}} ,\"d5a8b66e-1f24-47a8-812a-1f9bff1a47fd\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"08f039de-5de3-4614-a8be-1ef63f45aa7b\"}} ,\"e234d341-f6c7-41b6-ae61-ecad76c3b909\": {\"typeid\": \"autodesk.soliddef:vertex-1.0.0\",\"Float64\": {\"precision\": 0},\"String\": {\"geometry\": \"9479028a-5493-4013-ba7d-afe3efcc510c\"}} }}}}} "

Edited that post to make the Jason string a bit easier.

When you offset this in such a way as to generate multiple polycurves, are you not retrieving them as such? I guess I am lost by the difference between what the OOTB node and the desired output is in terms of the data.

Thanks for the guidance Jacob.
Here is the solution.

/// <summary>
/// Create planar offset polycurve edges from a surface and fillet the corners if required.
/// </summary>
/// <param name="surface">The surface input.</param>
/// <param name="offsetDistance">The perimeter offset distance.</param>
/// <param name="concaveFillet">The fillet radius at the concave corner.</param>
/// <param name="convexFillet">The fillet radius at the convex corner.</param>
/// <returns>The offset surface polycurves.</returns>
/// <exception cref="Exception"></exception>
public static List<PolyCurve> CreateOffsetSurfaceEdges(
    Surface surface, 
    float offsetDistance, 
    float concaveFillet = 0, 
    float convexFillet = 0)
{
    // Check if the surface is planar and horizontal.
    Surface _surface = CheckSurfacePlanarity(surface);

    // Get the surface perimeter curve.
    PolyCurve perimeterCurve = SurfacePerimeter(_surface);

    // offset the perimeter curve.
    Curve[] offsetCurves = perimeterCurve.OffsetMany(offsetDistance, SurfacePlane(_surface).Normal);

    // Offset the perimeter curve.
    List<PolyCurve> joinedCurves = new List<PolyCurve>();
    try
    {
        // Check if the area of the offset curve is greater than that of the original surface.
        foreach (Curve curve in offsetCurves)
        {
            if (Surface.ByPatch(curve).Area > _surface.Area)
            {
                Curve[] offsetCurvesAlt = perimeterCurve.OffsetMany(-offsetDistance, SurfacePlane(surface).Normal);
                foreach (Curve curveAlt in offsetCurvesAlt)
                {
                    joinedCurves.Add(curveAlt as PolyCurve);
                }
            }
            else
            {
                joinedCurves.Add(curve as PolyCurve);
            }
        }
    }
    catch 
    {
        throw new Exception("The surface cannot be offset. Reduce the offset distance.");
    }
    // Round the concave corners of the offset curves.
    List<PolyCurve> concaveRoundedCurves = new List<PolyCurve>();
    foreach (PolyCurve curve in joinedCurves)
    {
        if (concaveFillet > 0)
        {
            try
            {
                concaveRoundedCurves.Add(curve.Fillet(concaveFillet, false));
            }
            catch
            {
                concaveRoundedCurves.Add(curve);
            }
        }
        else
        {
            concaveRoundedCurves.Add(curve);
        }
    }

    // Round the convex corners of the concave rounded curves.
    List<PolyCurve> convexRoundedCurves = new List<PolyCurve>();
    foreach (PolyCurve curve in concaveRoundedCurves)
    {
        if (convexFillet > 0)
        {
            try
            {
                convexRoundedCurves.Add(curve.Fillet(convexFillet, true));
            }
            catch
            {
                convexRoundedCurves.Add(curve);
            }
        }
        else
        {
            convexRoundedCurves.Add(curve);
        }
    }

    return convexRoundedCurves;
}
1 Like