I hope everyone had a wonderful Thanksgiving if you celebrate or just had a great end to November. This week we continue on the path to automating interior elevations. As a reminder, I have been building a plug-in that automates various parts of creating interior elevations, and I will continue to develop it. Since this project will evolve as I continue, I have determined to set my primary goal for each stage. With this goal in mind, I will develop a functioning piece of software to meet the goal. Then I will discuss topics that cover key aspects for each step for building the plug-in. At the end of each stage, I will move the plug-in to a public repository on GitHub so you can use it too.
Part 1: filtered element collector [c#]
Part 2: finding centroids and considering exceptions
Part 3: ViewFamilyTypeId
Part 4: ViewPlanId and Levels
Part 5: phases & goal #1 complete [includes GitHub link to the release]
Part 6: view tempaltes
Part 7: resizing CropBoxes
Part 8: creating FilledRegions & Goal #2 Complete [includes GitHub link to release]
Rename the interior elevations based on the room name, add a suffix based on the cardinal directions to identify the elevations
To rename the interior elevations, we first need to find the cardinal direction that the elevation marker is facing. To make this easier, we have a handful of methods that I added to a Utility class so we can reference them.
First, we want to set up a couple of simple conversions and write a method to convert radians to degrees and vice versa.
We also need to find the offset of the project north from true north. To do this, we first need to convert the ProjectLocationSet type to an IEnumerable of ProjectLocation so that it is a more standard type. Then we can filter for the project location with the name “Internal”. To get the offset, we find the angle between true north and project north and utilize our Radians2Degrees method to ensure it is returned in degrees. We will use this method in the Angle2Cardinal method described below.
This method is very generic and simply gets the angle of a vector and returns this angle in degrees.
Since multiple views cannot have the same name, a great way to distinguish interior elevations is to incorporate a suffix indicating the direction of the interior elevation. To do this, we need to find the document’s north offset by using the GetDocNorthOffset method described above. It is possible for this angle to come back as a number greater than 360. Because the directions rotate around a circle, we can keep adding or subtracting 360 until the angle falls between 0 and 360 degrees. This makes assigning the suffix easier. After correcting the angle, we can assign suffixes based on true north. For example, if the angle is between 0 and 45 degrees or 315 degrees and 360 degrees, the suffix is East. We repeat this for each option. Then we can utilize this method next week to assist in renaming our views.
And that sets up a number of Utility methods that we can then use to rename our interior elevations. Next week, we will tackle renaming our views and complete the final step in automating our interior elevations.
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.