<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 回复： Create Spline from multiple line, curve, arc segments in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13203208#M1836</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5311905"&gt;@dwightduronidavy&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;in revit 2024 dont have NurbSpline with two arguments .&lt;/P&gt;
&lt;P&gt;you can read this website and try again .&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A title="NurbSpline Members" href="https://www.revitapidocs.com/2024/7602714c-85c5-d3ba-e824-8f57590a59c8.htm" target="_blank" rel="noopener"&gt;NurbSpline Members&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scgq425_0-1733836352747.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1444070i00D1FFD3ACE0E059/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scgq425_0-1733836352747.png" alt="scgq425_0-1733836352747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2024 13:12:33 GMT</pubDate>
    <dc:creator>scgq425</dc:creator>
    <dc:date>2024-12-10T13:12:33Z</dc:date>
    <item>
      <title>Create Spline from multiple line, curve, arc segments</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13202924#M1835</link>
      <description>&lt;P&gt;Dear all,&lt;BR /&gt;&lt;BR /&gt;I am currently working on the below Revit 2024 macro which does the following:&lt;BR /&gt;&lt;BR /&gt;1. prompt user to select multiple lines and or curve and or arcs&lt;BR /&gt;2. convert combined segments into a Spline&lt;BR /&gt;&lt;BR /&gt;However, it keeps generating the following error:&lt;BR /&gt;No overload for method 'Create' takes 2 arguments (CS1501) - C:\ProgramData\Autodesk\Revit\Macros\2024\Revit\AppHookup\CreateSplineFromMultipleSegments\Source\CreateSplineFromMultipleSegments\ThisApplication.cs:74,41&lt;BR /&gt;&lt;BR /&gt;Any help would be very much appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;MACRO:&lt;/P&gt;&lt;P&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using Autodesk.Revit.UI;&lt;BR /&gt;using Autodesk.Revit.DB;&lt;BR /&gt;using Autodesk.Revit.UI.Selection;&lt;/P&gt;&lt;P&gt;namespace CreateSplineFromMultipleSegments&lt;BR /&gt;{&lt;BR /&gt;[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;[Autodesk.Revit.DB.Macros.AddInId("055979FA-2219-4A0B-A529-E8C0885531D5")]&lt;BR /&gt;public partial class ThisApplication&lt;BR /&gt;{&lt;BR /&gt;private void Module_Startup(object sender, EventArgs e) { }&lt;/P&gt;&lt;P&gt;private void Module_Shutdown(object sender, EventArgs e) { }&lt;/P&gt;&lt;P&gt;#region Revit Macros generated code&lt;BR /&gt;private void InternalStartup()&lt;BR /&gt;{&lt;BR /&gt;this.Startup += new System.EventHandler(Module_Startup);&lt;BR /&gt;this.Shutdown += new System.EventHandler(Module_Shutdown);&lt;BR /&gt;}&lt;BR /&gt;#endregion&lt;/P&gt;&lt;P&gt;public void CreateSpline()&lt;BR /&gt;{&lt;BR /&gt;UIDocument uidoc = this.ActiveUIDocument;&lt;BR /&gt;Document doc = uidoc.Document;&lt;BR /&gt;Selection sel = uidoc.Selection;&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;{&lt;BR /&gt;// Prompt user to select multiple elements&lt;BR /&gt;IList&amp;lt;Reference&amp;gt; selectedElements = sel.PickObjects(ObjectType.Element, "Select multiple segments (lines, arcs, splines).");&lt;BR /&gt;if (selectedElements == null || selectedElements.Count == 0)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Error", "No elements selected.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Collect all the points from the selected elements&lt;BR /&gt;List&amp;lt;XYZ&amp;gt; points = new List&amp;lt;XYZ&amp;gt;();&lt;/P&gt;&lt;P&gt;foreach (Reference reference in selectedElements)&lt;BR /&gt;{&lt;BR /&gt;Element element = doc.GetElement(reference);&lt;BR /&gt;LocationCurve locationCurve = element.Location as LocationCurve;&lt;/P&gt;&lt;P&gt;if (locationCurve != null)&lt;BR /&gt;{&lt;BR /&gt;Curve curve = locationCurve.Curve;&lt;BR /&gt;if (curve != null)&lt;BR /&gt;{&lt;BR /&gt;points.Add(curve.GetEndPoint(0));&lt;BR /&gt;points.Add(curve.GetEndPoint(1));&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Ensure unique points and maintain order&lt;BR /&gt;points = RemoveDuplicatePoints(points);&lt;/P&gt;&lt;P&gt;if (points.Count &amp;lt; 2)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Error", "Not enough points to create a spline. At least two unique points are required.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Create the spline from the collected points&lt;BR /&gt;using (Transaction tx = new Transaction(doc, "Create Spline"))&lt;BR /&gt;{&lt;BR /&gt;tx.Start();&lt;/P&gt;&lt;P&gt;NurbSpline spline = NurbSpline.Create(points, false);&lt;BR /&gt;SketchPlane sketchPlane = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, XYZ.Zero));&lt;BR /&gt;ModelCurve modelCurve = doc.Create.NewModelCurve(spline, sketchPlane);&lt;/P&gt;&lt;P&gt;tx.Commit();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;TaskDialog.Show("Success", String.Format("Spline created successfully from {0} segments.", selectedElements.Count));&lt;BR /&gt;}&lt;BR /&gt;catch (Autodesk.Revit.Exceptions.OperationCanceledException)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Cancelled", "Operation cancelled by the user.");&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Error", String.Format("An error occurred: {0}", ex.Message));&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private List&amp;lt;XYZ&amp;gt; RemoveDuplicatePoints(List&amp;lt;XYZ&amp;gt; points)&lt;BR /&gt;{&lt;BR /&gt;List&amp;lt;XYZ&amp;gt; uniquePoints = new List&amp;lt;XYZ&amp;gt;();&lt;/P&gt;&lt;P&gt;foreach (XYZ point in points)&lt;BR /&gt;{&lt;BR /&gt;if (!uniquePoints.Exists(p =&amp;gt; p.IsAlmostEqualTo(point)))&lt;BR /&gt;{&lt;BR /&gt;uniquePoints.Add(point);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return uniquePoints;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 09:45:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13202924#M1835</guid>
      <dc:creator>dwightduronidavy</dc:creator>
      <dc:date>2024-12-10T09:45:27Z</dc:date>
    </item>
    <item>
      <title>回复： Create Spline from multiple line, curve, arc segments</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13203208#M1836</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5311905"&gt;@dwightduronidavy&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;in revit 2024 dont have NurbSpline with two arguments .&lt;/P&gt;
&lt;P&gt;you can read this website and try again .&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A title="NurbSpline Members" href="https://www.revitapidocs.com/2024/7602714c-85c5-d3ba-e824-8f57590a59c8.htm" target="_blank" rel="noopener"&gt;NurbSpline Members&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scgq425_0-1733836352747.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1444070i00D1FFD3ACE0E059/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scgq425_0-1733836352747.png" alt="scgq425_0-1733836352747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 13:12:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13203208#M1836</guid>
      <dc:creator>scgq425</dc:creator>
      <dc:date>2024-12-10T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create Spline from multiple line, curve, arc segments</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13203318#M1837</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7278275"&gt;@scgq425&lt;/a&gt;&amp;nbsp;, will do some research&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 14:17:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-spline-from-multiple-line-curve-arc-segments/m-p/13203318#M1837</guid>
      <dc:creator>dwightduronidavy</dc:creator>
      <dc:date>2024-12-10T14:17:03Z</dc:date>
    </item>
  </channel>
</rss>

