Beispiel #1
0
        private void ConstructParam(Document familyDoc, ReferenceArray ra, Line line, string label)
        {
            Autodesk.Revit.DB.Dimension dim   = familyDoc.FamilyCreate.NewDimension(_view, line, ra);
            FamilyParameter             param = familyDoc.FamilyManager.AddParameter(label, BuiltInParameterGroup.PG_CONSTRAINTS, ParameterType.Length, true);

            dim.Label = param;
        }
Beispiel #2
0
 /// <summary>
 /// From existing element
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="isRevitOwned"></param>
 /// <returns></returns>
 internal static Dimension FromExisting(Autodesk.Revit.DB.Dimension instance, bool isRevitOwned)
 {
     return(new Dimension(instance)
     {
         IsRevitOwned = isRevitOwned
     });
 }
Beispiel #3
0
        private void ConstructParam(Document familyDoc, ReferenceArray ra, Line line, string label)
        {
            Autodesk.Revit.DB.Dimension dim   = familyDoc.FamilyCreate.NewDimension(familyDoc.ActiveView, line, ra);
            FamilyParameter             param = familyDoc.FamilyManager.AddParameter(label, BuiltInParameterGroup.PG_CONSTRAINTS, ParameterType.Length, true);

            //if (label == "Height") _param = param;
            //if (label == "Height") familyDoc.FamilyManager.SetFormula(param, "Width");
            dim.Label = param;
        }
Beispiel #4
0
        public static DSCore.Color Color(global::Revit.Elements.Dimension dimension)
        {
            Dimension dim = dimension.InternalElement as Dimension;
            //get the integer value of the color
            int colorInt = dim.DimensionType.get_Parameter(BuiltInParameter.LINE_COLOR).AsInteger();

            //windows color from int
            System.Drawing.Color winColor = ColorTranslator.FromOle(colorInt);
            //return dynamo color
            return(DSCore.Color.ByARGB(winColor.A, winColor.R, winColor.G, winColor.B));
        }
Beispiel #5
0
        public static object Accuracy(global::Revit.Elements.Dimension dimension)
        {
            Dimension dim = dimension.InternalElement as Dimension;

            try
            {
                return(dim.DimensionType.GetUnitsFormatOptions().Accuracy);
            }
            catch (Exception)
            {
                return("UseDefault");
            }
        }
Beispiel #6
0
        public static string DisplayUnits(global::Revit.Elements.Dimension dimension)
        {
            Dimension dim = dimension.InternalElement as Dimension;

            try
            {
                return(dim.DimensionType.GetUnitsFormatOptions().DisplayUnits.ToString());
            }
            catch (Exception)
            {
                return("UseDefault");
            }
        }
Beispiel #7
0
        private void ConstructConstraint(Document familyDoc, ReferenceArray ra)
        {
            Reference ref1 = null;
            Reference ref2 = null;
            int       i    = 1;

            foreach (Reference r in ra)
            {
                if (i == 1)
                {
                    ref1 = r;
                }
                else
                {
                    ref2 = r;
                }
                ++i;
            }
            Autodesk.Revit.DB.Dimension alignment = familyDoc.FamilyCreate.NewAlignment(_view, ref1, ref2);
        }
        public FamilyDimension(Autodesk.Revit.DB.Dimension dim)
        {
            Id = dim.Id.IntegerValue;

            if (dim.View != null)
            {
                ViewName = dim.View.Name;
            }
            else
            {
                ViewName = "null";
            }

            DimTypeName   = dim.DimensionType.Name;;
            IsEQ          = dim.AreSegmentsEqual;
            SegmentsCount = dim.Segments.Size;

            List_ReferenceElementIds = new List <int>();
            foreach (Reference rf in dim.References)
            {
                List_ReferenceElementIds.Add(rf.ElementId.IntegerValue);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Init from existing
 /// </summary>
 /// <param name="element"></param>
 private void InitElement(Autodesk.Revit.DB.Dimension element)
 {
     InternalSetElement(element);
 }
Beispiel #10
0
 /// <summary>
 /// Dimension from existing
 /// </summary>
 /// <param name="element"></param>
 private Dimension(Autodesk.Revit.DB.Dimension element)
 {
     SafeInit(() => InitElement(element));
 }
Beispiel #11
0
 /// <summary>
 /// Set the internal Element, ElementId, and UniqueId
 /// </summary>
 /// <param name="element"></param>
 private void InternalSetElement(Autodesk.Revit.DB.Dimension element)
 {
     InternalRevitElement = element;
     InternalElementId    = element.Id;
     InternalUniqueId     = element.UniqueId;
 }
Beispiel #12
0
 public static Dimension Wrap(Autodesk.Revit.DB.Dimension ele, bool isRevitOwned)
 {
     return(Dimension.FromExisting(ele, isRevitOwned));
 }
 public Dimension(DB.Dimension dimension) : base(dimension)
 {
 }