Create boundary conditions on edge of analytical surface

Create boundary conditions on edge of analytical surface

andreas.niggl
Participant Participant
1,240 Views
6 Replies
Message 1 of 7

Create boundary conditions on edge of analytical surface

andreas.niggl
Participant
Participant

Hello,

 

I would like to create boundary conditions on the edges of an analytical surface using Revit.Creation.Document.NewLineBoundaryConditions(...). Is that possible and if yes, could you point me to an example?

 

I managed to generate line as well as point boundary conditions on the analytical line of a column, but I don't see how to get a valid reference to an edge of an analytical surface to be passed as first parameter in NewLineBoundaryConditions(...).

 

Thank you in advance,

Andreas

0 Likes
Accepted solutions (1)
1,241 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

Dear Andreas,

 

How do you create other line and point boundary conditions?

 

Where do you get those references from?

 

In general, I would have thought that you can ask any element of its geometry and specify ComputeReferences to be true in the options when doing so.

 

Then, when you iterate over the geometry, every edge (for instance) can be queried for its reference.

 

Does that not work for the edge of an analytical surface?

 

Cheers,

 

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 7

andreas.niggl
Participant
Participant

Dear Jeremy,

 

I created boundary conditions along a column or at the endpoints of a column using AnalyticalModelSelector according your blog post at http://thebuildingcoder.typepad.com/blog/2016/06/point-boundary-condition-and-revit-2017-sdk.html. That worked well.

 

To generate boundary conditions at the edges of an analytical surface of a slab/wall I think I did like you mentioned. Below you'll find my test example. I iterate over the geometry (with ComputeReferences = true) and pass the reference of each edge to NewLineBoundaryCondition(...). This call, however, throws an ArgumentException.

 

Is the way I iterate over the geometry correct? Or are there any other means to get a valid reference from an edge?

 

Cheers,

Andreas

 

      void TestCreateEdgeSupports( RvtDB.Document doc, RvtDB.Element el)
      {
         var am = el.GetAnalyticalModel() as RvtDB.Structure.AnalyticalModelSurface;
         if (am == null)
            return;

         using (var tx = new RvtDB.Transaction(doc))
         {
            tx.Start("Creating Support Conditions");

            var geometryOptions = new RvtDB.Options();
            geometryOptions.ComputeReferences = true;

            var geometry = am.get_Geometry(geometryOptions);
            foreach (var geo in geometry)
            {
               if (geo is RvtDB.Solid)
               {
                  foreach (RvtDB.Face fc in (geo as RvtDB.Solid).Faces)
                  {
                     foreach (RvtDB.EdgeArray lp in fc.EdgeLoops)
                     {
                        foreach (RvtDB.Edge ed in lp)
                        {
                           var edge_reference = ed.Reference;

                           doc.Create.NewLineBoundaryConditions(edge_reference, // throws an ArgumentException
                              RvtDB.Structure.TranslationRotationValue.Fixed, 0.0,
                              RvtDB.Structure.TranslationRotationValue.Fixed, 0.0,
                              RvtDB.Structure.TranslationRotationValue.Fixed, 0.0,
                              RvtDB.Structure.TranslationRotationValue.Release, 0.0);

                        }
                     }
                  }
               }
            }
            tx.Commit();
         }
      }

 

0 Likes
Message 4 of 7

jeremytammik
Autodesk
Autodesk

Dear Andreas,

 

Your code looks fine to me.

 

I'll check with the development team for you.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 7

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Andreas,

 

The development team responded:

 

The problem lies in the way to obtain analytical references.

 

The correct workflow looks like this:

 

1. Using CurveLoopIterator:

 

  IList<CurveLoop> curveLoops = ams.GetLoops(AnalyticalLoopType.External);
  CurveLoopIterator cli = curveLoops[0].GetCurveLoopIterator();
  cli.MoveNext();
  cli.MoveNext();
 
  AnalyticalModelSelector selector = new AnalyticalModelSelector(cli.Current);
  selector.CurveSelector = AnalyticalCurveSelector.WholeCurve;
  Reference wholeCurveRef = ams.GetReference(selector);
  
  // Create Boundary Condition ...

 

2. Looping through all the curves:

 

  foreach (CurveLoop curveLoop in ams.GetLoops(AnalyticalLoopType.External))
  {
    foreach (Curve curve in curveLoop)
    {
      AnalyticalModelSelector selector = new AnalyticalModelSelector(curve);
      selector.CurveSelector = AnalyticalCurveSelector.WholeCurve;
      Reference wholeCurveRef = ams.GetReference(selector);
 
      // Create Boundary Condition ...
    }
  }

 

This is coherent with point boundary condition.

 

Please confirm whether this works for you, preferably with a code snippet showing how you can make use of this in your case.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 7

andreas.niggl
Participant
Participant

Dear Jeremy,

 

Thank you for your answer. The solution works perfectly.

 

I just set up a test example following your second suggestion, so a code snippet of mine would probably not provide very much additional information for you.

 

Our main target is to extract slab (or other) subsystems from a 3D building model for detailed FEA analysis where we like to automatically generate supports at the connections to adjacent members. Our idea was to organize these subsystems in different views and assign them to design cases. However, we recently found out, that the Revit API provides only limited support to the design case functionality ... so we need to think of some different solution.

 

Cheers,

Andreas 

0 Likes
Message 7 of 7

jeremytammik
Autodesk
Autodesk

Dear Andreas,

 

Thank you for your confirmation and appreciation.

Cheers,

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes