Revit API 2019 - Structural connections and Subelement geometry

Revit API 2019 - Structural connections and Subelement geometry

Extraneous
Advisor Advisor
7,150 Views
9 Replies
Message 1 of 10

Revit API 2019 - Structural connections and Subelement geometry

Extraneous
Advisor
Advisor

Hi everyone. I try to use new 2019 API for structural connections.

Unfortunatly new element "Plate" have no information about his volume, but I can get "Solid" through get_Geometry() method, and write the volume value in the project parameter (and calculate weigth).

But with the plates included in the joint, the situation is more complicated. Such plates are "Subelement", not  "Element", and have their own new methods and properties.

Get the plates I can through the method StructuralConnectionHandler.GetSubelements().

 

API provides Subelement.GetGeometryObject(View) method, it returns GeometryObject, but this is not Solid - I don't understand what kind of object it is, and how to get the amount.

 

subelement.png

I can perform the StructuralConnectionHandler.get_Geometry method, but it returns a lot of Solids (including bolts, welding, etc.), and I do not know what exactly is from plates. I'm at a dead end.

 

 

Btw, with single plate here is not so simple too, I can get geometry only through the Options across the view with a high level of detail:

 

Options opt = new Options()	{ View = activeView };
GeometryElement geoElem = plate.get_Geometry(opt); //ok
Solid sol = geoElem.First() as Solid;

 

Submission "Level of Detail - Highest" returns null:

 

Options opt = new Options()	{ DetailLevel = ViewDetailLevel.Fine };
GeometryElement geoElem = plate.get_Geometry(opt); //returns null

It looks like an error in the API.

Sample project with document-level macros in attachment. Thanks for the answer.

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

Accepted solutions (1)
7,151 Views
9 Replies
Replies (9)
Message 2 of 10

belciur
Autodesk
Autodesk
Accepted solution

Hello,

 

For Detailing Steel Design we provide 3 levels of API:
- standard Revit API
- some Steel Connections specific API
- Advance Steel API

Now, back to your original question, in order to get the volume for a plate element you have to use all these API levels.

Here is some sample code:

 

  //getting Advance Steel proxy of the Revit element
  FilerObject filerObj = Utilities.Functions.GetFilerObject(doc, eRef);
  //...
  Plate plate = filerObj as Plate;
  double volume = plate.Volume;
  static FilerObject GetFilerObject(Autodesk.Revit.DB.Document doc, Reference eRef)
  {
   //mixed Revit and Advance Steel API
   FilerObject filerObject = null; //Advance Steel proxy
   Autodesk.AdvanceSteel.DocumentManagement.Document curDocAS = DocumentManager.GetCurrentDocument();
   if (null != curDocAS)
   {
      OpenDatabase currentDatabase = curDocAS.CurrentDatabase;
      if (null != currentDatabase)
      {
	//getting the fabrication ID (uid) to trace the Advance Steel object
         Guid uid = SteelElementProperties.GetFabricationUniqueID(doc, eRef);
         string asHandle = currentDatabase.getUidDictionary().GetHandle(uid);
         filerObject = FilerObject.GetFilerObjectByHandle(asHandle);
      }
   }
   return filerObject;
  }

You can find useful information in the Revit 2019 SDK samples; more info here: http://thebuildingcoder.typepad.com/blog/2018/04/compiling-the-revit-2019-sdk-samples.html (you have to look for the SampleCommandsSteelElements project).

 

 

Also, steel elements have view-specific geometry so this is the reason that you obtain a valid Solid only when you pass active view as an argument for Options.

 

Thank you



Romeo Belciug
Principal Engineer
Message 3 of 10

Extraneous
Advisor
Advisor

@belciur thanks, method through FilerObject works.

But using Advance looks as workaround. After all, there is a standard method of Subelement.GetGeometryObject. I just do not understand which "GeometryObject" this method returns. How it works?

 

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

0 Likes
Message 4 of 10

Extraneous
Advisor
Advisor

Still does not work. Everything passes, but the method "GetFilerObjectByHandle" returns null ...

 

filer object null.png

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

0 Likes
Message 5 of 10

belciur
Autodesk
Autodesk

Hello,

 

You should use FabricationTransaction class:

 

using (FabricationTransaction trans = new FabricationTransaction(doc, false, "Test"))
{
//.... // Using AdvanceSteel classes and objects // for more details, please consult http://www.autodesk.com/adv-steel-api-walkthroughs-2019-enu Reference eRef = activeDoc.Selection.PickObject(ObjectType.Element, "Pick a plate"); FilerObject filerObj = Utilities.Functions.GetFilerObject(doc, eRef);
//.....
}

You can find different cases in the samples from the Revit SDK packages.

 

Thank you.

 



Romeo Belciug
Principal Engineer
Message 6 of 10

Extraneous
Advisor
Advisor

All done!

I also did not understand in what units the volume from the Advance API returns, it was necessary to divide by 29504000 to get a correct value.

Sample code in the attachment.

 

plates mass.png

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

Message 7 of 10

rita.aguiar
Advocate
Advocate

Hi @belciur

What are the namespaces and dlls for the classes 'Utilities' and 'OpenDatabase'?

Thank you

0 Likes
Message 8 of 10

rita.aguiar
Advocate
Advocate

Thank you for your post, I was very helpful and I managed to get the volume of a Plate.

0 Likes
Message 9 of 10

Anonymous
Not applicable

Add the following references:

ASCADLinkMgd

ASGeometryMgd

ASObjectsMgd

RvtDwgAddon

 

These are found under C:\Program Files\Autodesk\Revit 2020\AddIns\SteelConnections

Hope this help 🙂

Message 10 of 10

CJModis
Advocate
Advocate

@Extraneous  написал (-а):

All done!

I also did not understand in what units the volume from the Advance API returns


It is a cubic millimeters. You can convert it to internal units (cubic feet) by UnitUtils

 

    /// <summary>
    /// Cubic millimeters to internal units (cubic feet)
    /// </summary>
    /// <param name="cubicMillimeters">Value</param>
    public static double CubicMillimeterToInternal(this double cubicMillimeters)
    {
#if R2019 || R2020
        return UnitUtils.ConvertToInternalUnits(cubicMillimeters, DisplayUnitType.DUT_CUBIC_MILLIMETERS);
#else
        return UnitUtils.ConvertToInternalUnits(cubicMillimeters, UnitTypeId.CubicMillimeters);
#endif
    }

 

0 Likes