Hi,
I really, really want to help anybody, but don't expect everyone to understand your mother tongue.
Revitalizer
Dear Sr,
Thank you for your query.
Unlike Revitalizer, I understand you perfectly, thanks to Google translate.
You say: "There is no simple way to directly get Duct Shape Duct? I know the user interface can be obtained shape."
You are asking how to determine the cross sectional shape of a duct element.
This used to be a pretty hard question, once upon a time, and several different approaches could be taken, e.g. geometrical analysis, as you can see from these discussions on The Building Coder:
Another way to achieve this is to open the duct fitting family and query the DuctConnector element for its Shape property:
Unfortunately, opening the family is quite a costly operation.
From Revit 2015 onwards, the simplest an most effective method to achieve what you need is to query the ElementType.FamilyName property:
http://thebuildingcoder.typepad.com/blog/2014/04/whats-new-in-the-revit-2015-api.html#4.05
In your case, that might look like this:
/// <summary> /// Determine element shape from its /// element type's family name property. /// </summary> static public string GetElementShape4( Element e ) { string shape = "unknown"; ElementId tid = e.GetTypeId(); if( ElementId.InvalidElementId != tid ) { Document doc = e.Document; ElementType etyp = doc.GetElement( tid ) as ElementType; if( null != etyp ) { shape = etyp.FamilyName; } } return shape; }
I added this code to The Building Coder samples release 2016.0.126.3, in the module CmdMepElementShape.cs, in lines 719-744:
https://github.com/jeremytammik/the_building_coder_samples
https://github.com/jeremytammik/the_building_coder_samples/releases/tag/2016.0.126.3
I hope this helps.
Best regards,
Jeremy
Hi,
like Revitalizer, I'm not sure, of that you want. With the title of your post, I understand that you want find the shape of a duct.
The solution is with the connector.
public ConnectorProfilType GetShape (Duct _duct) { ConnectorProfilType ductShape = null;
foreach(Connector connect in _duct.ConnectorManager.Connectors) { if (connect.ConnectorType == ConnectorType.End) { ductShape = connect.Shape; break; } }
return ductShape; }
Dear Charles,
sr is the author of the thread, not me.
And yes, that's the way to get the Shape, just using the connectors.
Revitalizer
Thank you, Charles, for chiming in.
I published a summary of these suggestions here:
http://thebuildingcoder.typepad.com/blog/2016/02/ifc-import-levels-and-mep-element-shapes.html#3
From Revit 2019 onwards there is also a `Shape` property on the `MEPCurveType`: https://www.revitapidocs.com/2022/06152f02-9c8c-7f53-8e0b-a0d2adac505a.htm
From Revit 2019 onwards there is also a `Shape` property on the `MEPCurveType`: https://www.revitapidocs.com/2022/06152f02-9c8c-7f53-8e0b-a0d2adac505a.htm
Can't find what you're looking for? Ask the community or share your knowledge.