Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit API 2019 - Structural connections and Subelement geometry

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Extraneous
5645 Views, 9 Replies

Revit API 2019 - Structural connections and Subelement geometry

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 | VK | Telegram
Шаблон и обучение Revit КЖ/КМ

9 REPLIES 9
Message 2 of 10
belciur
in reply to: Extraneous

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
in reply to: belciur

@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 | VK | Telegram
Шаблон и обучение Revit КЖ/КМ

Message 4 of 10
Extraneous
in reply to: belciur

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

 

filer object null.png

Александр Зуев / Alexander Zuev
In BIM we trust
Facebook | VK | Telegram
Шаблон и обучение Revit КЖ/КМ

Message 5 of 10
belciur
in reply to: Extraneous

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
in reply to: belciur

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 | VK | Telegram
Шаблон и обучение Revit КЖ/КМ

Message 7 of 10
rita.aguiar
in reply to: belciur

Hi @belciur

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

Thank you

Message 8 of 10
rita.aguiar
in reply to: belciur

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

Message 9 of 10
huynhtan126
in reply to: rita.aguiar

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
in reply to: Extraneous


@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
    }

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community