<?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 Re: Is there any api available to split a duct programmatically? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6936618#M59841</link>
    <description>&lt;P&gt;Hi @Anonymous,&lt;/P&gt;
&lt;P&gt;The familyinstance needs rotating&amp;nbsp;in the same orientation as the duct curve.&lt;/P&gt;
&lt;P&gt;I'm sure there are plenty of examples of how to rotate family instances on this forum. Report back with how you get on!&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2017 09:45:27 GMT</pubDate>
    <dc:creator>matthew_taylor</dc:creator>
    <dc:date>2017-03-10T09:45:27Z</dc:date>
    <item>
      <title>Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6926621#M59830</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need to know can we split a duct programmatically ? Is there any API available to do so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I searched in&amp;nbsp;some old articles and it seems Revit doesn't provide any API for the &lt;STRONG&gt;split&lt;/STRONG&gt; function. But I am hoping if they&amp;nbsp;have added this in &lt;STRONG&gt;2017&lt;/STRONG&gt; edition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Any other ideas to achieve this will be highly appreciated.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 14:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6926621#M59830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-07T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6926971#M59831</link>
      <description>&lt;P&gt;Hello @Anonymous,&lt;/P&gt;
&lt;P&gt;See my comment in this post: &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/duct-splitting/m-p/6784012/highlight/true#M20243" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/duct-splitting/m-p/6784012/highlight/true#M20243&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 16:25:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6926971#M59831</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-07T16:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929020#M59832</link>
      <description>&lt;P&gt;Thanks Matthew&amp;nbsp;&lt;SPAN&gt;for replying. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried using the BreakCurve method for splitting a duct but&amp;nbsp;it throws error at the time of execution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can you please guide me on how to pass the third parameter i.e. XYZ ptBreak ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BreakCurveIssue.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/330509iBF7373BFFE3C4D87/image-size/large?v=v2&amp;amp;px=999" role="button" title="BreakCurveIssue.jpg" alt="BreakCurveIssue.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Saurabh&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 08:55:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929020#M59832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-08T08:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929188#M59833</link>
      <description>&lt;P&gt;Hi @Anonymous,&lt;/P&gt;
&lt;P&gt;No problem.&lt;/P&gt;
&lt;P&gt;Well, I think the error says it all! The point isn't on the duct curve.&lt;/P&gt;
&lt;P&gt;Here's a simple example that breaks a duct 2 feet along its length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;Transaction(TransactionMode.Manual)&amp;gt; _
&amp;lt;Regeneration(RegenerationOption.Manual)&amp;gt; _
&amp;lt;Journaling(JournalingMode.UsingCommandData)&amp;gt; _
Public Class TransactionCommand
    Implements UI.IExternalCommand
    Public Function Execute(ByVal commandData As UI.ExternalCommandData, ByRef message As String, ByVal elements As DB.ElementSet) As UI.Result Implements UI.IExternalCommand.Execute
        Dim app As ApplicationServices.Application = commandData.Application.Application
        Dim doc As DB.Document = commandData.Application.ActiveUIDocument.Document
        Dim docUi As UI.UIDocument = commandData.Application.ActiveUIDocument

        Execute = UI.Result.Failed
        Using transaction As New DB.Transaction(doc, "Break Duct")
            transaction.Start()
            Dim duct As DB.Mechanical.Duct = TryCast(doc.GetElement(New DB.ElementId(1789723)), DB.Mechanical.Duct)
            Dim curve As DB.Curve = TryCast(duct.Location, DB.LocationCurve).Curve
            Dim pt0 As DB.XYZ = curve.GetEndPoint(0)
            Dim pt1 As DB.XYZ = curve.GetEndPoint(1)
            Dim vector As DB.XYZ = pt1.Subtract(pt0).Normalize
            Dim breakPt As DB.XYZ = pt0.Add(vector.Multiply(2.0))
            Dim newDuctId As DB.ElementId = DB.Mechanical.MechanicalUtils.BreakCurve(doc, duct.Id, breakPt)
            transaction.Commit()
            ' change our result to successful
            Execute = UI.Result.Succeeded
        End Using
        Return Execute
    End Function
