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: 

Automatic duct between fittings

4 REPLIES 4
Reply
Message 1 of 5
mononull
963 Views, 4 Replies

Automatic duct between fittings

I'm trying to render a damper on a duct in a similar way as you can do manually in the UI.  When I try to create a fitting and then create the duct and connect it all I end up with all kinds of issues because Revit expects too much from the fittings.  Like say I have a takeoff that's shorter than 8 inches then Revit will not let me place a Damper within that 8 inch space through the API, but if I use the 'place accessory' button in the UI then it works fine.

 

Now I've read other posts about creating the fittings first and then connecting one fitting's connector to the other fitting's connector and Revit is supposed to automatically create a duct between them.  Well this is not working at all.  Why is everyone saying this works when it doesn't for me?

 

This is the same or similar issue someone posted here, but for some reason this approach worked for them where it doesn't for me. 
https://forums.autodesk.com/t5/revit-api-forum/best-method-for-creating-quot-attaches-to-quot-access.../td-p/6434138

4 REPLIES 4
Message 2 of 5
jeremytammik
in reply to: mononull

I hope this research and series of posts can help:

 

http://thebuildingcoder.typepad.com/blog/2014/01/final-rolling-offset-using-pipecreate.html

 



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

Message 3 of 5
mononull
in reply to: jeremytammik

Thanks, but I couldn't find what I was looking for at that link or any of the sublinks within it.  Say I have a takeoff coming off a branch, out of the takeoff is a short length duct, then a damper, then another duct and then an elbow. 

 

TAKEOFF --- DAMPER --------ELBOW

 

When I use the API it will delete the segment between the takeoff and damper if it's shorter than a certain length.  And in the UI I can see this happen when I try to manually fill in that deleted duct by drawing a new duct there.  Revit will display a highlighted TAKEOFF that is like twice the length of the one I have placed there and then Revit will say it cannot draw the duct.

 

But if I draw a single duct like this:

TAKEOFF --------------------- ELBOW

 

Then use the UI button "Place Accessory" to insert a damper on that segment.  Revit will place the damper even if the takeoff is really short without giving me any errors and without lengthening the takeoff.

TAKEOFF --- DAMPER ----------ELBOW

 

How do I simulate this functionality through the API?  I tried just placing the fittings and connecting them but Revit will not insert ducts between them automatically as people are suggesting.  Revit will instead move the elbow and takeoff right up next to each other even I pin them down.

 

I've been able to get things to work by shifting the Dampers way out and then after all the pipes are rendered, then shifting all the dampers back to their original position but this is causing errors else where and I shouldn't have to do it this way anyhow. 

 

Do I need to temporarily change the autoroute options to place dampers and then change it back when I'm done rendering dampers.  That seems like it could cause other issues too.  Idk, sometimes I spend weeks trying to simulate the functionality of the UI and then it ends up being a huge waste of time.  It's really frustrating and time consuming.

Message 4 of 5
ollikat
in reply to: mononull

Hi

It would be beneficial to see a bit of your code. Which methods you are using to "render" the network.

In overall, I have been co-working several years with my colleague in a feature where different parts of network (duct, pipes etc) are being created and connected via API. If I we would need to do everything from a scratch, we definitely would use only low-level methods, like CreateFamilyInstance etc. and then explicitly move, rotate and connect each part of the network separately (also meaning that if there's a need for reducer, create it manually). This is because using higher level methods like NewElbowFitting() etc. causes all sort of problems and it is very tedious job to end up reliable solution in every possible scenario. So...using a low level methods gives you total control over what's happening. It's not convenient, but in the long run, will save your time. But it of course depends what kind of add-in you are developing.

But I guess the main point is that there's no easy way of generate networks via API.

Message 5 of 5
mononull
in reply to: ollikat

I'm using a little bit of everything. If there is a specific fixture or fitting to use then it's usually NewFamilyInstance, otherwise it could be a generic method like NewTakeoffFitting. I think part of my issue is the code is rendering everything in stages. So I am rendering fixtures, segments, and fittings in their own stages. There are benefits doing it this way but there are downsides also. One benefit is I can place all the fixtures in very accurate positions and then fill in the segments between them. The downsides are like my issue above, where I will try to insert a damper and Revit will delete segments or other fittings after committing the transaction. Then I have to revisit all these failures in another render stage to fix them. And when trying to insert a fitting into already existing ducts and fittings, Revit seems to want some kind of buffer zone between fittings. For example, I could be trying to render a duct between an already existing damper and transition and Revit seems to want this 'buffer zone' as if I have a transition that is maybe 16 inches in length, when the transition already existing is only 8 inches in length. It's not that it's an invalid connection, because I can make it work manually through the UI if I render the elements in order, or use the 'Duct Accessory' button to insert the damper on the already existing duct. Since there is no equivalent to the 'Duct Accessory' button in the UI, and I have code that isn't doing elements in order, then I have to use tactics like inserting the damper far away, connecting it, and then moving the damper closer to where it's suppose to be.


Creating a full system is very confusing when it requires extraordinary steps in the API to make it work. I wonder what the 'Duct Accessory' button does that can't be replicated through the API? Do you render your systems from the root and visit each duct and fitting in order, or do you have success rendering all fixtures first and stuff like that? Doing it by element types seems to work fine for the most part for me, it's just these little things where space might be cramped where it causes things to fail, even when it's a totally valid connection.

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