How to get duct shape?

How to get duct shape?

sr
Contributor Contributor
2,193 Views
8 Replies
Message 1 of 9

How to get duct shape?

sr
Contributor
Contributor

 

有没有简单的办法直接获得风管的DuctShape?

 

我知道接口可以获得shape

0 Likes
2,194 Views
8 Replies
Replies (8)
Message 2 of 9

Revitalizer
Advisor
Advisor

Hi,

 

I really, really want to help anybody, but don't expect everyone to understand your mother tongue.

http://forums.autodesk.com/t5/revit-api/problema-na-instalacao-do-revit-2015/m-p/6047166/highlight/t...

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 9

jeremytammik
Autodesk
Autodesk

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:

 

http://adndevblog.typepad.com/aec/2013/03/how-to-get-the-duct-section-shape-for-duct-type-object.htm...

 

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

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/C...

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 4 of 9

Charles.Piro
Advisor
Advisor

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

Smiley Wink



PIRO Charles
Developer

PIRO CIE
Linkedin


Message 5 of 9

Revitalizer
Advisor
Advisor

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




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 6 of 9

jeremytammik
Autodesk
Autodesk

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



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

Message 7 of 9

Charles.Piro
Advisor
Advisor

You're welcome.

 

thank you too Jeremy.

 

Smiley Wink

 

 



PIRO Charles
Developer

PIRO CIE
Linkedin


0 Likes
Message 8 of 9

matteoWNPXW
Explorer
Explorer

From Revit 2019 onwards there is also a `Shape` property on the `MEPCurveType`: https://www.revitapidocs.com/2022/06152f02-9c8c-7f53-8e0b-a0d2adac505a.htm

Message 9 of 9

teocomi
Explorer
Explorer

From Revit 2019 onwards there is also a `Shape` property on the `MEPCurveType`: https://www.revitapidocs.com/2022/06152f02-9c8c-7f53-8e0b-a0d2adac505a.htm