Hi All,
I'm dealing with some issues with the curves geometry from the grid elements. In my code I asked to get te StartPoint and End Point for every grid to do some stuff later with the curve orientation.
I draw the grids like in the orientation as the following image:
The result I got is as follows:
As you can see in the schedule, the Start Point coordinates indicate that the curves were created in the opposite direction. Just to show in more detail the issue, I replicated the example in DYnamo and got the same conclusion:
So, I would like to know:
1.- What am I missing here?
2.- If I replicate this procedure with a wall element (for ex.) using the location of the wall, I get the coordinates according to the drawn orientation. So, Are grids working in a different way?
Thanks in advance for your help!
Cheers!
Hi.
I would suggest you add functionality to your code to make it independent of the line start and end point orientation.
I do not believe that Revit will guarantee any specific direction.
Why do you need them oriented in a specific direction?
Cheers,
Jeremy
Hi Jeremy,
Thanks for your response.
I'm actually trying to achieve more functionality. I need to control the correct orientation because I'm creating sections automatically. I need them to be according to the plan visualization standards.
Hope the next images can help to understand what I'm trying to achieve:
If I don't have control of the orientation, the section that I'm building is created in the opposite direction and you see the element's flipped in it.
Thanks in advance.
Cheers!
Can\t you create the section in the opposite opposite direction in the cases when that is what you need?
Cheers,
Jeremy
Hi Jeremy,
Exactly, but I just to know the orientation first to pick those cases. I'm actually doing what you mentioned and it works just fine. The question I was looking here was why a grid element created from Left to Right has the Curve start point at the right and the end at the left.
Is it just happening with grid elements?
Thanks in advance.
Cheers!
One thing you can probably do is:
http://www.revitapidocs.com/2018.1/eaff0038-34f2-03cf-185b-2872cffb84af.htm
Cheers,
Jeremy
Thanks, Jeremy.
I already did something pointing in that direction. I'll dig into the method you mentioned.
This is my method:
private bool direccionCurva(XYZ sp, XYZ ep) { //Caso que las curvas sean paralelas al eje Y if(Math.Round(sp.X, 2) == Math.Round(ep.X, 2)) { if (Math.Round(sp.Y, 2) > Math.Round(ep.Y, 2)) { return false; } else { return true; } } //Caso que las curvas sean paralelas al eje X else if (Math.Round(sp.Y, 2) == Math.Round(ep.Y, 2)) { if (Math.Round(sp.X, 2) > Math.Round(ep.X, 2)) { return false; } else { return true; } } //Caso que las curvas sean paralelas al eje X else if (Math.Round(sp.X, 2) < Math.Round(ep.X, 2) && Math.Round(sp.Y, 2) != Math.Round(ep.Y, 2)) { return true; } else { return false; } }
Cheers!
You can simplify your approach using a comparison operator, which might look like this:
public static int Compare( double a, double b, double tolerance = _eps ) { return IsEqual( a, b, tolerance ) ? 0 : ( a < b ? -1 : 1 ); } public static int Compare( XYZ p, XYZ q ) { int d = Compare( p.X, q.X ); if( 0 == d ) { d = Compare( p.Y, q.Y ); if( 0 == d ) { d = Compare( p.Z, q.Z ); } } return d; }
This is part of The Building Coder samples:
https://github.com/jeremytammik/the_building_coder_samples
Cheers,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.