<?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: Using dynamo to divide parts in more than one plane in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11006447#M20297</link>
    <description>&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created the following the script (using other forum threads as guidance)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# Converting dynamo to revit
elements = UnwrapElement(IN[0])
sketchPlane = UnwrapElement(IN[1])
divisionLines = [l.ToRevitType(True) for l in IN[2]]

# Collecting input for divideparts method
elementList = List[ElementId]()
for i in elements:
	elementList.Add(i.Id)
intersectionElementsIds = List[ElementId]()
curveArray = List[Curve](divisionLines)

# Opening transaction and executing method
TransactionManager.Instance.EnsureInTransaction(doc)

partDivide = PartUtils.DivideParts(doc, elementList, intersectionElementsIds, curveArray, sketchPlane.Id)

TransactionManager.Instance.TransactionTaskDone()

# Trying to retrieve the new parts created by the method
newParts = PartUtils.GetAssociatedParts(doc, partDivide.Id, 1, 1)

OUT = newParts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea was to first divide the elements in the XY plane, then the XZ plane and at last the YZ plane. To do this, I figured I could collect all the parts in the document after executing the DivideParts method. However, as seen in the screenshot, the GetAssociatedParts method only returns an empty list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="s193801T3FQ5_0-1647357914171.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1036579i7B739A1C91D5BD13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="s193801T3FQ5_0-1647357914171.png" alt="s193801T3FQ5_0-1647357914171.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to fix this? Or perhaps execute all three divisons in a single transaction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2022 15:26:10 GMT</pubDate>
    <dc:creator>s193801T3FQ5</dc:creator>
    <dc:date>2022-03-15T15:26:10Z</dc:date>
    <item>
      <title>Using dynamo to divide parts in more than one plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/10998291#M20295</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The following is a sample containing simple walls and floors. The blue cuboid is a Mass I wish to use to "cut up" the Walls and Floors that intersect the edges of the Mass, i.e. determine the volume of the elements contained within the Mass.&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="s193801T3FQ5_0-1646747619246.png" style="width: 591px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1035032iFC0EF23019055E43/image-size/large?v=v2&amp;amp;px=999" role="button" title="s193801T3FQ5_0-1646747619246.png" alt="s193801T3FQ5_0-1646747619246.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As can be seen in the picture, it works when dividing along the vertical planes. However, for it to work perfectly, one more division would have to be created parallel to the two horizontal planes of the Mass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect that my final goal is not doable within Dynamo due to lack of workplane controls. Would this be possible using the API?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 07:16:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/10998291#M20295</guid>
      <dc:creator>s193801T3FQ5</dc:creator>
      <dc:date>2022-03-11T07:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using dynamo to divide parts in more than one plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11002044#M20296</link>
      <description>&lt;P&gt;Dynamo provides the exact same functionality as the Revit API.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In both cases, the first step is always to research how to address this task manually in the end user interface.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please be aware that the Revit API and hence also Dynamo generally only supports functionality that is also available in the end user interface.&amp;nbsp;Therefore, if the UI does not support this, the API will probably not do so either.&amp;nbsp;So, it will always help to research the optimal manual approach to a solution first, before attacking the task programmatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2022 16:38:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11002044#M20296</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-03-13T16:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using dynamo to divide parts in more than one plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11006447#M20297</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created the following the script (using other forum threads as guidance)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# Converting dynamo to revit
elements = UnwrapElement(IN[0])
sketchPlane = UnwrapElement(IN[1])
divisionLines = [l.ToRevitType(True) for l in IN[2]]

# Collecting input for divideparts method
elementList = List[ElementId]()
for i in elements:
	elementList.Add(i.Id)
intersectionElementsIds = List[ElementId]()
curveArray = List[Curve](divisionLines)

# Opening transaction and executing method
TransactionManager.Instance.EnsureInTransaction(doc)

partDivide = PartUtils.DivideParts(doc, elementList, intersectionElementsIds, curveArray, sketchPlane.Id)

TransactionManager.Instance.TransactionTaskDone()

# Trying to retrieve the new parts created by the method
newParts = PartUtils.GetAssociatedParts(doc, partDivide.Id, 1, 1)

OUT = newParts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea was to first divide the elements in the XY plane, then the XZ plane and at last the YZ plane. To do this, I figured I could collect all the parts in the document after executing the DivideParts method. However, as seen in the screenshot, the GetAssociatedParts method only returns an empty list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="s193801T3FQ5_0-1647357914171.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1036579i7B739A1C91D5BD13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="s193801T3FQ5_0-1647357914171.png" alt="s193801T3FQ5_0-1647357914171.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to fix this? Or perhaps execute all three divisons in a single transaction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 15:26:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11006447#M20297</guid>
      <dc:creator>s193801T3FQ5</dc:creator>
      <dc:date>2022-03-15T15:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using dynamo to divide parts in more than one plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11007309#M20298</link>
      <description>&lt;P&gt;Can't say I know too much about what you're doing here specifically, but I think GetAssociatedParts is looking for the ID of the original element that is being split, not the ID of the PartMaker created by DivideParts. Try putting in the starting element's ID instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeremy has a fantastic blog that might be able to help you out as well.&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2012/09/parts-assemblies-partutils-and-divideparts.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2012/09/parts-assemblies-partutils-and-divideparts.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 21:19:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/using-dynamo-to-divide-parts-in-more-than-one-plane/m-p/11007309#M20298</guid>
      <dc:creator>stewart_skyler</dc:creator>
      <dc:date>2022-03-15T21:19:39Z</dc:date>
    </item>
  </channel>
</rss>

