(Part of the What’s New in the Revit 2010 API series)
The Geometry area of the Revit API has a few interesting and helpful enhancements in the 2010 version.
Probably the most obvious of the enhancements were made to support Revit’s new conceptual massing capabilities.
HermiteSpline
While there was previously a HermiteFace class to represent the surface – we now have a HermiteSpline element for the splines that can be created (which will probably result in many more HermiteFaces as well – since it only takes one button to go from spline to face).
The HermiteSpline exposes its control points and tangent vectors (nice touch). WARNING: For those of you who have been using Tessellation – like we have on our Earth Connector application – be prepared for an explosion of points as Revit Users start using splines. The 5-point spline shown above tessellated into 287 points… (I probably have to start investing some mental energy in a “reduce” function – because that’s pretty heavy!).
Point
As I joked about in one of the previous posts – Autodesk has finally broken down and added the Point concept to Revit (yes, yes – the XYZ class was there before – but Points are now first class geometric objects).
The reference points in the picture above are part of the spline, but it is possible to create standalone ReferencePoint elements – and the geometry extracted for the reference point is a Geometry point.
I have not yet figured out why it’s important to have a point in the geometry class (since you can get the location directly from the element) – but I’m sure that there is a good reason (consistency, if nothing else, I suppose).
Making Life a Little Easier for You
Historically if you dealt with geometry in the Revit API, you had to brush up on your linear algebra in order to deal with Transformation matrices… For example, a chair might be modeled within a family centered on the 0,0,0 point – but then it gets placed 100 times into a project way out in space. Every instance has a transformation matrix that gets you from the “internal” geometry locations – also known as the “SymbolGeometry” – out to the actual geometry location in the project.
It was even worse when items are nested a few levels deep… I know that, for example, stairs have railings and railings have balusters – and balusters gave me fits for quite some time, being a good number of levels deep.
Autodesk started making this better a couple of releases ago – making it easier to get the transformed version of things – and they’ve taken it another step now.
- Instance.GetInstanceGeometry()
- Instance.GetSymbolGeometry()
(Instance is the Geometry class which represents things like FamilyInstances, and other elements where you need to dig into the definition of things). Both of these methods can optionally take a transform matrix to transform – or just give you the easy answer.
The Hit Reference
I mentioned in “Very Spatial APIs” that the Reference class has been upgraded, mainly to provide the additional information retrieved when shooting rays through elements. The new properties:
- ProximityParameter (how close the hit is to the origin)
- Element (the element that was hit)
- ElementReferenceType:
- MESH
- CUT_EDGE
- INSTANCE
- FOREIGN (from the docs: “The reference is to geometry or elements in linked Revit file.”)
- SURFACE
- LINEAR (curve or edge)
- GeometryObject (the geometry intersected)
- Transform (of an instance, if that’s what was hit)
- UVPoint (U,V parameters of the face, if that’s what was hit)
Summary
This is yet another area with modest but solid improvement in the API in 2010.
No comments:
Post a Comment