Gallaxhar
Gallaxhar

Reputation: 1036

Add dimension between two elements that are not inside the family editor?

I've seen examples using the NewDimension method to dimension between two points and two lines, I assume in the family editor, but I want to add a dimension to two family instances in the model, such as a pipe tap's centerline and a pipe end. Then the dimension would 'drive' the distance if the user edits it, moving the outlet along the pipe, just like it does if a user created the dimension using the Revit UI.

I just don't know what way Revit wants me to try to do this:

  1. Finding the family instance ID, going into each family ID, and finding a line/plane/point in the family to use as a dimension point when you use NewDimension. Hopefully this would work outside the family editor trying to make a dimension between two different family instances (pipe end and pipe tap).

  2. Finding the x,y,z location of the points you want to snap to, and creating a dimension (using NewDimension method for example) between those two x,y,z locations, and if the x,y,z locations fall on appropriate points like a pipe end and center-line of a pipe tap then perhaps Revit automatically makes it a 'smart' dimension that 'drives' the location of the pipe tap.

Here's some promising methods I found in the API, not sure which of them I should be using though.

NewDimension
AlignedDimension
AddListeningDimensionBendToBend
AddListeningDimensionSegmentToBend
AddListeningDimensionSegmentToSegment
SetElementsToDimension

Upvotes: 0

Views: 1437

Answers (1)

Jeremy Tammik
Jeremy Tammik

Reputation: 8339

Look at the two Building Coder samples showing how to Dimension Walls by Iterating Faces and Dimension Walls using FindReferencesByDirection.

The approach used for walls works with standard family instances as well.

Note that the FindReferencesByDirection method has now been replaced by the `ReferenceIntersector class.

Upvotes: 1

Related Questions