Dividing existing parts with dynamo

I’ve been reading and studying the post dividing parts with dynamo
As I am new to python, i’m unsure on what to amend so that it divides the internal part of the wall not the entire wall.

Additionally… I also need to then split the result horizontally (Forming panels)

Any help would be appreciated.

Thank you.

1 Like

Below is the original script which I subsequently tweaked to selected the already generated part.

Tweaked script.

The embedded python script is where I’m stuck (Python newbie)

  1. import clr
  2. clr.AddReference(‘RevitAPI’)

  3. from Autodesk.Revit.DB import *

  4. clr.AddReference(‘System’)

  5. from System.Collections.Generic import List

  6. clr.AddReference(‘RevitNodes’)

  7. import Revit

  8. clr.ImportExtensions(Revit.GeometryConversion)

  9. clr.ImportExtensions(Revit.Elements)

  10. clr.AddReference(‘RevitServices’)

  11. import RevitServices

  12. from RevitServices.Persistence import DocumentManager

  13. from RevitServices.Transactions import TransactionManager

  14. doc = DocumentManager.Instance.CurrentDBDocument

  15. #Preparing input from dynamo to revit

  16. wall = UnwrapElement(IN[0])

  17. divisionLines = [l.ToRevitType(True) for l in IN[1]]

  18. sketchPlane = UnwrapElement(IN[2])

  19. #Create a list for the wall and the divisionLines

  20. wallList = ListElementId

  21. wallList.Add(wall.Id)

  22. intersectionElementsIds = ListElementId

  23. curveArray = ListCurve

  24. #All actions that makes changes to the Revit database needs to be inside a Transaction

  25. TransactionManager.Instance.EnsureInTransaction(doc)

  26. if PartUtils.AreElementsValidForCreateParts(doc, wallList):

  27. createParts = PartUtils.CreateParts(doc, wallList)
  28. doc.Regenerate()
  29. parts = PartUtils.GetAssociatedParts(doc, wall.Id, 0, 0)

  30. partDivide = PartUtils.DivideParts(doc, parts, intersectionElementsIds, curveArray, sketchPlane.Id)

  31. TransactionManager.Instance.TransactionTaskDone()

  32. OUT = partDivide

I would like on the selected part to be divided not the entire wall.
Any help would be appreciated.

I’ve attached the DYN partDivisionLines.dyn (47.8 KB)

I’ve resolved my own issue…

Hi EddieSaez, So whats the solution you have resolved would you care to share to the public?


Apologies but I can’t recall what the solution was.
I’d have go back over the python code over all graph/script

Could you share your script?

Original_Gemini, lucas-gsbp
See attached file… Runs in Dynamo 2.0
Wall must be converted to parts prior to running.
On Running select the parts to divide/split, then the start point of the division :grinning:
Divide-PartsIntoPanels.dyn (67.9 KB)

1 Like