extract arc geometry

extract arc geometry

GeomGym
Advocate Advocate
1,147 Views
7 Replies
Message 1 of 8

extract arc geometry

GeomGym
Advocate
Advocate

Happy new year to everyone.

 

Apologies if I have just gotten my geometry wrong, but I can't see why the domain of the revit arc on this revolution is PI to 2PI instead of 0 to PI (references suggest a right hand rule around the normal).  Running code in Revit 2014.

 

Grateful if anyone can assist.  Sampe project code and model (preselect the wall) attached.

 

Thanks,

 

Jon

 

140109 extract arc geometry.png

140109 extract arc geometry 02.png

0 Likes
1,148 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

Looking at your example project I can see that the normal vector of the arc is pointed into the mass and the X Direction is pointed to the left when viewed looking at the face. The angle 0/2pi is in-line with the X direction, so is to the left (see image). The arc was probably drawn anti-clockwise looking at the face and so would trace an arc from pi to 2/pi.

 

Original

 

 

An interesting thing i noticed is that if i go in and manipulate the host mass by dragging the extrusion grip of the southern face and then "Update to Face" on the wall, the arc's plane is then rotated 180° and it then reports a domain of 0 to pi (See second attached image).

 

After Manipulation

If I then drag the mass's face back to the original position, the arc goes back to its original properties.

 

I then performed the same test except this time using the edit-in-place tool to manipulate the mass end faces instead of using the family grips. This time the arc stayed rotated 180° and would not flip back...

 

That silliness aside, if you take the original mass and then reverse the curve that defines the extrusion path, you get an arc with a plane identical to the original but the domain reports as 0 to pi. This is also true when you delete the original path and redraw it in either direction.

 

The problem seems to solve when you perform manipulatons that trigger Revit to re-calculate the underlying geometry so I am suspecting that there is a relation to how the elements were created.

 

Are you creating these elements programatically? If so, then maybe you are constructing the geometry in a manner that Revit does not expect as the GUI usually performs validation/translation before handing the geometry to the back end.

 

Anyway, I'm not familiar with massing and such using the API so I can't be of much more help. Hopefully I've at least provided a hint to what might be causing your issue.

 

Thanks for the interesting question.

 

0 Likes
Message 3 of 8

GeomGym
Advocate
Advocate

Hi Scott, Thanks for the reply and suggestions. The wall by face posted was just an example I manually created having seen odd results on a real project model (which was authored by others).  I'm not sure how often this situation will occur but really it shouldn't be dependent on the modelling process.

 

Will see what else is suggested, hopefully there is means programmatically to correct this.

0 Likes
Message 4 of 8

Anonymous
Not applicable

Do you need to correct the geometery or just be able to extract the information in a uniform / sensible manner?

 

My experience is that Revit just goes ahead and does crazy things sometimes, if you just need to extract sensible data my approach would be to add a layer of analysis / rectification to ensure consistency. I would use the arc's existing properties such as end points, evaluated mid point, centre point and normal vector to calculate my own end parameters that always conform to a standard winding direction.

0 Likes
Message 5 of 8

GeomGym
Advocate
Advocate

Thanks again for the reply.  The requirement here is to be able to extract the geometry in a reliable way.

 

I tried evaluating the curve with a.Evaluate((a.GetEndParameter(0) + a.GetEndParameter(1)) / 2.0, false) and it gave a XYZ with a negative Z coordinate.

I'm expecting a positive Z coordinate.  Is this how you would evaluate the mid point?

0 Likes
Message 6 of 8

Anonymous
Not applicable

I get the same result (negative z on midpoint) seems a bit odd.

 

It is a bit messy but you can extract the edgeloops from the RevolvedFace and use the properties of one of the end arc edges in order to verify the face control curve. The points won't always match exactly, but with a little analysis you can get the correct winding and orientation.

 

 

Revolved Face Properties

 

As you can see, in this case there is an exact match, but if the wall is located on a face other than finish exterior or the mass and/or wall has been moved from the original creation location (control arc retains original location points) or the end bounds of the revolution have been changed after creation then the coords will not match as nicely.

 

You can still work out which orientation the control arc should be though with something as simple as checking whether midpoint is above or below end points.

 

 

Oh Revit, you make things so difficult sometimes...

0 Likes
Message 7 of 8

augusto.goncalves
Alumni
Alumni

Hi,

 

Would you please clarify what question/issue still pendind? Sorry, the forum thread is a little confunsing...

 

Thanks!

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 8 of 8

GeomGym
Advocate
Advocate

The original question still stands.  If you calculate the parametric arc from the revolved face profile curve, the geometry is incorrect.

 

Scott has been helpful in confirming this.  His suggestion is to in effect take the curve and test the location of the face edge to confirm if revit is giving a correct curve or not will work.  But really this seems like a bug in Revit and I believe it should be fixed.  It would be nice if this was confirmed (or if there is an easier way to get the profile curve).

0 Likes