End Class&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2017 09:54:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929188#M59833</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-08T09:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929954#M59834</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you so much Matthew&lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It worked pleasantly. &amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It will be great favor if you can help me in achieving my requirement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Normally, if we split an duct from UI itself, then it adds an family instance i.e. duct between the two separated elements.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But by using the BreakCurve method it breaks the element into two parts at specified length which is really good, But I also need a specific family instance i.e. duct&amp;nbsp;to be added between the two elements, just like we do from UI in Revit application.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splittingDuct.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/330662i55162B86049C339C/image-size/large?v=v2&amp;amp;px=999" role="button" title="splittingDuct.jpg" alt="splittingDuct.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Saurabh&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:00:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929954#M59834</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-08T14:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929993#M59835</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous,&lt;/P&gt;
&lt;P&gt;You're welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, you probably need to break the duct in two places.&lt;/P&gt;
&lt;P&gt;You have the elementIds of the two ducts after one break, you just need to use one of those in your second break.&lt;/P&gt;
&lt;P&gt;The second break would have to be enclosed in a second transaction.&lt;/P&gt;
&lt;P&gt;Once you have the 3rd elementId, you can get its duct element and use duct.ChangeTypeId to change the type should you desire it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 14:07:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6929993#M59835</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-08T14:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6930306#M59836</link>
      <description>&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doubtful if you are understanding my requirement or not..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The screenshot which i sent in the previous reply was what i need to achieve as final output. that was done manually from Revit Application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and, below is what the BreakCurve method does:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AfterUsingBreakCurve.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/330703i6F20DFC602FFBEBC/image-size/large?v=v2&amp;amp;px=999" role="button" title="AfterUsingBreakCurve.jpg" alt="AfterUsingBreakCurve.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I add a duct between the two child elements, which will act as a separation point?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh Dhir&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 15:08:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6930306#M59836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-08T15:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6930442#M59837</link>
      <description>&lt;P&gt;@Anonymous,&lt;/P&gt;
&lt;P&gt;You have not enlightened me.&lt;/P&gt;
&lt;P&gt;Perhaps a before and after shot (in 3D?) would be beneficial.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 15:28:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6930442#M59837</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-08T15:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6933307#M59838</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sorry for the confusion. I am not good at explaining. But still trying&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Below are some screenshots&amp;nbsp;for before and after case when splinting an element via application&amp;nbsp;and via api, both:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BEFORE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BeforeFromUI.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331109iFAD9C59BFC424B20/image-size/large?v=v2&amp;amp;px=999" role="button" title="BeforeFromUI.jpg" alt="BeforeFromUI.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AFTER&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. WHEN SPLITTING MANUALLY VIA APPLICATION UI:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a. Here you can see&amp;nbsp;3 elements. two are child elements&amp;nbsp;that was created after splitting the parent element and 3rd one is the duct which act as a separation point between those two.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AfterUsingSplitFromUI.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331123i710BE4C8176981AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="AfterUsingSplitFromUI.jpg" alt="AfterUsingSplitFromUI.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b. Here&amp;nbsp;you can see the duct which was added when split occurred:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ManualSplit.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331110i05B824FD816F0AD2/image-size/large?v=v2&amp;amp;px=999" role="button" title="ManualSplit.jpg" alt="ManualSplit.jpg" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. WHEN SPLITTING USING API (Via BreakCurve() method):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AfterUsingBreakCurve (2).jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331115iE41CA0217A2BC213/image-size/large?v=v2&amp;amp;px=999" role="button" title="AfterUsingBreakCurve (2).jpg" alt="AfterUsingBreakCurve (2).jpg" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So, here i need a duct to be added between those two elements, just like i did using the split button from application.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I am going in the right direction to explain my requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Saurabh Dhir&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 08:53:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6933307#M59838</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-09T08:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6933445#M59839</link>
      <description>&lt;P&gt;Hi @Anonymous,&lt;/P&gt;
