How to connect conduit with fittings?

How to connect conduit with fittings?

Anonymous
Not applicable
879 Views
2 Replies
Message 1 of 3

How to connect conduit with fittings?

Anonymous
Not applicable

Hello!
I have created conduit element between the box and the conduit elbow, изображение_2021-07-13_115733.pngbut I had a problem with conduit connection - by default it is not connected with elbow fitting

изображение_2021-07-13_120231.png

I know about connector1.ConnectTo(connector2) method, but there is the problem with obtaining connectors from my conduit. How can I make connection between elbow and conduit with API?

 

//GETTING CONNECTORS FROM ELBOWS
IList<Connector> connectors = new List<Connector>();
foreach (Element elb in elbows)
{
   if ((elb as FamilyInstance).MEPModel.ConnectorManager != null)
   {
       foreach (Connector con in (elb as 
            FamilyInstance).MEPModel.ConnectorManager.
            Connectors.Cast<Connector>())
       {
           connectors.Add(con);
       }
    }
}

//CREATE CONDUITS
//points.OrderByDescending(x => x.X).Last() - intersection point with box
//curve.GetEndPoint(0) - start point (equals to elbow's connector origin)
Conduit first = Conduit.Create(doc, type, curve.GetEndPoint(0), 
   points.OrderByDescending(x => x.X).Last(), conduit.LevelId);

//TRYING TO MAKE CONNECTION
foreach (Connector c in connectors)
{
    if (c.Origin.IsAlmostEqualTo((first.Location as 
        LocationCurve).Curve.GetEndPoint(0)))
    {
        //CONNECTOR'S ORIGIN EQUALS TO CONDUIT'S CURVE START
    }
    else if (c.Origin.IsAlmostEqualTo((first.Location as 
        LocationCurve).Curve.GetEndPoint(1)))
    {
        //CONNECTOR'S ORIGIN EQUALS TO CONDUIT'S CURVE END
    }
}

 

 

0 Likes
880 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

What is the problem you encounter? Your description, drawing and code all look more or less OK. There seem to be some parts missing from the code, though, so it is hard for to see exactly how the bits and pieces should work together.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

Anonymous
Not applicable

In manual creation I can create conduit between elbows, then I press 'Tab' button and we can see that neighbouring elbows are highlighted too (conduit connected to the fittings):

изображение_2021-07-13_140504.png

 

but if I try to press 'Tab' after programmatic creation, nothing will happen, the neighbouring elbows are not highlighted with the conduit:изображение_2021-07-13_140937.png

I just get conduit that disconnected from fittings.

Is there any way to fix this moment using Revit API?

0 Likes