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: 

Elbow Orientation and Elevation Revit 2013 API

4 REPLIES 4
Reply
Message 1 of 5
jmorganjmcdean
738 Views, 4 Replies

Elbow Orientation and Elevation Revit 2013 API

So in my project I am writing an extension that will take an elbow family and type chosen by the user in the UI and then change it to a new elbow family and type also chosen by the user in the UI.

 

I have already written code to make the change, however I need to apply some additional filters. I only want to change elbows that are below a certain elevation and I only want to change the elbow if the elbow is oriented in the up direction. I would want to make the elevation limit to be chosen by the user.

 

i.e. I want to only change elbows that are underground and are oriented up (as in they connect to a straight on one end and the other end is pointed to above ground).

 

I hope I am clear on this. I'm a little stumped at the moment, but I was thinking if there was a way to get the End Points of the elbow, then maybe I could solve this issue, at least find the orientation. There needs to be a way to find the elevation of the elbow becuase Revit can create views that ignore elevations that the user does not want to include. I guess I need to know how to do this programatically. Thanks for any future help.

4 REPLIES 4
Message 2 of 5
ollikat
in reply to: jmorganjmcdean

Hi

 

I think the scenario you described is pretty much doable...shouldn't need anything too speacial.

 

For the elevation the Element.Location property is probably a good starting point. Depending on situation, you might want to take the Level.ProjectElevation into account because it's included in element's elevation.

 

About the elbow orientation. The first thing that came into my mind was observing the orientation of elbow connectors. If I understood your requirements correctly, the cross product of elbow connector directions should be horizontal. You can get the connector directions from Connector.CoordinateSystem.BasisZ.

 

Hope this helps you to get started.

Message 3 of 5
jmorganjmcdean
in reply to: ollikat


@ollikat wrote:

Hi

 

I think the scenario you described is pretty much doable...shouldn't need anything too speacial.

 

For the elevation the Element.Location property is probably a good starting point. Depending on situation, you might want to take the Level.ProjectElevation into account because it's included in element's elevation.

 

About the elbow orientation. The first thing that came into my mind was observing the orientation of elbow connectors. If I understood your requirements correctly, the cross product of elbow connector directions should be horizontal. You can get the connector directions from Connector.CoordinateSystem.BasisZ.

 

Hope this helps you to get started.


Thanks for your response. This seems like it will get me where I need to be. It would make sense that the cross product for the vectors comming from the elbow ends would tell if the elbow is oriented in the Z-direction. I believe using this method that the z-component of th resulting vector should then be nearly zero, Correct? I guess that is what you mean by horizontal. However, if I can get the direction of the elbow's connectors using the "Connector.CoordinateSystem.BasisZ", can't I just look that one of them points in the positive z-direction with a slight tolerance? I just need to make sure that elbow is going to connect from underground to above ground (So Pointed up. Angle could be 30, 45, 90 degrees etc...).

 

I am fairly new to the Revit API, so I may be over simplifying this generalization. Also I will have to research how to use the Connector.CoordinateSytem.BasisZ to make sure it is refering to the elbow I am working with and that may answer the generalization I just made.

Tags (3)
Message 4 of 5

I just wanted to mention that I was able to use your advice, information from:

http://knowledge.autodesk.com/support/autocad-civil-3d/downloads/caas/blog/thebuildingcoder.typepad....

 

, and a combination from my last comment to get the orientation that I wanted. The solution was as follows

 

ConnectorSet c2 = fi.MEPModel.ConnectorManager.Connectors;
Connector conn = null;
foreach (Connector c in c2) 
{
        conn = c;
        XYZ connectorDirection = conn.CoordinateSystem.OfVector(new XYZ(0,0,1));
        if (connectorDirection.Z == 1)
        {
                 isUp = true;
         }
}

 

Next task is to use the elevation requirement. I will start with what you have suggested since so far your information has been helpful. Thanks.

Message 5 of 5
ollikat
in reply to: jmorganjmcdean


jmorganjmcdean wrote
can't I just look that one of them points in the positive z-direction with a slight tolerance? I just need to make sure that elbow is going to connect from underground to above ground (So Pointed up. Angle could be 30, 45, 90 degrees etc...).

 

Yes, absolutely. It just depends what is your requirement for the checking. Having horizontal cross product would inlcude all possible rotations and thus is the most generic way to check that bend is aligned vertically (althoug connectors can point in any direction on that plane).

 

 


jmorganjmcdean wrote

 

  so far your information has been helpful.

 

OK...great...nice to hear. Good luck!

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