private void CreateDimensions( FilledRegion filledRegion, XYZ dimensionDirection, string typeName) { var document = filledRegion.Document; var view = (View)document.GetElement( filledRegion.OwnerViewId); var edgesDirection = dimensionDirection.CrossProduct( view.ViewDirection); var edges = FindRegionEdges(filledRegion) .Where(x => IsEdgeDirectionSatisfied(x, edgesDirection)) .ToList(); if (edges.Count < 2) { return; } // Se hace este ajuste para que la distancia no // depende de la escala. <<<<<< evaluar para // información de acotado y etiquetado!!! //var shift = UnitUtils.ConvertToInternalUnits( // 5 * view.Scale, DisplayUnitType.DUT_MILLIMETERS ) // 2020 // * edgesDirection; var shift = UnitUtils.ConvertToInternalUnits( 5 * view.Scale, UnitTypeId.Millimeters) // 2021 * edgesDirection; var dimensionLine = Line.CreateUnbound( filledRegion.get_BoundingBox(view).Min + shift, dimensionDirection); var references = new ReferenceArray(); foreach (var edge in edges) { references.Append(edge.Reference); } Dimension dim = document.Create.NewDimension( view, dimensionLine, references); ElementId dr_id = DimensionTypeId( document, typeName); if (dr_id != null) { dim.ChangeTypeId(dr_id); } }