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: 

FamilyInstance.connectTo

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
522 Views, 4 Replies

FamilyInstance.connectTo

Anonymous
Not applicable

Hello,
I'm trying to connect my InstanceFamilly to my Duct
when I connect it to my end point it works fine. 🤗
but when I connect to my start point it doesn't work! ☹️
someone know how to tell me what i am not doing correctly.

 

see the given errorError.PNG

See sketch

Aansluiting.PNG

 

See Program:

Dim P_Reference As Reference = Sel.PickObject(ObjectType.PointOnElement, "Eerst Punt ")
Dim P_Element As Element = Doc.GetElement(P_Reference)
Dim P_LocationCurve As LocationCurve = TryCast(P_Element.Location, LocationCurve)
Dim P_Punt As XYZ = P_LocationCurve.Curve.GetEndPoint(1)
Dim P_Vector As XYZ = P_LocationCurve.Curve.GetEndPoint(1) - P_LocationCurve.Curve.GetEndPoint(0)
Dim P_Level As Level = Doc.ActiveView.GenLevel
Dim DuctLinks As DB.Mechanical.Duct = CType(Doc.GetElement(P_Reference), Duct)

Dim P_famInstance As DB.FamilyInstance = Doc.Create.NewFamilyInstance(P_Punt, MyFamilySymbol, P_Vector, P_Level, StructuralType.NonStructural)
MesFonctions.MyFunctions.ParametreRond(Doc, P_famInstance, 250.0) '' Radius
Dim BK As DB.MEPModel = P_famInstance.MEPModel

' IF I USE THE END(1) POINT IT WORK WELL
Dim connectorLinks As DB.Connector = DuctLinks.ConnectorManager.Lookup(1)
Dim BkConnectorLinks As DB.Connector = BK.ConnectorManager.Lookup(1)
BkConnectorLinks.ConnectTo(connectorLinks)

 

'' IF I USE THE START(0) POINT IT DOESN'T WORK !!!!
Dim ConnectorRechts As DB.Connector = DuctLinks.ConnectorManager.Lookup(0)
Dim BkConnectorRechts As DB.Connector = BK.ConnectorManager.Lookup(0)
BkConnectorRechts.ConnectTo(ConnectorRechts)

 

thank you in advance

 

0 Likes

FamilyInstance.connectTo

Hello,
I'm trying to connect my InstanceFamilly to my Duct
when I connect it to my end point it works fine. 🤗
but when I connect to my start point it doesn't work! ☹️
someone know how to tell me what i am not doing correctly.

 

see the given errorError.PNG

See sketch

Aansluiting.PNG

 

See Program:

Dim P_Reference As Reference = Sel.PickObject(ObjectType.PointOnElement, "Eerst Punt ")
Dim P_Element As Element = Doc.GetElement(P_Reference)
Dim P_LocationCurve As LocationCurve = TryCast(P_Element.Location, LocationCurve)
Dim P_Punt As XYZ = P_LocationCurve.Curve.GetEndPoint(1)
Dim P_Vector As XYZ = P_LocationCurve.Curve.GetEndPoint(1) - P_LocationCurve.Curve.GetEndPoint(0)
Dim P_Level As Level = Doc.ActiveView.GenLevel
Dim DuctLinks As DB.Mechanical.Duct = CType(Doc.GetElement(P_Reference), Duct)

Dim P_famInstance As DB.FamilyInstance = Doc.Create.NewFamilyInstance(P_Punt, MyFamilySymbol, P_Vector, P_Level, StructuralType.NonStructural)
MesFonctions.MyFunctions.ParametreRond(Doc, P_famInstance, 250.0) '' Radius
Dim BK As DB.MEPModel = P_famInstance.MEPModel

' IF I USE THE END(1) POINT IT WORK WELL
Dim connectorLinks As DB.Connector = DuctLinks.ConnectorManager.Lookup(1)
Dim BkConnectorLinks As DB.Connector = BK.ConnectorManager.Lookup(1)
BkConnectorLinks.ConnectTo(connectorLinks)

 

'' IF I USE THE START(0) POINT IT DOESN'T WORK !!!!
Dim ConnectorRechts As DB.Connector = DuctLinks.ConnectorManager.Lookup(0)
Dim BkConnectorRechts As DB.Connector = BK.ConnectorManager.Lookup(0)
BkConnectorRechts.ConnectTo(ConnectorRechts)

 

thank you in advance

 

4 REPLIES 4
Message 2 of 5
jeremy_tammik
in reply to: Anonymous

jeremy_tammik
Autodesk
Autodesk

Does it work when you try it out manually in the end user interface?

  

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

Does it work when you try it out manually in the end user interface?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5
Anonymous
in reply to: jeremy_tammik

Anonymous
Not applicable

Hi

Manually there is no problem it works
but it looks like my error comes from the way to get the second connector of the FireDamper is not the right one! or I'm wrong?

0 Likes

Hi

Manually there is no problem it works
but it looks like my error comes from the way to get the second connector of the FireDamper is not the right one! or I'm wrong?

Message 4 of 5
jeremy_tammik
in reply to: Anonymous

jeremy_tammik
Autodesk
Autodesk

You probably cannot trust the Lookup method to reliably return the target connector.

 

Please use something like GetConnectorClosestTo instead:

 

 

 

 

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

You probably cannot trust the Lookup method to reliably return the target connector.

 

Please use something like GetConnectorClosestTo instead:

 

 

 

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 5
Anonymous
in reply to: jeremy_tammik

Anonymous
Not applicable
Accepted solution

Thanks

0 Likes

Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report