Posts

Showing posts with the label dimensions

Change Dimension Type

Image
In this post, we discussed creating dimensions with the Revit API. But that script doesn't give us any control over dimension types, which might be an issue. The first time I ran it, for instance, it returned a dimension with nine decimal places: Today, we'll talk about creating and customising a new dimension type, so we can have our new dimensions look exactly as we'd like. For the sake of argument, we'll say we want to convert our dimension to millimetres, with one decimal place. Unfortunately, it's not possible (as far as I know) to create a new dimension type from nothing. We need to duplicate an existing type and edit its format options. (For the sake of simplicity, we'll assume that all our existing dimensions are (and should remain) of the same type. doc = DocumentManager.Instance.CurrentDBDocument dimensions = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Dimensions).WhereElementIsNotElementType()...

Create dimensions

Image
It is possible to automate the creation of dimensions in Revit. This process is highly customisable, but for the sake of argument, let's say we want to dimension the horizontal extents of a series of walls (to learn how to dimension room separation lines, click here ). To do this, we'll be using the NewDimension() method, which takes four arguments: View. In this case, we'll be using the doc.ActiveView, but you can specify any view you'd like. A line. This line will form the dimension. We will create this line before creating the dimension. A reference array. We need to tell the dimension which wall planes to base itself on. That way, if the wall moves, the dimension moves too. Dimension type. This input is optional. To keep this tutorial as simple as possible, we'll ignore this for now. Before we begin, let's set up a simple rounding function (to deal with tiny imprecisions in our model), and an instance of Opt...