如何在套筒(特种设备)和网格线之间绘制尺寸

时间:2017-10-25 05:16:14

标签: revit-api

我们想在套筒(特种设备)和网格线之间绘制尺寸。

但是当我们应用维度时,会抛出错误消息“删除引用 - 突出显示的维度的引用不再是并行”

XYZ sleeve_xyz = null;
                    Element elm = doc.GetElement(Sleeve_id.Id);
                    FamilyInstance fi = elm as FamilyInstance;
                    Autodesk.Revit.DB.Location position = elm.Location;
                    Autodesk.Revit.DB.LocationPoint positionPoint = position as Autodesk.Revit.DB.LocationPoint;
                    sleeve_xyz = positionPoint.Point;
                    sleeve_xyz = new XYZ(sleeve_xyz.X, sleeve_xyz.Y, 0);
                    Reference sleeve_ref = GetSleeveReference(fi, SpecialReferenceType.CenterLR);
                    Grid first_grid2 = doc.GetElement(First_Grid_elemID) as Grid;
                    Reference gridRef = null;
                    Options opt = new Options();
                    opt.ComputeReferences = true;
                    opt.IncludeNonVisibleObjects = true;
                    opt.View = doc.ActiveView;
                    foreach (GeometryObject obj in first_grid2.get_Geometry(opt))
                    {
                        if (obj is Autodesk.Revit.DB.Line)
                        {
                            Autodesk.Revit.DB.Line line = obj as Autodesk.Revit.DB.Line;
                            gridRef = line.Reference;
                        }
                    }
                    XYZ gr_point2 = new XYZ(grid_intersection_point.X, sleeve_xyz.Y, 0.000000000);
                    Autodesk.Revit.DB.Line line5 = null;
                    line5 = Autodesk.Revit.DB.Line.CreateBound(gr_point2, sleeve_xyz);
                    ReferenceArray refArray = new ReferenceArray();
                    refArray.Append(sleeve_ref);
                    refArray.Append(gridRef);
                    Dimension dim = doc.Create.NewDimension(doc.ActiveView, line5, refArray);

Error

1 个答案:

答案 0 :(得分:0)

首先创建一个通过用户界面手动工作的维度,然后使用RevitLookup分析其属性并找出它所拾取的确切引用。通常,如果Revit产品中没有通过用户界面手动提供某项功能,则Revit API也不会提供该功能。