Exemple #1
0
        public void DimStyleDifferenceXDataOnMultiplePropertyDifferences()
        {
            var primary  = new DxfDimStyle();
            var modified = new DxfDimStyle()
            {
                DimensioningSuffix = "non-standard-suffix",
                DimensionUnitToleranceDecimalPlaces = (short)(primary.DimensionUnitToleranceDecimalPlaces + 1)
            };

            var diffItems = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, modified);

            Assert.Equal(2, diffItems.Count);

            Assert.Equal("DSTYLE", ((DxfXDataString)diffItems[0]).Value);

            var list = (DxfXDataItemList)diffItems[1];

            Assert.Equal(4, list.Items.Count);

            Assert.Equal(3, ((DxfXDataInteger)list.Items[0]).Value);
            Assert.Equal("non-standard-suffix", ((DxfXDataString)list.Items[1]).Value);

            Assert.Equal(271, ((DxfXDataInteger)list.Items[2]).Value);
            Assert.Equal(modified.DimensionUnitToleranceDecimalPlaces, ((DxfXDataInteger)list.Items[3]).Value);
        }
Exemple #2
0
        public void WriteDimensionWithStyleDifferenceXData()
        {
            var file             = new DxfFile();
            var standardDimStyle = file.DimensionStyles.Single(ds => ds.Name == "STANDARD");
            var customDimStyle   = new DxfDimStyle()
            {
                DimensioningSuffix = "some suffix"
            };
            var dim = new DxfAlignedDimension();

            dim.XData = DxfDimStyle.GenerateStyleDifferenceAsXData(standardDimStyle, customDimStyle);
            EnsureFileContainsEntity(dim, @"
1001
ACAD
1000
DSTYLE
1002
{
1070
   3
1000
some suffix
1002
}
  0
ENDSEC
", DxfAcadVersion.R14);
        }
Exemple #3
0
        public void NoDimStyleDifferenceGeneratesNullXData()
        {
            var primary  = new DxfDimStyle();
            var modified = new DxfDimStyle();
            var xdata    = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, modified);

            Assert.Null(xdata);
        }
Exemple #4
0
        public void DimStyleDifferenceXDataHasWellKnownName()
        {
            var primary  = new DxfDimStyle();
            var modified = new DxfDimStyle()
            {
                DimensionUnitToleranceDecimalPlaces = (short)(primary.DimensionUnitToleranceDecimalPlaces + 1)
            };

            var items = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, modified);

            Assert.Equal("DSTYLE", ((DxfXDataString)items.First()).Value);
        }
Exemple #5
0
        public void DimStyleDifferenceXDataHasWellKnownName()
        {
            var primary  = new DxfDimStyle();
            var modified = new DxfDimStyle()
            {
                DimensionUnitToleranceDecimalPlaces = (short)(primary.DimensionUnitToleranceDecimalPlaces + 1)
            };

            var xdata = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, modified);
            var list  = (DxfXDataNamedList)xdata.Items.Single();

            Assert.Equal("DSTYLE", list.Name);
        }
Exemple #6
0
        public void DimStyleDiffernceAfterClone()
        {
            var primary   = new DxfDimStyle();
            var secondary = primary.Clone();

            secondary.DimensionUnitToleranceDecimalPlaces = 5;

            var xdata = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, secondary);
            var list  = (DxfXDataNamedList)xdata.Items.Single();

            Assert.Equal(2, list.Items.Count);

            Assert.Equal(271, ((DxfXDataInteger)list.Items[0]).Value);
            Assert.Equal(5, ((DxfXDataInteger)list.Items[1]).Value);
        }
Exemple #7
0
        public void DimStyleDifferenceXDataOnSinglePropertyDifference()
        {
            var primary  = new DxfDimStyle();
            var modified = new DxfDimStyle()
            {
                DimensionUnitToleranceDecimalPlaces = (short)(primary.DimensionUnitToleranceDecimalPlaces + 1)
            };

            var xdata = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, modified);
            var list  = (DxfXDataNamedList)xdata.Items.Single();

            Assert.Equal(2, list.Items.Count);

            Assert.Equal(271, ((DxfXDataInteger)list.Items[0]).Value);
            Assert.Equal(modified.DimensionUnitToleranceDecimalPlaces, ((DxfXDataInteger)list.Items[1]).Value);
        }
Exemple #8
0
        public void DimStyleFromCustomXData()
        {
            var primary   = new DxfDimStyle();
            var secondary = new DxfDimStyle()
            {
                DimensionUnitToleranceDecimalPlaces = 5
            };

            // sanity check that the values are different
            Assert.NotEqual(primary.DimensionUnitToleranceDecimalPlaces, secondary.DimensionUnitToleranceDecimalPlaces);

            // rebuild dim style from primary with xdata difference; result should equal secondary
            var xdata = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, secondary);

            Assert.True(primary.TryGetStyleFromXDataDifference(xdata, out var reBuiltStyle));
            AssertEquivalent(secondary, reBuiltStyle);
        }
Exemple #9
0
        public void DimStyleDiffernceAfterClone()
        {
            var primary   = new DxfDimStyle();
            var secondary = primary.Clone();

            secondary.DimensionUnitToleranceDecimalPlaces = 5;

            var diffItems = DxfDimStyle.GenerateStyleDifferenceAsXData(primary, secondary);

            Assert.Equal(2, diffItems.Count);

            Assert.Equal("DSTYLE", ((DxfXDataString)diffItems[0]).Value);

            var list = (DxfXDataItemList)diffItems[1];

            Assert.Equal(2, list.Items.Count);
            Assert.Equal(271, ((DxfXDataInteger)list.Items[0]).Value);
            Assert.Equal(5, ((DxfXDataInteger)list.Items[1]).Value);
        }