private bool PrintToFile(Drawing currentDrawing) { bool Result = false; double scale = 1.0; if (rbtnSCALE.Checked) { //get scale of the first view //scale = GetScaleFromTheView(); } DrawingHandler MyDrawingHandler = new DrawingHandler(); PrintAttributes printAttributes = new PrintAttributes(); printAttributes.Scale = scale; printAttributes.PrintToMultipleSheet = false; printAttributes.NumberOfCopies = 1; printAttributes.Orientation = DotPrintOrientationType.Auto; printAttributes.PrintArea = DotPrintAreaType.EntireDrawing; printAttributes.PrinterInstance = "DWG"; string DrawingType = GetDrawingTypeCharacter(currentDrawing); /* set XS_DRAWING_PLOT_FILE_DIRECTORY=.\PlotFiles set XS_DRAWING_PLOT_FILE_NAME_A=%%UDA:PROJECT_USERFIELD_1%%-%%NAME.-%%%%REV_MARK?_Rev%%%%REV_MARK%% set XS_DRAWING_PLOT_FILE_NAME_W=%%UDA:PROJECT_USERFIELD_1%%-%%NAME.-%%%%REV_MARK?_Rev%%%%REV_MARK%% set XS_DRAWING_PLOT_FILE_NAME_C=%%UDA:PROJECT_USERFIELD_1%%-%%NAME.-%%%%REV_MARK?_Rev%%%%REV_MARK%% set XS_DRAWING_PLOT_FILE_NAME_G=%%UDA:PROJECT_USERFIELD_1%%-%%TITLE.-%%%%REV_MARK?_Rev%%%%REV_MARK%% set XS_DRAWING_PLOT_FILE_NAME_M=%%UDA:PROJECT_USERFIELD_1%%-%%TITLE.-%%%%REV_MARK?_Rev%%%%REV_MARK%% */ //string output_path = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_DIRECTORY"); string output_path = "c:\\pdf"; string output_file = "out.dwg"; Model CurrentModel = new Model(); ProjectInfo ProjectInfo = CurrentModel.GetProjectInfo(); if (CurrentModel.GetConnectionStatus()) { output_file = ProjectInfo.ProjectNumber; } string DrawingName = ""; //TSM.Operations.Operation.DisplayPrompt("DrawingType" + DrawingType); switch (DrawingType) { case "A": //output_file = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_NAME_A"); case "W": //output_file = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_NAME_W"); case "C": //output_file = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_NAME_C"); DrawingName = currentDrawing.Mark; DrawingName = RemoveBrackets(DrawingName); break; case "G": //output_file = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_NAME_G"); case "M": //output_file = Environment.GetEnvironmentVariable("XS_DRAWING_PLOT_FILE_NAME_M"); DrawingName = currentDrawing.Name; break; default: goto case "A"; } DrawingName = DrawingName.Replace('.', '-'); output_file += "-" + DrawingName + ".dwg"; if (!String.IsNullOrEmpty(output_path) && !String.IsNullOrEmpty(output_file)) Result = MyDrawingHandler.PrintDrawing(currentDrawing, printAttributes, output_path + "\\" + output_file); return Result; }