Revit Dynamo #8.18 Function - Split Ducts and Pipes by Length

Поделиться
HTML-код
  • Опубликовано: 14 дек 2024

Комментарии • 7

  • @pedrovizueta2693
    @pedrovizueta2693 27 дней назад

    Where can I find this package Worksheet Visibility 11:49

  • @instert94
    @instert94 2 года назад

    Your demo looks promising and it's nice to walk along with you to learn what every block does or why you use it. But I'm getting stuck when you add Element.CopyByVector. I can't seem to find the block in my library. Could it be that there is a package that I need to load first?

  • @FurqanBs
    @FurqanBs Год назад

    Spent some time on this , won’t work. Not sure why

    • @kristianbrango7711
      @kristianbrango7711 Год назад

      I think its because your model is not workset enabled

    • @vuinhduy8314
      @vuinhduy8314 4 месяца назад

      for auto split duct, pipe,.. you should better using Python or C#

    • @IDG_Revit
      @IDG_Revit 22 дня назад

      @@vuinhduy8314
      Yes Looks something like this:
      import clr
      import math
      from System import Guid
      from Autodesk.Revit.DB import *
      from Autodesk.Revit.UI import *
      clr.AddReference('RevitAPI')
      clr.AddReference('RevitAPIUI')
      # Functie om duct op te splitsen
      def split_duct(doc, duct, max_length):
      # Start een transaction
      transaction = Transaction(doc, "Split Ducts")
      transaction.Start()
      try:
      location_curve = duct.Location.Curve
      start_point = location_curve.GetEndPoint(0)
      end_point = location_curve.GetEndPoint(1)
      total_length = location_curve.Length

      if total_length > max_length:
      current_start = start_point
      current_length = 0
      while current_length < total_length:
      segment_length = min(max_length, total_length - current_length)
      direction = (end_point - current_start).Normalize()
      segment_end = current_start + direction * segment_length
      new_duct = doc.Create.NewDuct(current_start, segment_end, duct.MEPSystem, duct.GetTypeId())
      current_start = segment_end
      current_length += segment_length
      doc.Delete(duct.Id)
      transaction.Commit()
      except Exception as e:
      transaction.RollBack()
      print("Fout bij het splitsen van ducts: {}".format(e))
      uiapp = __revit__
      doc = uiapp.ActiveUIDocument.Document
      collector = FilteredElementCollector(doc).OfClass(Duct)
      ducts = collector.ToElements()
      # Maximum lengte in millimeters (Convert to feet -> Revit uses feet)
      MAX_LENGTH = 1500 / 304.8 # Omrekenen naar feet (Revit gebruikt feet)
      for duct in ducts:
      split_duct(doc, duct, MAX_LENGTH)
      print("Ducts gesplitst op maximale lengte van {} mm.".format(1500))