Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Modifing spec on PipeBends usin C#

robert.balaurea
Explorer

Modifing spec on PipeBends usin C#

robert.balaurea
Explorer
Explorer

Hello,

 

I can't find a way to modify the spec of a PipeBend entity using C#.

Based on the documentation and other components, a PipeBend is a PipeInlineAsset. This should mean that I can use RoutingHelper.SubstituteAsset(...) function.

 

The problem with this is that SubsituteAsset function request a parameter of a new block id which will be substituted.

Trying to get the block id became a challenge because there are no pipe bends inside the ContentManager. So from here I found that specs of pipebends are actually specs from a pipe.

This makes things much harder because when I'm trying to get the PartSizeProperties for a pipe and use this in SubstituteAsset function, I will get an Exception that is not documented.

 

Take a look at the following code:

 

ContentManager cM = ContentManager.GetContentManager();
ObjectId blockId = cM .GetSymbol(newProps, id.Database, Units.Mm);
PipeInlineAsset newPIA = new PipeInlineAsset();
newFitting.SymbolId = blockId;
PortCollection newPorts = newPIA .GetPorts(PortType.Static);

RoutingHelper.SubstituteAsset(id, newProps, newPorts, blockId);

newProps is PartSizeProperty object that contains all the information regarding to spec that I want to convert to.

 

Any tips will be appreciated! Thank you!

0 Likes
Reply
100 Views
0 Replies
Replies (0)