Revit API

Active Member
Posts: 6
Registered: ‎09-18-2012
Message 1 of 4 (444 Views)
Accepted Solution

Need help in Revit MEP api !

444 Views, 3 Replies
09-18-2012 02:00 AM

Recently, I'm trying to build mep system using API in revit mep. When I try to create transition using Document.Create.newTransitionfitting() method, I get an unexpect result - there is a gap between transition fitting an duct. (See the picture below). Does anyone know how to fix this problem. Thanks !mep变径1.jpg



















                              fg1. before add transition fitting





















                             fg2. with transition fitting

Distinguished Contributor
Posts: 148
Registered: ‎04-01-2011
Message 2 of 4 (442 Views)

Re: Need help in Revit MEP api !

09-18-2012 02:59 AM in reply to: jinzhao_110

I think you just have to move the connector of the desired duct before creating the reducer. I you move it to same position than other duct's connector, I think API manages to shorten the duct correctly.

Active Member
Posts: 6
Registered: ‎09-18-2012
Message 3 of 4 (380 Views)

Re: Need help in Revit MEP api !

10-30-2012 07:33 PM in reply to: ollikat

Thank you for your advice!

I try your method, but it didn't work for me, the gap still there.

Fortunatly, I fix this problem finily. Here is what I do.


First, create new transition fitting normaly.


///===================code I used======================

                    conn1 = ((DxfLine)bj.Line.Nodes[0].Linelist[0]).Conns[1];               //get the connector on one duct
                    conn2 = ((DxfLine)bj.Line.Nodes[1].Linelist[1]).Conns[0];               //get the connector on another duct

                    Fi = doc.Create.NewTransitionFitting(conn1, conn2);                     //Create a transition fitting using two connector
                    cs = Fi.MEPModel.ConnectorManager.Connectors;                           //get the connectors on new transition fitting
                    foreach (Connector c in cs)

                        if (c.Origin.DistanceTo(conn1.Origin) < 0.001)
                            if (!c.IsConnected) c.ConnectTo(conn1);
                            c.Width = conn1.Width;                                          //set the width and the height of connector c
                            c.Height = conn1.Height;
                            if (!c.IsConnected) c.ConnectTo(conn2);
                            c.Width = conn2.Width;
                            c.Height = conn2.Height;


//=================end of create transition fitting=================


Then, commits current transaction, using Transaction.Commit() method.


Finily, set the Parameter("offset") of one connect on transition fitting to 0.0;


//==================code I use===============




Here is the picture of the result. Gap seamed.



Distinguished Contributor
Posts: 148
Registered: ‎04-01-2011
Message 4 of 4 (374 Views)

Re: Need help in Revit MEP api !

10-30-2012 11:05 PM in reply to: jinzhao_110

Great that you managed to get it work. Also very nice that you posted the solution here too...maybe it helps someone else in the future. Kudos form that :-)

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit