Forge Data Days and JoinGeometryUtils

Finally a chance to meet and learn live about Forge, the updated developer's guide and a nice JoinGeometryUtils sample:

Revit 2023 Developer's Guide

The English version of the Revit 2023 Developer's Guide is now online.

The development team is still actively working on an issue with the Japanese text.

Forge Data Days

Finally, after the world-wide pandemic break, which also affected our traditional yearly DevDays, we can meet again live, face to face:

The Forge Data Days are coming up soon, a one-day, in-person event happening in 20 cities worldwide, to learn how to fully unlock the value of your data with Forge. There are a limited number of seats available for each event, so I encourage you to register as soon as possible once you have decided that this is of interest for you.

At Forge Data Days, you’ll hear directly from experts on how Forge is powering enterprise digital transformation. See how we are making data more granular, standardized, and transparent. This can help you connect your teams, processes, and workflows. Learn how new Forge data capabilities and APIs can increase your productivity, automation, and profitability.

With the following exclusive Early Bird registration links for the first five locations, you can choose between different dates and European cities to join us at:

Personally, I will probably be joining the event in Barcelona.

Registration opens to the public today, May 3rd, and spots will fill up fast, so don't wait too long making up your mind...

To learn more about the event, please check out the Forge Data Days global event series announcement and the Forge Data Days event page.

Forge Data Days

Obtaining Closed Loops for Joined Element Parts

Returning to the Revit API, Richard RPThomas108 Thomas shared another of his brilliant solutions and adds a new entry to the list of the often overlooked Revit API Util in the Revit API discussion forum thread on how to get curves of a joined slab, to obtain separate curve loops for the separate parts of an element that are generated by joining it with another element:

Question: I have a slab that is joined with a beam. How can I get two contiguous curves as highlighted in this picture?

Slab joined loops

Answer: The easiest way to obtain the loops for that is to reverse the join order within a transaction that is rolled back so that the beam cuts the slab. Currently, with slab cutting beam, you will get a single edge loop for the slab top face with extra 'contextual' edges where the edge is hidden by the joins.

The below code uses the following JoinGeometryUtils API calls to achieve what you need:

Slab joined loops

  Public Function Obj_220503a(commandData As ExternalCommandData, ByRef message As Stringelements As ElementSet) As Result
  Dim IntUIApp As UIApplication = commandData.Application
  Dim IntUIDoc As UIDocument = commandData.Application.ActiveUIDocument
  Dim IntDoc As Document = IntUIDoc.Document

  Dim FEC_Flr As New FilteredElementCollector(IntDoc, IntDoc.ActiveView.Id)
  Dim ECF_Flr As New ElementClassFilter(GetType(Floor))

  Dim Els As List(Of Element) = FEC_Flr.WherePasses(ECF_Flr).ToElements
  Dim Curves As New List(Of Tuple(Of List(Of Curve), Plane))

  Using Tx As New Transaction(IntDoc, "Gather")
    If Tx.Start = TransactionStatus.Started Then
      For i = 0 To Els.Count - 1
        Dim El As Element = Els(i)
        Dim Ids As List(Of ElementId) = JoinGeometryUtils.GetJoinedElements(IntDoc, El)

        Dim FEC_Fra As New FilteredElementCollector(IntDoc, Ids)
        Dim ECF_Fra As New ElementCategoryFilter(BuiltInCategory.OST_StructuralFraming)
        Dim Els0 As List(Of Element) = FEC_Fra.WherePasses(ECF_Fra).ToElements

        For i0 = 0 To Els0.Count - 1
          If JoinGeometryUtils.IsCuttingElementInJoin(IntDoc, El, Els0(i0)) Then
            JoinGeometryUtils.SwitchJoinOrder(IntDoc, El, Els0(i0))
          End If
        Next
        IntDoc.Regenerate()

        Dim geomEl As GeometryElement = El.Geometry(New Options With {.DetailLevel = ViewDetailLevel.Fine})
        For Each ob As GeometryObject In geomEl
          If GetType(Solid) Is ob.GetType Then
            Dim S As Solid = ob

            For ix = 0 To S.Faces.Size - 1
              Dim PF As PlanarFace = TryCast(S.Faces.Item(ix), PlanarFace)
              If PF Is Nothing Then Continue For Else
              If PF.FaceNormal.IsAlmostEqualTo(XYZ.BasisZ) Then
                Dim CrvSet As New List(Of Curve)
                Dim CLL As List(Of CurveLoop) = PF.GetEdgesAsCurveLoops
                For Each CL As CurveLoop In CLL
                  For Each C As Curve In CL
                    CrvSet.Add(C)
                  Next
                Next
                Curves.Add(New Tuple(Of List(Of Curve), Plane)(CrvSet, PF.GetSurface))
              End If
            Next

          End If
        Next
      Next

      Tx.RollBack()
    End If
  End Using
  Using Tx As New Transaction(IntDoc, "Draw")
    If Tx.Start = TransactionStatus.Started Then

      For Each item As Tuple(Of List(Of Curve), Plane) In Curves
        Dim PL As Plane = item.Item2
        Dim SKP As SketchPlane = SketchPlane.Create(IntDoc, PL)

        For Each C As Curve In item.Item1
          IntDoc.Create.NewModelCurve(C, SKP)
        Next
      Next

      Tx.Commit()
    End If
  End Using

  Return Result.Succeeded
End Function

Create and Style Your QR Code

Moving away from programming topics, I was not aware how much freedom you can have in styling a QR code until I took a look at the qrcode-monkey.

La Serre – Greenhouse Wheelbarrow Ballet

Finally, unrelated to Revit and other hi-tech, just for fun, if you feel like a five-minute humorous poetic break, take a look at La Serre by Didier André and Jean-Paul Lefeuvre, a banjo-accompanied circus artist greenhouse wheelbarrow ballet:

Formés au Centre national des arts du cirque, Jean-Paul Lefeuvre et Didier André ... ces deux circassiens ont étayé leur univers jusqu'à créer en 2001 La Serre, spectacle poético-agricole ... Dans un univers ingénieux, ces "Buster Keaton" de l'horticulture parsèment d'humour absurde et de rêverie aérienne leur grande humanité.

Trained at the national centre of circus art, Jean-Paul Lefeuvre and Didier André ... created La Serre in 2001, a poetic-agricultural show ... in an ingenious universe, these "Buster Keatons" of horticulture sprinkle their great humanity with absurd humour and aerial reverie.