Exemple #1
0
        /// <summary>
        /// Creates a new <see cref="DrawingDocument"/>, using the template specified by the
        /// <seealso cref="TemplateFileName"/> property.
        /// </summary>
        /// <returns>A new <see cref="DrawingDocument"/> instance.</returns>
        protected DrawingDocument CreateDrawingDocument()
        {
            // TODO Create a unit test that tests whether setting the LinearPrecision of the LinearDimensionStyle
            // property (see below) works as expected. Not sure if unit tests are possible without running Inventor,
            // though. Steven Volckaert. September 29, 2016.

            var drawingDocument =
                AddIn.CreateDrawingDocument(
                    templateFileName: TemplateFileName,
                    isVisible: true
                    );

            var activeLinearDimensionStyle = drawingDocument.ActiveLinearDimensionStyle();

            activeLinearDimensionStyle.TrailingZeroDisplay = AreTrailingZerosDisplayed;
            activeLinearDimensionStyle.LinearPrecision     =
                SelectedLinearPrecision?.EnumValue ?? LinearPrecisionEnum.kZeroFractionalLinearPrecision;

            return(drawingDocument);
        }