&lt;P&gt;Riiiiiiiight. You need to add a union fitting. That's not a duct; it's a duct fitting, and a familyInstance.&lt;/P&gt;
&lt;P&gt;All else fails, describe the elements using the Revit descriptions, or the RevitLookup (API) names. That way it's obvious. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I originally used two transactions, but it appears a regen will do the trick:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;Transaction(TransactionMode.Manual)&amp;gt; _
&amp;lt;Regeneration(RegenerationOption.Manual)&amp;gt; _
&amp;lt;Journaling(JournalingMode.UsingCommandData)&amp;gt; _
Public Class TransactionCommand
    Implements UI.IExternalCommand
    Public Function Execute(ByVal commandData As UI.ExternalCommandData, ByRef message As String, ByVal elements As DB.ElementSet) As UI.Result Implements UI.IExternalCommand.Execute
        Dim app As ApplicationServices.Application = commandData.Application.Application
        Dim doc As DB.Document = commandData.Application.ActiveUIDocument.Document
        Dim docUi As UI.UIDocument = commandData.Application.ActiveUIDocument

        Execute = UI.Result.Failed
        Dim newDuctId As DB.ElementId = Nothing
        Dim ductOrig As DB.Mechanical.Duct = Nothing
        Dim duct2 As DB.Mechanical.Duct = Nothing
        Dim breakPt As DB.XYZ = Nothing
        Using transaction As New DB.Transaction(doc, "Break Duct + Add Fitting")
            transaction.Start()
            ductOrig = TryCast(doc.GetElement(New DB.ElementId(1789660)), DB.Mechanical.Duct)
            Dim curve As DB.Curve = TryCast(ductOrig.Location, DB.LocationCurve).Curve
            Dim pt0 As DB.XYZ = curve.GetEndPoint(0)
            Dim pt1 As DB.XYZ = curve.GetEndPoint(1)
            Dim vector As DB.XYZ = pt1.Subtract(pt0).Normalize
            breakPt = pt0.Add(vector.Multiply(2.0))
            newDuctId = DB.Mechanical.MechanicalUtils.BreakCurve(doc, ductOrig.Id, breakPt)
            duct2 = TryCast(doc.GetElement(newDuctId), DB.Mechanical.Duct)
            doc.Regenerate()
            Dim connectorOrig As DB.Connector = ductOrig.ConnectorManager.Lookup(0)
            Dim connector1 As DB.Connector = duct2.ConnectorManager.Lookup(1)
            Dim familySymbol As DB.FamilySymbol = TryCast(doc.GetElement(New DB.ElementId(755396)), DB.FamilySymbol)
            Dim famInstance As DB.FamilyInstance = doc.Create.NewFamilyInstance(breakPt, familySymbol, DB.Structure.StructuralType.NonStructural)
            Dim fitting As DB.MEPModel = famInstance.MEPModel
            Dim fittingConnector0 As DB.Connector = fitting.ConnectorManager.Lookup(0)
            Dim fittingConnector1 As DB.Connector = fitting.ConnectorManager.Lookup(1)

            connectorOrig.ConnectTo(fittingConnector1)
            connector1.ConnectTo(fittingConnector0)
            transaction.Commit()
            ' change our result to successful
            Return UI.Result.Succeeded
        End Using
        Return Execute
    End Function
