Hi
I used below code to create a Dimension.
Reference refElement0 = sel.PickObject(ObjectType.Element, "selectColumn0"); Reference refElement1 = sel.PickObject(ObjectType.Element, "selectColumn1"); FamilyInstance familyInstance0 = Doc.GetElement(refElement0) as FamilyInstance; FamilyInstance familyInstance1 = Doc.GetElement(refElement1) as FamilyInstance; FaceArray faces0 = GetFaceArrayOfFamilyInstance(familyInstance0); FaceArray faces1 = GetFaceArrayOfFamilyInstance(familyInstance1); Face face0 = null; Face face1 = null; foreach (Face face in faces0) { XYZ faceNormal = GetFaceNormal(face); if (faceNormal.IsAlmostEqualTo(new XYZ(0, -1, 0))) { face0 = face; break; } } foreach (Face face in faces1) { XYZ faceNormal = GetFaceNormal(face); if (faceNormal.IsAlmostEqualTo(new XYZ(0, -1, 0))) { face1 = face; break; } } ReferenceArray refArray = new ReferenceArray(); refArray.Append(face0.Reference); refArray.Append(face1.Reference); using (Transaction t = new Transaction(Doc, "CreateDimension")) { t.Start(); LocationPoint locationPoint0 = familyInstance0.Location as LocationPoint; LocationPoint locationPoint1 = familyInstance1.Location as LocationPoint; Line lineDimension = Line.CreateBound(locationPoint0.Point, locationPoint1.Point); Doc.Create.NewDimension(Doc.ActiveView, lineDimension, refArray); t.Commit(); }
As expected,the reslut is like below:
But.. I really want is like below ..which is to create dimension based on the column center like manually createing the dimension from revit UI (can select the center line of a column). And what does this bule line represent, Face? Plane? Line?
Any idea on how to implement this? Thx!
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Yes, I hope so.
Check out this recent discussion:
http://thebuildingcoder.typepad.com/blog/2017/05/api-access-to-family-instance-references.html
I hope it helps.
Please let us know how it goes and how you end up resolving this.
Thank you!
Cheers,
Jeremy
Hi Jeremy,
Sorry for the late reply.
I refered to Picking Pairs and Dimensioning Family Instance Origin and get the column origin line for creating the dimension. It worked.
Thanks a lot!
Can't find what you're looking for? Ask the community or share your knowledge.