private void CreateDocument(out Inventor.Document Document, Inventor.DocumentTypeEnum DocumentType, string TemplateFileName) { Inventor.UnitsOfMeasure UnitsOfMeasure; if (TemplateFileName != "") { Inventor.FileOptions FileOptions = InvApp.FileOptions; TemplateFileName = FileOptions.TemplatesPath + "\\" + TemplateFileName; Document = InvApp.Documents.Add(DocumentType, TemplateFileName, true); } else { Document = InvApp.Documents.Add(DocumentType, "", true); } UnitsOfMeasure = Document.UnitsOfMeasure; UnitsOfMeasure.LengthUnits = Inventor.UnitsTypeEnum.kMillimeterLengthUnits; UnitsOfMeasure.AngleUnits = Inventor.UnitsTypeEnum.kDegreeAngleUnits; UnitsOfMeasure.MassUnits = Inventor.UnitsTypeEnum.kKilogramMassUnits; UnitsOfMeasure.TimeUnits = Inventor.UnitsTypeEnum.kSecondTimeUnits; UnitsOfMeasure.LengthDisplayPrecision = 3; UnitsOfMeasure.AngleDisplayPrecision = 3; }
public static T As <T>(this Inventor.DocumentTypeEnum c) where T : struct { return((T)System.Enum.Parse(typeof(T), c.ToString(), false)); }