End Class&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Mar 2017 09:46:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6933445#M59839</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-09T09:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6936593#M59840</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your assistance.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works great.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yet, I have another issue. This method only works well if we are not modifying the element's orientation.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tested this on a duct. I first added a duct and implemented the method just after placing an instance of that duct and it worked great.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But, If I rotate the element to its opposite direction and then implementing that methods throws multiple errors.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you have any idea how to resolve these.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Instructions to reproduce the issue:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Step-1-AddedDuct.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331673i0156A8142B9F8E8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Step-1-AddedDuct.jpg" alt="Step-1-AddedDuct.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Step-2-RotateDuct.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331674i508A317CFAA449FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Step-2-RotateDuct.jpg" alt="Step-2-RotateDuct.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SplitError.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331672i39EE5F571D79755B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SplitError.jpg" alt="SplitError.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh Dhir&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 09:25:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6936593#M59840</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-10T09:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6936618#M59841</link>
      <description>&lt;P&gt;Hi @Anonymous,&lt;/P&gt;
&lt;P&gt;The familyinstance needs rotating&amp;nbsp;in the same orientation as the duct curve.&lt;/P&gt;
&lt;P&gt;I'm sure there are plenty of examples of how to rotate family instances on this forum. Report back with how you get on!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 09:45:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6936618#M59841</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-10T09:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6952865#M59842</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I searched but haven't got much on how to adjust(rotate) the duct fitting as per element's direction/shape. I just tried the rotate method that just rotates the new instance(duct fitting) to 180 degree angle. So this case only works if i have rotated the element to 180 degree angle (opposite direction). But not in other cases.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please assist?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splitissue.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/334256i82BC9344A125AE12/image-size/large?v=v2&amp;amp;px=999" role="button" title="splitissue.jpg" alt="splitissue.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Saurabh Dhir&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 08:52:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6952865#M59842</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-17T08:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6975175#M59843</link>
      <description>&lt;P&gt;Hi @Anonymous,&lt;/P&gt;
&lt;P&gt;Did you get this sorted out yet?&lt;/P&gt;
&lt;P&gt;@Anonymous&amp;nbsp;has an example of this in his repo:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/akseidel/WTA_FireP/blob/feb6cff675a2143fffb55e65dd95eb9a73b9c553/WTA_FireP/PlunkOClass.cs" target="_blank"&gt;https://github.com/akseidel/WTA_FireP/blob/feb6cff675a2143fffb55e65dd95eb9a73b9c553/WTA_FireP/PlunkOClass.cs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 10:54:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6975175#M59843</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-03-27T10:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6986948#M59844</link>
      <description>&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked the link.&lt;/P&gt;&lt;P&gt;There are lots of methods.&lt;/P&gt;&lt;P&gt;Not sure which one to choose.I tried implementing few of them but there are many undefined/unknown classes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please show me a&amp;nbsp;precise way to get the resolution ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh Dhir&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 11:38:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6986948#M59844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-31T11:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6989444#M59845</link>
      <description>&lt;P&gt;no need for the rotation , you can place the duct fitting with the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim famInstance As DB.FamilyInstance = doc.Create.NewFamilyInstance(breakPt, familySymbol,&amp;nbsp;vector, null, &amp;nbsp;DB.Structure.StructuralType.NonStructural)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ofcourse it can't hurt to&amp;nbsp;learn how to rotate an element.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2017 20:54:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/6989444#M59845</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-04-01T20:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/7037096#M59846</link>
      <description>&lt;P&gt;Thank you so much,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked pleasantly&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Saurabh Dhir&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 07:36:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/7037096#M59846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-24T07:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any api available to split a duct programmatically?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/9382824#M59847</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/98018"&gt;@matthew_taylor&lt;/a&gt;&amp;nbsp;Thank you very much for this brilliant, very patient and comprehensive tutorial, and for pointing it out again in the recent comment on The Building Coder. Preserved for posterity and better readability now in the blog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2020/03/splitting-a-duct-in-more-depth.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2020/03/splitting-a-duct-in-more-depth.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 15:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-there-any-api-available-to-split-a-duct-programmatically/m-p/9382824#M59847</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-03-17T15:57:32Z</dc:date>
    </item>
  </channel>
</rss>

