Exemple #1
0
        internal static DxfLayer FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfLayer();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 62:
                    item.Color = item.ReadColorValue(pair.ShortValue);
                    break;

                case 6:
                    item.LineTypeName = (pair.StringValue);
                    break;

                case 290:
                    item.IsLayerPlotted = (pair.BoolValue);
                    break;

                case 370:
                    item.LineWeight = DxfLineWeight.FromRawValue(pair.ShortValue);
                    break;

                case 390:
                    item.PlotStylePointer = UIntHandle(pair.StringValue);
                    break;

                case 347:
                    item.MaterialHandle = UIntHandle(pair.StringValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
Exemple #2
0
        internal static DxfBlockRecord FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfBlockRecord();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 340:
                    item.LayoutHandle = UIntHandle(pair.StringValue);
                    break;

                case 70:
                    item.InsertionUnits = (DxfUnits)(pair.ShortValue);
                    break;

                case 280:
                    item.Explodability = BoolShort(pair.ShortValue);
                    break;

                case 281:
                    item.Scalability = BoolShort(pair.ShortValue);
                    break;

                case 310:
                    item._bitmapPreviewData.Add((pair.StringValue));
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
Exemple #3
0
        public static bool TrySetExtensionData <THasXData>(this THasXData hasXData, DxfCodePair pair, DxfCodePairBufferReader buffer)
            where THasXData : IDxfHasXData, IDxfHasXDataHidden
        {
            if (pair.Code == DxfCodePairGroup.GroupCodeNumber && pair.StringValue.StartsWith("{"))
            {
                buffer.Advance();
                var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                hasXData.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                return(true);
            }
            else if (pair.Code == (int)DxfXDataType.ApplicationName)
            {
                buffer.Advance();
                hasXData.XDataHidden = DxfXData.FromBuffer(buffer, pair.StringValue);
                return(true);
            }

            return(false);
        }
        internal static DxfAppId FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfAppId();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
Exemple #5
0
        internal static DxfLineType FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfLineType();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 3:
                    item.Description = (pair.StringValue);
                    break;

                case 72:
                    item.AlignmentCode = (pair.ShortValue);
                    break;

                case 73:
                    item._elementCount = (pair.ShortValue);
                    break;

                case 40:
                    item.TotalPatternLength = (pair.DoubleValue);
                    break;

                case 49:
                    // start a new element
                    item.Elements.Add(new DxfLineTypeElement()
                    {
                        DashDotSpaceLength = pair.DoubleValue
                    });
                    break;

                case 74:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().ComplexFlags = pair.ShortValue;
                    }
                    break;

                case 75:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().ShapeNumber = pair.ShortValue;
                    }
                    break;

                case 340:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().StylePointer.Handle = UIntHandle(pair.StringValue);
                    }
                    break;

                case 46:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().ScaleValues.Add(pair.DoubleValue);
                    }
                    break;

                case 50:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().RotationAngle = pair.DoubleValue;
                    }
                    break;

                case 44:
                    // add to last element, start a new offset value
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().Offsets.Add(new DxfVector(pair.DoubleValue, 0.0, 0.0));
                    }
                    break;

                case 45:
                    // add to last element, add to last offset value
                    if (item.Elements.Count > 0 && item.Elements.Last().Offsets.Count > 0)
                    {
                        item.Elements.Last().Offsets.Last().Y = pair.DoubleValue;
                    }
                    break;

                case 9:
                    // add to last element
                    if (item.Elements.Count > 0)
                    {
                        item.Elements.Last().TextString = pair.StringValue;
                    }
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
        internal static DxfStyle FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfStyle();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 40:
                    item.TextHeight = (pair.DoubleValue);
                    break;

                case 41:
                    item.WidthFactor = (pair.DoubleValue);
                    break;

                case 50:
                    item.ObliqueAngle = (pair.DoubleValue);
                    break;

                case 71:
                    item.TextGenerationFlags = (int)(pair.ShortValue);
                    break;

                case 42:
                    item.LastHeightUsed = (pair.DoubleValue);
                    break;

                case 3:
                    item.PrimaryFontFileName = (pair.StringValue);
                    break;

                case 4:
                    item.BigFontFileName = (pair.StringValue);
                    break;

                case 1071:
                    item.FontFlags = (pair.IntegerValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
Exemple #7
0
        internal static DxfViewPort FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfViewPort();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 10:
                    item.LowerLeft.X = (pair.DoubleValue);
                    break;

                case 20:
                    item.LowerLeft.Y = (pair.DoubleValue);
                    break;

                case 11:
                    item.UpperRight.X = (pair.DoubleValue);
                    break;

                case 21:
                    item.UpperRight.Y = (pair.DoubleValue);
                    break;

                case 12:
                    item.ViewCenter.X = (pair.DoubleValue);
                    break;

                case 22:
                    item.ViewCenter.Y = (pair.DoubleValue);
                    break;

                case 13:
                    item.SnapBasePoint.X = (pair.DoubleValue);
                    break;

                case 23:
                    item.SnapBasePoint.Y = (pair.DoubleValue);
                    break;

                case 14:
                    item.SnapSpacing.X = (pair.DoubleValue);
                    break;

                case 24:
                    item.SnapSpacing.Y = (pair.DoubleValue);
                    break;

                case 15:
                    item.GridSpacing.X = (pair.DoubleValue);
                    break;

                case 25:
                    item.GridSpacing.Y = (pair.DoubleValue);
                    break;

                case 16:
                    item.ViewDirection.X = (pair.DoubleValue);
                    break;

                case 26:
                    item.ViewDirection.Y = (pair.DoubleValue);
                    break;

                case 36:
                    item.ViewDirection.Z = (pair.DoubleValue);
                    break;

                case 17:
                    item.TargetViewPoint.X = (pair.DoubleValue);
                    break;

                case 27:
                    item.TargetViewPoint.Y = (pair.DoubleValue);
                    break;

                case 37:
                    item.TargetViewPoint.Z = (pair.DoubleValue);
                    break;

                case 40:
                    item.ViewHeight = (pair.DoubleValue);
                    break;

                case 41:
                    item.ViewPortAspectRatio = (pair.DoubleValue);
                    break;

                case 42:
                    item.LensLength = (pair.DoubleValue);
                    break;

                case 43:
                    item.FrontClippingPlane = (pair.DoubleValue);
                    break;

                case 44:
                    item.BackClippingPlane = (pair.DoubleValue);
                    break;

                case 45:
                    item.ViewHeight = (pair.DoubleValue);
                    break;

                case 50:
                    item.SnapRotationAngle = (pair.DoubleValue);
                    break;

                case 51:
                    item.ViewTwistAngle = (pair.DoubleValue);
                    break;

                case 71:
                    item.ViewMode = (DxfViewMode)(pair.ShortValue);
                    break;

                case 72:
                    item.CircleSides = (int)(pair.ShortValue);
                    break;

                case 73:
                    item.FastZoom = BoolShort(pair.ShortValue);
                    break;

                case 74:
                    item.UCSIcon = (pair.ShortValue);
                    break;

                case 75:
                    item.SnapOn = BoolShort(pair.ShortValue);
                    break;

                case 76:
                    item.GridOn = BoolShort(pair.ShortValue);
                    break;

                case 77:
                    item.SnapStyle = (DxfSnapStyle)(pair.ShortValue);
                    break;

                case 78:
                    item.SnapIsometricPlane = (DxfSnapIsometricPlane)(pair.ShortValue);
                    break;

                case 1:
                    item.PlotStyleSheet = (pair.StringValue);
                    break;

                case 281:
                    item.RenderMode = (DxfViewRenderMode)(pair.ShortValue);
                    break;

                case 65:
                    item.HasOwnUCS = BoolShort(pair.ShortValue);
                    break;

                case 110:
                    item.UCSOrigin.X = (pair.DoubleValue);
                    break;

                case 120:
                    item.UCSOrigin.Y = (pair.DoubleValue);
                    break;

                case 130:
                    item.UCSOrigin.Z = (pair.DoubleValue);
                    break;

                case 111:
                    item.UCSXAxis.X = (pair.DoubleValue);
                    break;

                case 121:
                    item.UCSXAxis.Y = (pair.DoubleValue);
                    break;

                case 131:
                    item.UCSXAxis.Z = (pair.DoubleValue);
                    break;

                case 112:
                    item.UCSYAxis.X = (pair.DoubleValue);
                    break;

                case 122:
                    item.UCSYAxis.Y = (pair.DoubleValue);
                    break;

                case 132:
                    item.UCSYAxis.Z = (pair.DoubleValue);
                    break;

                case 79:
                    item.OrthographicViewType = (DxfOrthographicViewType)(pair.ShortValue);
                    break;

                case 146:
                    item.UCSElevation = (pair.DoubleValue);
                    break;

                case 345:
                    item.UCSHandle = UIntHandle(pair.StringValue);
                    break;

                case 346:
                    item.BaseUCSHandle = UIntHandle(pair.StringValue);
                    break;

                case 170:
                    item.ShadePlotSetting = (DxfShadeEdgeMode)(pair.ShortValue);
                    break;

                case 61:
                    item.MajorGridLines = BoolShort(pair.ShortValue);
                    break;

                case 332:
                    item.BackgroundObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 333:
                    item.ShadePlotObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 348:
                    item.VisualStyleObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 292:
                    item.IsDefaultLightingOn = (pair.BoolValue);
                    break;

                case 282:
                    item.DefaultLightingType = (DxfDefaultLightingType)(pair.ShortValue);
                    break;

                case 141:
                    item.Brightness = (pair.DoubleValue);
                    break;

                case 142:
                    item.Contrast = (pair.DoubleValue);
                    break;

                case 62:
                    item.AmbientColor = DxfColor.FromRawValue(pair.ShortValue);
                    break;

                case 421:
                    item.AmbientColorInt = (pair.IntegerValue);
                    break;

                case 431:
                    item.AmbientColorName = (pair.StringValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
        internal static DxfView FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfView();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 40:
                    item.ViewHeight = (pair.DoubleValue);
                    break;

                case 10:
                    item.ViewCenterPoint.X = (pair.DoubleValue);
                    break;

                case 20:
                    item.ViewCenterPoint.Y = (pair.DoubleValue);
                    break;

                case 41:
                    item.ViewWidth = (pair.DoubleValue);
                    break;

                case 11:
                    item.ViewDirection.X = (pair.DoubleValue);
                    break;

                case 21:
                    item.ViewDirection.Y = (pair.DoubleValue);
                    break;

                case 31:
                    item.ViewDirection.Z = (pair.DoubleValue);
                    break;

                case 12:
                    item.TargetPoint.X = (pair.DoubleValue);
                    break;

                case 22:
                    item.TargetPoint.Y = (pair.DoubleValue);
                    break;

                case 32:
                    item.TargetPoint.Z = (pair.DoubleValue);
                    break;

                case 42:
                    item.LensLength = (pair.DoubleValue);
                    break;

                case 43:
                    item.FrontClippingPlane = (pair.DoubleValue);
                    break;

                case 44:
                    item.BackClippingPlane = (pair.DoubleValue);
                    break;

                case 50:
                    item.TwistAngle = (pair.DoubleValue);
                    break;

                case 71:
                    item.ViewMode = (pair.ShortValue);
                    break;

                case 281:
                    item.RenderMode = (DxfViewRenderMode)(pair.ShortValue);
                    break;

                case 72:
                    item.IsAssociatedUCSPresent = BoolShort(pair.ShortValue);
                    break;

                case 73:
                    item.IsCameraPlottable = BoolShort(pair.ShortValue);
                    break;

                case 332:
                    item.BackgroundObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 334:
                    item.SelectionObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 348:
                    item.VisualStyleObjectPointer = UIntHandle(pair.StringValue);
                    break;

                case 361:
                    item.SunOwnershipPointer = UIntHandle(pair.StringValue);
                    break;

                case 110:
                    item.UCSOrigin.X = (pair.DoubleValue);
                    break;

                case 120:
                    item.UCSOrigin.Y = (pair.DoubleValue);
                    break;

                case 130:
                    item.UCSOrigin.Z = (pair.DoubleValue);
                    break;

                case 111:
                    item.UCSXAxis.X = (pair.DoubleValue);
                    break;

                case 121:
                    item.UCSXAxis.Y = (pair.DoubleValue);
                    break;

                case 131:
                    item.UCSXAxis.Z = (pair.DoubleValue);
                    break;

                case 112:
                    item.UCSYAxis.X = (pair.DoubleValue);
                    break;

                case 122:
                    item.UCSYAxis.Y = (pair.DoubleValue);
                    break;

                case 132:
                    item.UCSYAxis.Z = (pair.DoubleValue);
                    break;

                case 79:
                    item.OrthographicViewType = (DxfOrthographicViewType)(pair.ShortValue);
                    break;

                case 146:
                    item.UCSElevation = (pair.DoubleValue);
                    break;

                case 345:
                    item.UCSHandle = UIntHandle(pair.StringValue);
                    break;

                case 346:
                    item.BaseUCSHandle = UIntHandle(pair.StringValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
Exemple #9
0
        internal static DxfUcs FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfUcs();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 10:
                    item.Origin = item.Origin.WithUpdatedX(pair.DoubleValue);
                    break;

                case 20:
                    item.Origin = item.Origin.WithUpdatedY(pair.DoubleValue);
                    break;

                case 30:
                    item.Origin = item.Origin.WithUpdatedZ(pair.DoubleValue);
                    break;

                case 11:
                    item.XAxis = item.XAxis.WithUpdatedX(pair.DoubleValue);
                    break;

                case 21:
                    item.XAxis = item.XAxis.WithUpdatedY(pair.DoubleValue);
                    break;

                case 31:
                    item.XAxis = item.XAxis.WithUpdatedZ(pair.DoubleValue);
                    break;

                case 12:
                    item.YAxis = item.YAxis.WithUpdatedX(pair.DoubleValue);
                    break;

                case 22:
                    item.YAxis = item.YAxis.WithUpdatedY(pair.DoubleValue);
                    break;

                case 32:
                    item.YAxis = item.YAxis.WithUpdatedZ(pair.DoubleValue);
                    break;

                case 79:
                    item.OrthographicViewType = (DxfOrthographicViewType)(pair.ShortValue);
                    break;

                case 146:
                    item.Elevation = (pair.DoubleValue);
                    break;

                case 346:
                    item.BaseUcsHandle = UIntHandle(pair.StringValue);
                    break;

                case 71:
                    item.OrthographicType = (DxfOrthographicViewType)(pair.ShortValue);
                    break;

                case 13:
                    item.OrthographicOrigin = item.OrthographicOrigin.WithUpdatedX(pair.DoubleValue);
                    break;

                case 23:
                    item.OrthographicOrigin = item.OrthographicOrigin.WithUpdatedY(pair.DoubleValue);
                    break;

                case 33:
                    item.OrthographicOrigin = item.OrthographicOrigin.WithUpdatedZ(pair.DoubleValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }
        internal static DxfDimStyle FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfDimStyle();

            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                case 70:
                    item.StandardFlags = (int)pair.ShortValue;
                    break;

                case DxfCodePairGroup.GroupCodeNumber:
                    var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                    item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                    break;

                case 3:
                    item.DimensioningSuffix = (pair.StringValue);
                    break;

                case 4:
                    item.AlternateDimensioningSuffix = (pair.StringValue);
                    break;

                case 5:
                    item.ArrowBlockName = (pair.StringValue);
                    break;

                case 6:
                    item.FirstArrowBlockName = (pair.StringValue);
                    break;

                case 7:
                    item.SecondArrowBlockName = (pair.StringValue);
                    break;

                case 40:
                    item.DimensioningScaleFactor = (pair.DoubleValue);
                    break;

                case 41:
                    item.DimensioningArrowSize = (pair.DoubleValue);
                    break;

                case 42:
                    item.DimensionExtensionLineOffset = (pair.DoubleValue);
                    break;

                case 43:
                    item.DimensionLineIncrement = (pair.DoubleValue);
                    break;

                case 44:
                    item.DimensionExtensionLineExtension = (pair.DoubleValue);
                    break;

                case 45:
                    item.DimensionDistanceRoundingValue = (pair.DoubleValue);
                    break;

                case 46:
                    item.DimensionLineExtension = (pair.DoubleValue);
                    break;

                case 47:
                    item.DimensionPlusTolerance = (pair.DoubleValue);
                    break;

                case 48:
                    item.DimensionMinusTolerance = (pair.DoubleValue);
                    break;

                case 71:
                    item.GenerateDimensionTolerances = BoolShort(pair.ShortValue);
                    break;

                case 72:
                    item.GenerateDimensionLimits = BoolShort(pair.ShortValue);
                    break;

                case 73:
                    item.DimensionTextInsideHorizontal = BoolShort(pair.ShortValue);
                    break;

                case 74:
                    item.DimensionTextOutsideHorizontal = BoolShort(pair.ShortValue);
                    break;

                case 75:
                    item.SuppressFirstDimensionExtensionLine = BoolShort(pair.ShortValue);
                    break;

                case 76:
                    item.SuppressSecondDimensionExtensionLine = BoolShort(pair.ShortValue);
                    break;

                case 77:
                    item.TextAboveDimensionLine = BoolShort(pair.ShortValue);
                    break;

                case 78:
                    item.DimensionUnitZeroSuppression = (DxfUnitZeroSuppression)(pair.ShortValue);
                    break;

                case 79:
                    item.DimensionAngleZeroSuppression = (DxfUnitZeroSuppression)(pair.ShortValue);
                    break;

                case 140:
                    item.DimensioningTextHeight = (pair.DoubleValue);
                    break;

                case 141:
                    item.CenterMarkSize = (pair.DoubleValue);
                    break;

                case 142:
                    item.DimensioningTickSize = (pair.DoubleValue);
                    break;

                case 143:
                    item.AlternateDimensioningScaleFactor = (pair.DoubleValue);
                    break;

                case 144:
                    item.DimensionLinearMeasurementScaleFactor = (pair.DoubleValue);
                    break;

                case 145:
                    item.DimensionVerticalTextPosition = (pair.DoubleValue);
                    break;

                case 146:
                    item.DimensionToleranceDisplaceScaleFactor = (pair.DoubleValue);
                    break;

                case 147:
                    item.DimensionLineGap = (pair.DoubleValue);
                    break;

                case 148:
                    item.AlternateDimensioningUnitRounding = (pair.DoubleValue);
                    break;

                case 170:
                    item.UseAlternateDimensioning = BoolShort(pair.ShortValue);
                    break;

                case 171:
                    item.AlternateDimensioningDecimalPlaces = (pair.ShortValue);
                    break;

                case 172:
                    item.ForceDimensionLineExtensionsOutsideIfTextExists = BoolShort(pair.ShortValue);
                    break;

                case 173:
                    item.UseSeparateArrowBlocksForDimensions = BoolShort(pair.ShortValue);
                    break;

                case 174:
                    item.ForceDimensionTextInsideExtensions = BoolShort(pair.ShortValue);
                    break;

                case 175:
                    item.SuppressOutsideExtensionDimensionLines = BoolShort(pair.ShortValue);
                    break;

                case 176:
                    item.DimensionLineColor = DxfColor.FromRawValue(pair.ShortValue);
                    break;

                case 177:
                    item.DimensionExtensionLineColor = DxfColor.FromRawValue(pair.ShortValue);
                    break;

                case 178:
                    item.DimensionTextColor = DxfColor.FromRawValue(pair.ShortValue);
                    break;

                case 179:
                    item.AngularDimensionPrecision = (pair.ShortValue);
                    break;

                case 270:
                    item.DimensionUnitFormat = (DxfUnitFormat)(pair.ShortValue);
                    break;

                case 271:
                    item.DimensionUnitToleranceDecimalPlaces = (pair.ShortValue);
                    break;

                case 272:
                    item.DimensionToleranceDecimalPlaces = (pair.ShortValue);
                    break;

                case 273:
                    item.AlternateDimensioningUnits = (DxfUnitFormat)(pair.ShortValue);
                    break;

                case 274:
                    item.AlternateDimensioningToleranceDecimalPlaces = (pair.ShortValue);
                    break;

                case 275:
                    item.DimensioningAngleFormat = (DxfAngleFormat)(pair.ShortValue);
                    break;

                case 276:
                    item.DimensionFractionFormat = (DxfDimensionFractionFormat)(pair.ShortValue);
                    break;

                case 277:
                    item.DimensionNonAngularUnits = (DxfNonAngularUnits)(pair.ShortValue);
                    break;

                case 278:
                    item.DimensionDecimalSeparatorChar = (char)(pair.ShortValue);
                    break;

                case 279:
                    item.DimensionTextMovementRule = (DxfDimensionTextMovementRule)(pair.ShortValue);
                    break;

                case 280:
                    item.DimensionTextJustification = (DxfDimensionTextJustification)(pair.ShortValue);
                    break;

                case 281:
                    item.SuppressFirstDimensionExtensionLine = BoolShort(pair.ShortValue);
                    break;

                case 282:
                    item.SuppressSecondDimensionExtensionLine = BoolShort(pair.ShortValue);
                    break;

                case 283:
                    item.DimensionToleranceVerticalJustification = (DxfJustification)(pair.ShortValue);
                    break;

                case 284:
                    item.DimensionToleranceZeroSuppression = (DxfUnitZeroSuppression)(pair.ShortValue);
                    break;

                case 285:
                    item.AlternateDimensioningZeroSupression = (DxfUnitZeroSuppression)(pair.ShortValue);
                    break;

                case 286:
                    item.AlternateDimensioningToleranceZeroSupression = (DxfUnitZeroSuppression)(pair.ShortValue);
                    break;

                case 287:
                    item.DimensionTextAndArrowPlacement = (DxfDimensionFit)(pair.ShortValue);
                    break;

                case 288:
                    item.DimensionCursorControlsTextPosition = BoolShort(pair.ShortValue);
                    break;

                case 289:
                    item.DimensionTextAndArrowPlacement = (DxfDimensionFit)(pair.ShortValue);
                    break;

                case 340:
                    item.DimensionTextStyle = (pair.StringValue);
                    break;

                case 341:
                    item.DimensionLeaderBlockName = (pair.StringValue);
                    break;

                case 342:
                    item.ArrowBlockName = (pair.StringValue);
                    break;

                case 343:
                    item.FirstArrowBlockName = (pair.StringValue);
                    break;

                case 344:
                    item.SecondArrowBlockName = (pair.StringValue);
                    break;

                case 371:
                    item.DimensionLineWeight = DxfLineWeight.FromRawValue(pair.ShortValue);
                    break;

                case 372:
                    item.DimensionExtensionLineWeight = DxfLineWeight.FromRawValue(pair.ShortValue);
                    break;

                case (int)DxfXDataType.ApplicationName:
                    item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                    break;

                default:
                    item.TrySetPair(pair);
                    break;
                }
            }

            return(item);
        }