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.
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 КЖ/КМ
Solved! Go to Solution.
Solved by belciur. Go to 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
@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 КЖ/КМ
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.
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.
Александр Зуев / Alexander Zuev
In BIM we trust
Facebook | VK | Telegram
Шаблон и обучение Revit КЖ/КМ
Thank you for your post, I was very helpful and I managed to get the volume of a Plate.
Add the following references:
ASCADLinkMgd
ASGeometryMgd
ASObjectsMgd
RvtDwgAddon
These are found under C:\Program Files\Autodesk\Revit 2020\AddIns\SteelConnections
Hope this help 🙂
@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
}