For my next series, I am tackling placing exterior elevations based on selected walls. Generally, templates have North, South, East, and West elevations set up, however, there are many uses for exterior elevations where you would need more than just those four. Storefront schedules, for example, can be expedited if exterior elevations could be placed by selecting the wall and automatically cropping to that wall. This would also make it easier to add elevations for angled walls.
To simplify the problem, I almost always hard-code the selection process and adjust it to be a user selection later on. This allows me to focus on the functionality of the plug-in and handle the user interaction once it works. So for now, I will gather all the exterior walls in a list. I am accomplishing this based on the assumption that the name of all exterior walls in the project contain “ext” in the name. You can customize this to filter the correct walls.
Once we have the walls, we can place the elevation marker. There are several parameters we need for the CreateElevationMarker method. We need the document, the FamilyTypeId of the exterior elevation marker, a location for the marker, and a scale. Passing through the document is straight forward and to get the FamilyTypeId we simply have to filter for it.
We can hard-code the scale for now and later adjust this to a user selection. That only leaves us the location. We want the location of the marker to be the center of the selected wall. We create a new public method that will return an ElevationMarker and name it Place Marker. The parameters that are required are the document and the bounding box of the wall. To find the center, we take the minimum and maximum values for the X and Y values of the bounding box and divide by two.
This method allows us to place the marker at the center of the wall. Next week, we will look at off-setting the elevation marker from the wall since this will allow the marker to be legible on drawings.
If you want to learn to code and don’t know where to start check out my posts about Steps to Learn to Code [for architects and designers] Part 1 and Part 2.