20090709

API Yi Yi: Measuring Panel Lengths and Angles

Time for another plugin made from a sample that ships with the Revit SDK, born from the mind of Harry the API Guru. Of course it's another curtain panel do-dad, that's just where I'm at. This one also does a fairly basic set of operations: after you place a four sided panel with some specific length and angle parameters in a divided surface, the plugin measures the length of each edge and the angle of each corner, then writes these numbers to a parameter in the panel instance. With this you can do at least two things:

1.) You can now schedule the individual panel specs, either for pricing, or refining numbers of different panel types. I've used this to verify that all my panels on a curved surface are identical in size, or within a certain tolerance. (for scheduling you will need to make the measurement parameters shared. There is an excellent tutorial by David Fano that shows how to set up shared parameters, although the tutorial is not exactly ABOUT shared parameters: http://designreform.net/2008/07/14/revit-using-tags-to-drive-instance-parameters/)

2.) Use the instance parameters to drive panel geometry. For instance, if an edge is very long, maybe the mullion is thicker, or the thickness of the panel extrusion could be tied to the panel size, wide panels are thick, small panels are thin.

A couple caveats: as far as I know this only works with quad panels. Also, it ONLY WORKS ON SINGLE SURFACES. That is, you can't use it with panels with extrusions, mullions, whatever. What the function does is simply measures the first four edges it finds, so if you have and extruded slab, it will measure one of the SIX faces that it runs into. Limited? Well, yes. But after measuring your simple flat panel and writing all the instance parameters, you can select all instances of the panel and replace with your fancier one, which keeps all the instance parameter changes. Welcome to the less than ideally BIMy world of the API. So try it first with the provided "basePanel.rfa" and then swap out the panel instances for something more interesting.

No comments:

Post a Comment