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: 

Need help in Revit MEP api !

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jinzhao_110
1247 Views, 3 Replies

Need help in Revit MEP api !

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

 

mep变径2.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                             fg2. with transition fitting

3 REPLIES 3
Message 2 of 4
ollikat
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.

Message 3 of 4
jinzhao_110
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;
                        }
                        else
                        {
                            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===============

conn2.Owner.get_Parameter("offset").Set(0.0);

//==================end==================

 

Here is the picture of the result. Gap seamed.

未命名.jpg

 

Tags (2)
Message 4 of 4
ollikat
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 🙂

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