added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
+99
View File
@@ -0,0 +1,99 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
/// <summary>
/// To add an external command to Autodesk Revit
/// the developer should implement an object that
/// supports the IExternalCommand interface.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
public class Command : IExternalCommand
{
/// <summary>
/// Implement this method as an external command for Revit.
/// </summary>
/// <param name="commandData">An object that is passed to the external application
/// which contains data related to the command,
/// such as the application object and active view.</param>
/// <param name="message">A message that can be set by the external application
/// which will be displayed if a failure or cancellation is returned by
/// the external command.</param>
/// <param name="elements">A set of elements to which the external application
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
/// <returns>Return the status of the external command.
/// A result of Succeeded means that the API external method functioned as expected.
/// Cancelled can be used to signify that the user cancelled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Autodesk.Revit.DB.Transaction newTran = null;
try
{
newTran = new Autodesk.Revit.DB.Transaction(commandData.Application.ActiveUIDocument.Document, "ViewPrinter");
newTran.Start();
PrintMgr pMgr = new PrintMgr(commandData);
if (null == pMgr.InstalledPrinterNames)
{
PrintMgr.MyMessageBox("No installed printer, the external command can't work.");
return Autodesk.Revit.UI.Result.Cancelled;
}
using (PrintMgrForm pmDlg = new PrintMgrForm(pMgr))
{
if (pmDlg.ShowDialog() != DialogResult.Cancel)
{
newTran.Commit();
return Autodesk.Revit.UI.Result.Succeeded;
}
newTran.RollBack();
}
}
catch (Exception ex)
{
if (null != newTran)
newTran.RollBack();
message = ex.ToString();
return Autodesk.Revit.UI.Result.Failed;
}
return Autodesk.Revit.UI.Result.Cancelled;
}
}
}
+436
View File
@@ -0,0 +1,436 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Printing;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
/// <summary>
/// Exposes the print interfaces just like the Print Dialog (File->Print...) in UI.
/// </summary>
public class PrintMgr
{
private ExternalCommandData m_commandData;
private PrintManager m_printMgr;
public PrintMgr(ExternalCommandData commandData)
{
m_commandData = commandData;
m_printMgr = commandData.Application.ActiveUIDocument.Document.PrintManager;
}
public List<string> InstalledPrinterNames
{
get
{
try
{
PrinterSettings.StringCollection printers
= PrinterSettings.InstalledPrinters;
string[] printerNames = new string[printers.Count];
printers.CopyTo(printerNames, 0);
List<string> names = new List<string>();
foreach (string name in printerNames)
{
names.Add(name);
}
return 0 == names.Count ? null : names;
}
catch (Exception)
{
return null;// can not get installed printer
}
}
}
public string PrinterName
{
get
{
return m_printMgr.PrinterName;
}
set
{
try
{
m_printMgr.SelectNewPrintDriver(value);
}
catch (Exception)
{
// un-available or exceptional printer
}
}
}
public string PrintSetupName
{
get
{
IPrintSetting setting = m_printMgr.PrintSetup.CurrentPrintSetting;
return (setting is PrintSetting) ?
(setting as PrintSetting).Name : ConstData.InSessionName;
}
}
public bool IsPrintToFile
{
get
{
return m_printMgr.PrintToFile;
}
set
{
m_printMgr.PrintToFile = value;
m_printMgr.Apply();
}
}
public bool IsCombinedFile
{
get
{
return m_printMgr.CombinedFile;
}
set
{
// CombinedFile property cannot be setted to false when the Print Range is Current/Visable!
m_printMgr.CombinedFile = value;
m_printMgr.Apply();
}
}
public string PrintToFileName
{
get
{
return m_printMgr.PrintToFileName;
}
}
public string ChangePrintToFileName()
{
using (SaveFileDialog saveDlg = new SaveFileDialog())
{
string postfix = null;
switch (m_printMgr.IsVirtual)
{
case Autodesk.Revit.DB.VirtualPrinterType.AdobePDF:
saveDlg.Filter = "pdf files (*.pdf)|*.pdf";
postfix = ".pdf";
break;
case Autodesk.Revit.DB.VirtualPrinterType.DWFWriter:
saveDlg.Filter = "dwf files (*.dwf)|*.dwf";
postfix = ".dwf";
break;
case Autodesk.Revit.DB.VirtualPrinterType.None:
saveDlg.Filter = "prn files (*.prn)|*.prn";
postfix = ".prn";
break;
case VirtualPrinterType.XPSWriter:
saveDlg.Filter = "XPS files (*.xps)|*.xps";
postfix = ".xps";
break;
default:
break;
}
string title = m_commandData.Application.ActiveUIDocument.Document.Title;
if (title.Contains(".rvt"))
{
saveDlg.FileName = title.Remove(title.LastIndexOf(".")) + postfix;
}
else
{
saveDlg.FileName = title + postfix;
}
if (saveDlg.ShowDialog() == DialogResult.OK)
{
return m_printMgr.PrintToFileName
= saveDlg.FileName;
}
else
{
return null;
}
}
}
public Autodesk.Revit.DB.PrintRange PrintRange
{
get
{
return m_printMgr.PrintRange;
}
set
{
m_printMgr.PrintRange = value;
m_printMgr.Apply();
}
}
public bool Collate
{
get
{
return m_printMgr.Collate;
}
set
{
m_printMgr.Collate = value;
m_printMgr.Apply();
}
}
public int CopyNumber
{
get
{
return m_printMgr.CopyNumber;
}
set
{
m_printMgr.CopyNumber = value;
m_printMgr.Apply();
}
}
public bool PrintOrderReverse
{
get
{
return m_printMgr.PrintOrderReverse;
}
set
{
m_printMgr.PrintOrderReverse = value;
m_printMgr.Apply();
}
}
public string SelectedViewSheetSetName
{
get
{
IViewSheetSet theSet = m_printMgr.ViewSheetSetting.CurrentViewSheetSet;
return (theSet is ViewSheetSet) ?
(theSet as ViewSheetSet).Name : ConstData.InSessionName;
}
}
public string DocumentTitle
{
get
{
string title = m_commandData.Application.ActiveUIDocument.Document.Title;
if (title.Contains(".rvt"))
{
return title.Remove(title.LastIndexOf(".")) + PostFix;
}
else
{
return title + PostFix;
}
}
}
public string PostFix
{
get
{
string postfix = null;
switch (m_printMgr.IsVirtual)
{
case Autodesk.Revit.DB.VirtualPrinterType.AdobePDF:
postfix = ".pdf";
break;
case Autodesk.Revit.DB.VirtualPrinterType.DWFWriter:
postfix = ".dwf";
break;
case Autodesk.Revit.DB.VirtualPrinterType.XPSWriter:
postfix = ".xps";
break;
case Autodesk.Revit.DB.VirtualPrinterType.None:
postfix = ".prn";
break;
default:
break;
}
return postfix;
}
}
public void ChangePrintSetup()
{
using (PrintSetupForm dlg = new PrintSetupForm(
new PrintSTP(m_printMgr, m_commandData)))
{
dlg.ShowDialog();
}
}
public void SelectViewSheetSet()
{
using (viewSheetSetForm dlg = new viewSheetSetForm(
new ViewSheets(m_commandData.Application.ActiveUIDocument.Document)))
{
dlg.ShowDialog();
}
}
public bool SubmitPrint()
{
return m_printMgr.SubmitPrint();
}
public bool VerifyPrintToFile(System.Windows.Forms.Control controlToEnableOrNot)
{
// Enable terms (or):
// 1. Print to non-virtual printer.
return controlToEnableOrNot.Enabled =
m_printMgr.IsVirtual == VirtualPrinterType.None ? true : false;
}
public bool VerifyCopies(Collection<System.Windows.Forms.Control> controlsToEnableOrNot)
{
// Enable terms (or):
// 1. Print to non-virtual priter (physical printer or OneNote), and
// the "Print to file" check box is NOT checked.
// Note: SnagIt is an exception
bool enableOrNot = m_printMgr.IsVirtual == VirtualPrinterType.None
&& !m_printMgr.PrintToFile;
try
{
int cn = m_printMgr.CopyNumber;
}
catch (Exception)
{
enableOrNot = false;
// Note: SnagIt is an exception
}
foreach (System.Windows.Forms.Control control in controlsToEnableOrNot)
{
control.Enabled = enableOrNot;
}
return enableOrNot;
}
public bool VerifyPrintToFileName(Collection<System.Windows.Forms.Control> controlsToEnableOrNot)
{
// Enable terms (or):
// 1. Print to virtual priter (PDF or DWF printer)
// 2. Print to none-virtual printer (physical printer or OneNote), and the
// "Print to file" check box is checked.
bool enableOrNot = (m_printMgr.IsVirtual != VirtualPrinterType.None)
|| (m_printMgr.IsVirtual == VirtualPrinterType.None
&& m_printMgr.PrintToFile);
foreach (System.Windows.Forms.Control control in controlsToEnableOrNot)
{
control.Enabled = enableOrNot;
}
return enableOrNot;
}
public bool VerifyPrintToSingleFile(System.Windows.Forms.Control controlToEnableOrNot)
{
// Enable terms (or):
// 1. Print to virtual priter (PDF or DWF printer)
return controlToEnableOrNot.Enabled = m_printMgr.IsVirtual != VirtualPrinterType.None;
}
public bool VerifyPrintToSeparateFile(System.Windows.Forms.Control controlToEnableOrNot)
{
// Enable terms (or):
// 1. Print to virtual priter (PDF or DWF printer) and Print range is select.
// 2. a) Print to none-virtual printer (physical printer or OneNote), b) the
// "Print to file" check box is checked, and c) the Print range is select
return controlToEnableOrNot.Enabled = ((m_printMgr.IsVirtual != VirtualPrinterType.None
&& m_printMgr.PrintRange == Autodesk.Revit.DB.PrintRange.Select)
|| (m_printMgr.IsVirtual == VirtualPrinterType.None
&& m_printMgr.PrintRange == Autodesk.Revit.DB.PrintRange.Select
&& m_printMgr.PrintToFile));
}
public bool VerifyCollate(System.Windows.Forms.Control controlToEnableOrNot)
{
// Enable terms (or):
// 1. a) Print range is select b) the copy number is more 1 c) and the Print to file
// is not selected.
int cn = 0;
try
{
cn = m_printMgr.CopyNumber;
}
catch (InvalidOperationException)
{
//The property CopyNumber is not available.
}
return controlToEnableOrNot.Enabled = m_printMgr.PrintRange == Autodesk.Revit.DB.PrintRange.Select
&& !m_printMgr.PrintToFile
&& cn > 1;
}
public bool VerifySelectViewSheetSet(Collection<System.Windows.Forms.Control> controlsToEnableOrNot)
{
// Enable terms (or):
// 1. Print range is select.
bool enableOrNot = m_printMgr.PrintRange == Autodesk.Revit.DB.PrintRange.Select;
foreach (System.Windows.Forms.Control control in controlsToEnableOrNot)
{
control.Enabled = enableOrNot;
}
return enableOrNot;
}
/// <summary>
/// global and consistent for message box with same caption
/// </summary>
/// <param name="text">MessageBox's text.</param>
public static void MyMessageBox(string text)
{
TaskDialog.Show("View Printer", text);
}
}
}
+448
View File
@@ -0,0 +1,448 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.ViewPrinter.CS
{
partial class PrintMgrForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.printerNameComboBox = new System.Windows.Forms.ComboBox();
this.printergroupBox = new System.Windows.Forms.GroupBox();
this.printToFileCheckBox = new System.Windows.Forms.CheckBox();
this.fileGroupBox = new System.Windows.Forms.GroupBox();
this.browseButton = new System.Windows.Forms.Button();
this.printToFileNameTextBox = new System.Windows.Forms.TextBox();
this.printToFileNameLabel = new System.Windows.Forms.Label();
this.separateFileRadioButton = new System.Windows.Forms.RadioButton();
this.singleFileRadioButton = new System.Windows.Forms.RadioButton();
this.printRangeGroupBox = new System.Windows.Forms.GroupBox();
this.selectedViewSheetSetButton = new System.Windows.Forms.Button();
this.selectedViewSheetSetLabel = new System.Windows.Forms.Label();
this.selectedViewsRadioButton = new System.Windows.Forms.RadioButton();
this.visiblePortionRadioButton = new System.Windows.Forms.RadioButton();
this.currentWindowRadioButton = new System.Windows.Forms.RadioButton();
this.optionsGroupBox = new System.Windows.Forms.GroupBox();
this.copiesNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.collateCheckBox = new System.Windows.Forms.CheckBox();
this.orderCheckBox = new System.Windows.Forms.CheckBox();
this.numberofcoyiesLabel = new System.Windows.Forms.Label();
this.settingsGroupBox = new System.Windows.Forms.GroupBox();
this.setupButton = new System.Windows.Forms.Button();
this.printSetupNameLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.printergroupBox.SuspendLayout();
this.fileGroupBox.SuspendLayout();
this.printRangeGroupBox.SuspendLayout();
this.optionsGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.copiesNumericUpDown)).BeginInit();
this.settingsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Name:";
//
// printerNameComboBox
//
this.printerNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.printerNameComboBox.FormattingEnabled = true;
this.printerNameComboBox.Location = new System.Drawing.Point(83, 13);
this.printerNameComboBox.Name = "printerNameComboBox";
this.printerNameComboBox.Size = new System.Drawing.Size(328, 21);
this.printerNameComboBox.TabIndex = 1;
//
// printergroupBox
//
this.printergroupBox.Controls.Add(this.printToFileCheckBox);
this.printergroupBox.Controls.Add(this.printerNameComboBox);
this.printergroupBox.Controls.Add(this.label1);
this.printergroupBox.Location = new System.Drawing.Point(12, 12);
this.printergroupBox.Name = "printergroupBox";
this.printergroupBox.Size = new System.Drawing.Size(521, 147);
this.printergroupBox.TabIndex = 2;
this.printergroupBox.TabStop = false;
this.printergroupBox.Text = "Printer";
//
// printToFileCheckBox
//
this.printToFileCheckBox.AutoSize = true;
this.printToFileCheckBox.Location = new System.Drawing.Point(435, 124);
this.printToFileCheckBox.Name = "printToFileCheckBox";
this.printToFileCheckBox.Size = new System.Drawing.Size(75, 17);
this.printToFileCheckBox.TabIndex = 2;
this.printToFileCheckBox.Text = "Print to file";
this.printToFileCheckBox.UseVisualStyleBackColor = true;
this.printToFileCheckBox.CheckedChanged += new System.EventHandler(this.printToFileCheckBox_CheckedChanged);
//
// fileGroupBox
//
this.fileGroupBox.Controls.Add(this.browseButton);
this.fileGroupBox.Controls.Add(this.printToFileNameTextBox);
this.fileGroupBox.Controls.Add(this.printToFileNameLabel);
this.fileGroupBox.Controls.Add(this.separateFileRadioButton);
this.fileGroupBox.Controls.Add(this.singleFileRadioButton);
this.fileGroupBox.Location = new System.Drawing.Point(12, 165);
this.fileGroupBox.Name = "fileGroupBox";
this.fileGroupBox.Size = new System.Drawing.Size(521, 107);
this.fileGroupBox.TabIndex = 3;
this.fileGroupBox.TabStop = false;
this.fileGroupBox.Text = "File";
//
// browseButton
//
this.browseButton.Location = new System.Drawing.Point(417, 73);
this.browseButton.Name = "browseButton";
this.browseButton.Size = new System.Drawing.Size(75, 23);
this.browseButton.TabIndex = 3;
this.browseButton.Text = "&Browse...";
this.browseButton.UseVisualStyleBackColor = true;
this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
//
// printToFileNameTextBox
//
this.printToFileNameTextBox.Location = new System.Drawing.Point(94, 75);
this.printToFileNameTextBox.Name = "printToFileNameTextBox";
this.printToFileNameTextBox.Size = new System.Drawing.Size(317, 20);
this.printToFileNameTextBox.TabIndex = 2;
//
// printToFileNameLabel
//
this.printToFileNameLabel.AutoSize = true;
this.printToFileNameLabel.Location = new System.Drawing.Point(50, 78);
this.printToFileNameLabel.Name = "printToFileNameLabel";
this.printToFileNameLabel.Size = new System.Drawing.Size(38, 13);
this.printToFileNameLabel.TabIndex = 1;
this.printToFileNameLabel.Text = "Name:";
//
// separateFileRadioButton
//
this.separateFileRadioButton.AutoSize = true;
this.separateFileRadioButton.Location = new System.Drawing.Point(9, 42);
this.separateFileRadioButton.Name = "separateFileRadioButton";
this.separateFileRadioButton.Size = new System.Drawing.Size(402, 17);
this.separateFileRadioButton.TabIndex = 0;
this.separateFileRadioButton.Text = "Create separate files. View/sheet names will be appended to the specified name";
this.separateFileRadioButton.UseVisualStyleBackColor = true;
//
// singleFileRadioButton
//
this.singleFileRadioButton.AutoSize = true;
this.singleFileRadioButton.Checked = true;
this.singleFileRadioButton.Location = new System.Drawing.Point(9, 19);
this.singleFileRadioButton.Name = "singleFileRadioButton";
this.singleFileRadioButton.Size = new System.Drawing.Size(288, 17);
this.singleFileRadioButton.TabIndex = 0;
this.singleFileRadioButton.TabStop = true;
this.singleFileRadioButton.Text = "Combine multiple selected views/sheets into a single file";
this.singleFileRadioButton.UseVisualStyleBackColor = true;
//
// printRangeGroupBox
//
this.printRangeGroupBox.Controls.Add(this.selectedViewSheetSetButton);
this.printRangeGroupBox.Controls.Add(this.selectedViewSheetSetLabel);
this.printRangeGroupBox.Controls.Add(this.selectedViewsRadioButton);
this.printRangeGroupBox.Controls.Add(this.visiblePortionRadioButton);
this.printRangeGroupBox.Controls.Add(this.currentWindowRadioButton);
this.printRangeGroupBox.Location = new System.Drawing.Point(12, 278);
this.printRangeGroupBox.Name = "printRangeGroupBox";
this.printRangeGroupBox.Size = new System.Drawing.Size(238, 183);
this.printRangeGroupBox.TabIndex = 4;
this.printRangeGroupBox.TabStop = false;
this.printRangeGroupBox.Text = "Print Range";
//
// selectedViewSheetSetButton
//
this.selectedViewSheetSetButton.Enabled = false;
this.selectedViewSheetSetButton.Location = new System.Drawing.Point(28, 104);
this.selectedViewSheetSetButton.Name = "selectedViewSheetSetButton";
this.selectedViewSheetSetButton.Size = new System.Drawing.Size(75, 23);
this.selectedViewSheetSetButton.TabIndex = 2;
this.selectedViewSheetSetButton.Text = "Select...";
this.selectedViewSheetSetButton.UseVisualStyleBackColor = true;
this.selectedViewSheetSetButton.Click += new System.EventHandler(this.selectButton_Click);
//
// selectedViewSheetSetLabel
//
this.selectedViewSheetSetLabel.AutoSize = true;
this.selectedViewSheetSetLabel.Location = new System.Drawing.Point(25, 87);
this.selectedViewSheetSetLabel.Name = "selectedViewSheetSetLabel";
this.selectedViewSheetSetLabel.Size = new System.Drawing.Size(65, 13);
this.selectedViewSheetSetLabel.TabIndex = 1;
this.selectedViewSheetSetLabel.Text = "<in-session>";
//
// selectedViewsRadioButton
//
this.selectedViewsRadioButton.AutoSize = true;
this.selectedViewsRadioButton.Location = new System.Drawing.Point(9, 65);
this.selectedViewsRadioButton.Name = "selectedViewsRadioButton";
this.selectedViewsRadioButton.Size = new System.Drawing.Size(136, 17);
this.selectedViewsRadioButton.TabIndex = 0;
this.selectedViewsRadioButton.TabStop = true;
this.selectedViewsRadioButton.Text = "&Selected views/sheets.";
this.selectedViewsRadioButton.UseVisualStyleBackColor = true;
//
// visiblePortionRadioButton
//
this.visiblePortionRadioButton.AutoSize = true;
this.visiblePortionRadioButton.Location = new System.Drawing.Point(9, 42);
this.visiblePortionRadioButton.Name = "visiblePortionRadioButton";
this.visiblePortionRadioButton.Size = new System.Drawing.Size(177, 17);
this.visiblePortionRadioButton.TabIndex = 0;
this.visiblePortionRadioButton.TabStop = true;
this.visiblePortionRadioButton.Text = "&Visible portion of current window";
this.visiblePortionRadioButton.UseVisualStyleBackColor = true;
//
// currentWindowRadioButton
//
this.currentWindowRadioButton.AutoSize = true;
this.currentWindowRadioButton.Location = new System.Drawing.Point(9, 19);
this.currentWindowRadioButton.Name = "currentWindowRadioButton";
this.currentWindowRadioButton.Size = new System.Drawing.Size(98, 17);
this.currentWindowRadioButton.TabIndex = 0;
this.currentWindowRadioButton.TabStop = true;
this.currentWindowRadioButton.Text = "Current &window";
this.currentWindowRadioButton.UseVisualStyleBackColor = true;
//
// optionsGroupBox
//
this.optionsGroupBox.Controls.Add(this.copiesNumericUpDown);
this.optionsGroupBox.Controls.Add(this.collateCheckBox);
this.optionsGroupBox.Controls.Add(this.orderCheckBox);
this.optionsGroupBox.Controls.Add(this.numberofcoyiesLabel);
this.optionsGroupBox.Location = new System.Drawing.Point(272, 278);
this.optionsGroupBox.Name = "optionsGroupBox";
this.optionsGroupBox.Size = new System.Drawing.Size(261, 100);
this.optionsGroupBox.TabIndex = 4;
this.optionsGroupBox.TabStop = false;
this.optionsGroupBox.Text = "Options";
//
// copiesNumericUpDown
//
this.copiesNumericUpDown.Location = new System.Drawing.Point(204, 16);
this.copiesNumericUpDown.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.copiesNumericUpDown.Name = "copiesNumericUpDown";
this.copiesNumericUpDown.Size = new System.Drawing.Size(51, 20);
this.copiesNumericUpDown.TabIndex = 4;
this.copiesNumericUpDown.Value = new decimal(new int[] {
1,
0,
0,
0});
this.copiesNumericUpDown.ValueChanged += new System.EventHandler(this.copiesNumericUpDown_ValueChanged);
//
// collateCheckBox
//
this.collateCheckBox.AutoSize = true;
this.collateCheckBox.Location = new System.Drawing.Point(9, 65);
this.collateCheckBox.Name = "collateCheckBox";
this.collateCheckBox.Size = new System.Drawing.Size(58, 17);
this.collateCheckBox.TabIndex = 3;
this.collateCheckBox.Text = "C&ollate";
this.collateCheckBox.UseVisualStyleBackColor = true;
//
// orderCheckBox
//
this.orderCheckBox.AutoSize = true;
this.orderCheckBox.Location = new System.Drawing.Point(9, 42);
this.orderCheckBox.Name = "orderCheckBox";
this.orderCheckBox.Size = new System.Drawing.Size(116, 17);
this.orderCheckBox.TabIndex = 2;
this.orderCheckBox.Text = "Reverse print &order";
this.orderCheckBox.UseVisualStyleBackColor = true;
//
// numberofcoyiesLabel
//
this.numberofcoyiesLabel.AutoSize = true;
this.numberofcoyiesLabel.Location = new System.Drawing.Point(6, 21);
this.numberofcoyiesLabel.Name = "numberofcoyiesLabel";
this.numberofcoyiesLabel.Size = new System.Drawing.Size(93, 13);
this.numberofcoyiesLabel.TabIndex = 0;
this.numberofcoyiesLabel.Text = "Number of &copies:";
//
// settingsGroupBox
//
this.settingsGroupBox.Controls.Add(this.setupButton);
this.settingsGroupBox.Controls.Add(this.printSetupNameLabel);
this.settingsGroupBox.Location = new System.Drawing.Point(272, 393);
this.settingsGroupBox.Name = "settingsGroupBox";
this.settingsGroupBox.Size = new System.Drawing.Size(261, 68);
this.settingsGroupBox.TabIndex = 4;
this.settingsGroupBox.TabStop = false;
this.settingsGroupBox.Text = "Settings";
//
// setupButton
//
this.setupButton.Location = new System.Drawing.Point(9, 32);
this.setupButton.Name = "setupButton";
this.setupButton.Size = new System.Drawing.Size(75, 23);
this.setupButton.TabIndex = 1;
this.setupButton.Text = "Se&tup...";
this.setupButton.UseVisualStyleBackColor = true;
this.setupButton.Click += new System.EventHandler(this.setupButton_Click);
//
// printSetupNameLabel
//
this.printSetupNameLabel.AutoSize = true;
this.printSetupNameLabel.Location = new System.Drawing.Point(6, 16);
this.printSetupNameLabel.Name = "printSetupNameLabel";
this.printSetupNameLabel.Size = new System.Drawing.Size(41, 13);
this.printSetupNameLabel.TabIndex = 0;
this.printSetupNameLabel.Text = "Default";
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(458, 471);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(296, 471);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// closeButton
//
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Yes;
this.closeButton.Location = new System.Drawing.Point(377, 471);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(75, 23);
this.closeButton.TabIndex = 5;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
//
// PrintMgrForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(545, 506);
this.Controls.Add(this.closeButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.settingsGroupBox);
this.Controls.Add(this.optionsGroupBox);
this.Controls.Add(this.printRangeGroupBox);
this.Controls.Add(this.fileGroupBox);
this.Controls.Add(this.printergroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "PrintMgrForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Print";
this.Load += new System.EventHandler(this.PrintMgrForm_Load);
this.printergroupBox.ResumeLayout(false);
this.printergroupBox.PerformLayout();
this.fileGroupBox.ResumeLayout(false);
this.fileGroupBox.PerformLayout();
this.printRangeGroupBox.ResumeLayout(false);
this.printRangeGroupBox.PerformLayout();
this.optionsGroupBox.ResumeLayout(false);
this.optionsGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.copiesNumericUpDown)).EndInit();
this.settingsGroupBox.ResumeLayout(false);
this.settingsGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox printerNameComboBox;
private System.Windows.Forms.GroupBox printergroupBox;
private System.Windows.Forms.CheckBox printToFileCheckBox;
private System.Windows.Forms.GroupBox fileGroupBox;
private System.Windows.Forms.RadioButton separateFileRadioButton;
private System.Windows.Forms.RadioButton singleFileRadioButton;
private System.Windows.Forms.Button browseButton;
private System.Windows.Forms.TextBox printToFileNameTextBox;
private System.Windows.Forms.Label printToFileNameLabel;
private System.Windows.Forms.GroupBox printRangeGroupBox;
private System.Windows.Forms.RadioButton currentWindowRadioButton;
private System.Windows.Forms.GroupBox optionsGroupBox;
private System.Windows.Forms.Label selectedViewSheetSetLabel;
private System.Windows.Forms.RadioButton selectedViewsRadioButton;
private System.Windows.Forms.RadioButton visiblePortionRadioButton;
private System.Windows.Forms.Button selectedViewSheetSetButton;
private System.Windows.Forms.GroupBox settingsGroupBox;
private System.Windows.Forms.Label numberofcoyiesLabel;
private System.Windows.Forms.CheckBox collateCheckBox;
private System.Windows.Forms.CheckBox orderCheckBox;
private System.Windows.Forms.Button setupButton;
private System.Windows.Forms.Label printSetupNameLabel;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.NumericUpDown copiesNumericUpDown;
private System.Windows.Forms.Button closeButton;
}
}
+324
View File
@@ -0,0 +1,324 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public partial class PrintMgrForm : System.Windows.Forms.Form
{
private PrintMgr m_printMgr;
public PrintMgrForm(PrintMgr printMgr)
{
if (null == printMgr)
{
throw new ArgumentNullException("printMgr");
}
else
{
m_printMgr = printMgr;
}
InitializeComponent();
}
private void setupButton_Click(object sender, EventArgs e)
{
m_printMgr.ChangePrintSetup();
printSetupNameLabel.Text = m_printMgr.PrintSetupName;
}
/// <summary>
/// Initialize the UI data.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PrintMgrForm_Load(object sender, EventArgs e)
{
printerNameComboBox.DataSource = m_printMgr.InstalledPrinterNames;
// the selectedValueChange event have to add event handler after
// data source be set, or else the delegate method will be invoked meaningless.
this.printerNameComboBox.SelectedValueChanged += new System.EventHandler(this.printerNameComboBox_SelectedValueChanged);
printerNameComboBox.SelectedItem = m_printMgr.PrinterName;
if (m_printMgr.VerifyPrintToFile(printToFileCheckBox))
{
printToFileCheckBox.Checked = m_printMgr.IsPrintToFile;
}
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(copiesNumericUpDown);
controlsToEnableOrNot.Add(numberofcoyiesLabel);
m_printMgr.VerifyCopies(controlsToEnableOrNot);
controlsToEnableOrNot.Clear();
controlsToEnableOrNot.Add(printToFileNameLabel);
controlsToEnableOrNot.Add(printToFileNameTextBox);
controlsToEnableOrNot.Add(browseButton);
m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);
m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
if (m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton))
{
singleFileRadioButton.Checked = m_printMgr.IsCombinedFile;
separateFileRadioButton.Checked = !m_printMgr.IsCombinedFile;
}
if (!m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton)
&& m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton))
{
separateFileRadioButton.Checked = true;
}
this.singleFileRadioButton.CheckedChanged += new System.EventHandler(this.combineRadioButton_CheckedChanged);
switch (m_printMgr.PrintRange)
{
case PrintRange.Current:
currentWindowRadioButton.Checked = true;
break;
case PrintRange.Select:
selectedViewsRadioButton.Checked = true;
break;
case PrintRange.Visible:
visiblePortionRadioButton.Checked = true;
break;
default:
break;
}
this.currentWindowRadioButton.CheckedChanged += new System.EventHandler(this.currentWindowRadioButton_CheckedChanged);
this.visiblePortionRadioButton.CheckedChanged += new System.EventHandler(this.visiblePortionRadioButton_CheckedChanged);
this.selectedViewsRadioButton.CheckedChanged += new System.EventHandler(this.selectedViewsRadioButton_CheckedChanged);
this.printToFileNameTextBox.Text = Environment.GetFolderPath(
Environment.SpecialFolder.MyDocuments) + "\\" + m_printMgr.DocumentTitle;
controlsToEnableOrNot.Clear();
controlsToEnableOrNot.Add(selectedViewSheetSetLabel);
controlsToEnableOrNot.Add(selectedViewSheetSetButton);
if (m_printMgr.VerifySelectViewSheetSet(controlsToEnableOrNot))
{
this.selectedViewSheetSetLabel.Text = m_printMgr.SelectedViewSheetSetName;
}
orderCheckBox.Checked = m_printMgr.PrintOrderReverse;
this.orderCheckBox.CheckedChanged += new System.EventHandler(this.orderCheckBox_CheckedChanged);
if (m_printMgr.VerifyCollate(collateCheckBox))
{
collateCheckBox.Checked = m_printMgr.Collate;
}
this.collateCheckBox.CheckedChanged += new System.EventHandler(this.collateCheckBox_CheckedChanged);
printSetupNameLabel.Text = m_printMgr.PrintSetupName;
}
private void printerNameComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printMgr.PrinterName = printerNameComboBox.SelectedItem as string;
// Verify the relative controls is enable or not, according to the printer changed.
m_printMgr.VerifyPrintToFile(printToFileCheckBox);
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(copiesNumericUpDown);
controlsToEnableOrNot.Add(numberofcoyiesLabel);
m_printMgr.VerifyCopies(controlsToEnableOrNot);
controlsToEnableOrNot.Clear();
controlsToEnableOrNot.Add(printToFileNameLabel);
controlsToEnableOrNot.Add(printToFileNameTextBox);
controlsToEnableOrNot.Add(browseButton);
if (!string.IsNullOrEmpty(printToFileNameTextBox.Text))
{
printToFileNameTextBox.Text = printToFileNameTextBox.Text.Remove(
printToFileNameTextBox.Text.LastIndexOf(".")) + m_printMgr.PostFix;
}
m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);
m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton);
}
private void printToFileCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printMgr.IsPrintToFile = printToFileCheckBox.Checked;
// Verify the relative controls is enable or not, according to the print to file
// check box is checked or not.
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(copiesNumericUpDown);
controlsToEnableOrNot.Add(numberofcoyiesLabel);
m_printMgr.VerifyCopies(controlsToEnableOrNot);
controlsToEnableOrNot.Clear();
controlsToEnableOrNot.Add(printToFileNameLabel);
controlsToEnableOrNot.Add(printToFileNameTextBox);
controlsToEnableOrNot.Add(browseButton);
m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);
m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
}
private void combineRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton))
{
m_printMgr.IsCombinedFile = singleFileRadioButton.Checked;
}
}
private void browseButton_Click(object sender, EventArgs e)
{
string newName = m_printMgr.ChangePrintToFileName();
if (!string.IsNullOrEmpty(newName))
{
printToFileNameTextBox.Text = newName;
}
}
private void currentWindowRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (currentWindowRadioButton.Checked)
{
m_printMgr.PrintRange = Autodesk.Revit.DB.PrintRange.Current;
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(selectedViewSheetSetLabel);
controlsToEnableOrNot.Add(selectedViewSheetSetButton);
m_printMgr.VerifySelectViewSheetSet(controlsToEnableOrNot);
if (m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton))
{
m_printMgr.IsCombinedFile = true;
singleFileRadioButton.Checked = true;
separateFileRadioButton.Checked = false;
}
m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton);
m_printMgr.VerifyCollate(collateCheckBox);
}
}
private void visiblePortionRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (visiblePortionRadioButton.Checked)
{
m_printMgr.PrintRange = Autodesk.Revit.DB.PrintRange.Visible;
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(selectedViewSheetSetLabel);
controlsToEnableOrNot.Add(selectedViewSheetSetButton);
m_printMgr.VerifySelectViewSheetSet(controlsToEnableOrNot);
if (m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton))
{
m_printMgr.IsCombinedFile = true;
singleFileRadioButton.Checked = true;
separateFileRadioButton.Checked = false;
}
m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton);
m_printMgr.VerifyCollate(collateCheckBox);
}
}
private void selectedViewsRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (selectedViewsRadioButton.Checked)
{
m_printMgr.PrintRange = Autodesk.Revit.DB.PrintRange.Select;
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(selectedViewSheetSetLabel);
controlsToEnableOrNot.Add(selectedViewSheetSetButton);
m_printMgr.VerifySelectViewSheetSet(controlsToEnableOrNot);
m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
if (m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton))
{
separateFileRadioButton.Checked = true;
}
m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton);
m_printMgr.VerifyCollate(collateCheckBox);
}
}
private void orderCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printMgr.PrintOrderReverse = orderCheckBox.Checked;
}
private void collateCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printMgr.Collate = collateCheckBox.Checked;
}
private void selectButton_Click(object sender, EventArgs e)
{
m_printMgr.SelectViewSheetSet();
selectedViewSheetSetLabel.Text = m_printMgr.SelectedViewSheetSetName;
}
private void copiesNumericUpDown_ValueChanged(object sender, EventArgs e)
{
try
{
m_printMgr.CopyNumber = (int)(copiesNumericUpDown.Value);
}
catch (InvalidOperationException)
{
collateCheckBox.Enabled = false;
return;
}
m_printMgr.VerifyCollate(collateCheckBox);
}
private void okButton_Click(object sender, EventArgs e)
{
try
{
m_printMgr.SubmitPrint();
}
catch (Exception)
{
PrintMgr.MyMessageBox("Print Failed");
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+481
View File
@@ -0,0 +1,481 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
/// <summary>
/// Change and save printer setup setting, exposes the print parameters just
/// like the Print Setup Dialog (File->Print Setup...) in UI such as Printer name,
/// paper, zoom, options, etc.
/// </summary>
public class PrintSTP : ISettingNameOperation
{
private ExternalCommandData m_commandData;
private PrintManager m_printMgr;
public PrintSTP(PrintManager printMgr
, ExternalCommandData commandData)
{
m_commandData = commandData;
m_printMgr = printMgr;
}
public string PrinterName
{
get
{
return m_printMgr.PrinterName;
}
}
public string Prefix
{
get
{
return "Default ";
}
}
public int SettingCount
{
get
{
return m_commandData.Application.ActiveUIDocument.Document.GetPrintSettingIds().Count;
}
}
public bool SaveAs(string newName)
{
try
{
return m_printMgr.PrintSetup.SaveAs(newName);
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public bool Rename(string name)
{
try
{
return m_printMgr.PrintSetup.Rename(name);
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public List<string> PrintSettingNames
{
get
{
List<string> names = new List<string>();
//foreach (Element printSetting in m_commandData.Application.ActiveUIDocument.Document.PrintSettings)
ICollection<ElementId> printSettingIds = m_commandData.Application.ActiveUIDocument.Document.GetPrintSettingIds();
foreach (ElementId eid in printSettingIds)
{
Element printSetting = m_commandData.Application.ActiveUIDocument.Document.GetElement(eid);
names.Add(printSetting.Name);
}
names.Add(ConstData.InSessionName);
return names;
}
}
public string SettingName
{
get
{
IPrintSetting setting = m_printMgr.PrintSetup.CurrentPrintSetting;
return (setting is PrintSetting) ?
(setting as PrintSetting).Name : ConstData.InSessionName;
}
set
{
if (value == ConstData.InSessionName)
{
m_printMgr.PrintSetup.CurrentPrintSetting = m_printMgr.PrintSetup.InSession;
return;
}
//foreach (Element printSetting in m_commandData.Application.ActiveUIDocument.Document.PrintSettings)
ICollection<ElementId> printSettingIds = m_commandData.Application.ActiveUIDocument.Document.GetPrintSettingIds();
foreach (ElementId eid in printSettingIds)
{
Element printSetting = m_commandData.Application.ActiveUIDocument.Document.GetElement(eid);
if (printSetting.Name.Equals(value))
{
m_printMgr.PrintSetup.CurrentPrintSetting = printSetting as PrintSetting;
}
}
}
}
public List<string> PaperSizes
{
get
{
List<string> names = new List<string>();
foreach (PaperSize ps in m_printMgr.PaperSizes)
{
names.Add(ps.Name);
}
return names;
}
}
public string PaperSize
{
get
{
try
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSize.Name;
}
catch (Exception)
{
return null;
}
}
set
{
foreach (PaperSize ps in m_printMgr.PaperSizes)
{
if (ps.Name.Equals(value))
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSize = ps;
break;
}
}
}
}
public List<string> PaperSources
{
get
{
List<string> names = new List<string>();
foreach (PaperSource ps in m_printMgr.PaperSources)
{
names.Add(ps.Name);
}
return names;
}
}
public string PaperSource
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSource.Name;
}
set
{
foreach (PaperSource ps in m_printMgr.PaperSources)
{
if (ps.Name.Equals(value))
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSource = ps;
break;
}
}
}
}
public PageOrientationType PageOrientation
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PageOrientation;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PageOrientation = value;
}
}
public PaperPlacementType PaperPlacement
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement = value;
}
}
public Array MarginTypes
{
get
{
return Enum.GetValues(typeof(MarginType));
}
}
public MarginType SelectedMarginType
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.MarginType;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.MarginType = value;
}
}
public double OriginOffsetX
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.OriginOffsetX;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.OriginOffsetX = value;
}
}
public double OriginOffsetY
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.OriginOffsetY;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.OriginOffsetY = value;
}
}
public HiddenLineViewsType HiddenLineViews
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews = value;
}
}
public int Zoom
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.Zoom;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.Zoom = value;
}
}
public ZoomType ZoomType
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = value;
}
}
public Array RasterQualities
{
get
{
return Enum.GetValues(typeof(RasterQualityType));
}
}
public RasterQualityType RasterQuality
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.RasterQuality;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.RasterQuality = value;
}
}
public Array Colors
{
get
{
return Enum.GetValues(typeof(ColorDepthType));
}
}
public ColorDepthType Color
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth = value;
}
}
public bool ViewLinksinBlue
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ViewLinksinBlue;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.ViewLinksinBlue = value;
}
}
public bool HideScopeBoxes
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideScopeBoxes;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideScopeBoxes = value;
}
}
public bool HideReforWorkPlanes
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideReforWorkPlanes;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideReforWorkPlanes = value;
}
}
public bool HideCropBoundaries
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideCropBoundaries;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideCropBoundaries = value;
}
}
public bool HideUnreferencedViewTags
{
get
{
return m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideUnreferencedViewTags;
}
set
{
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.HideUnreferencedViewTags = value;
}
}
public bool Save()
{
try
{
return m_printMgr.PrintSetup.Save();
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public void Revert()
{
try
{
m_printMgr.PrintSetup.Revert();
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
}
}
public bool Delete()
{
try
{
return m_printMgr.PrintSetup.Delete();
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public bool VerifyMarginType(System.Windows.Forms.Control controlToEnableOrNot)
{
// Enable terms (or):
// 1. Paper placement is LowerLeft.
return controlToEnableOrNot.Enabled =
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement == PaperPlacementType.LowerLeft;
}
public bool VerifyUserDefinedMargin(Collection<System.Windows.Forms.Control> controlsToEnableOrNot)
{
bool enableOrNot =
m_printMgr.PrintSetup.CurrentPrintSetting.PrintParameters.MarginType == MarginType.UserDefined;
foreach (System.Windows.Forms.Control control in controlsToEnableOrNot)
{
control.Enabled = enableOrNot;
}
return enableOrNot;
}
}
}
+707
View File
@@ -0,0 +1,707 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.ViewPrinter.CS
{
partial class PrintSetupForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.printerNameLabel = new System.Windows.Forms.Label();
this.printSetupsComboBox = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.paperSourceComboBox = new System.Windows.Forms.ComboBox();
this.paperSizeComboBox = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.landscapeRadioButton = new System.Windows.Forms.RadioButton();
this.portraitRadioButton = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.userDefinedMarginYTextBox = new System.Windows.Forms.TextBox();
this.userDefinedMarginXTextBox = new System.Windows.Forms.TextBox();
this.marginTypeComboBox = new System.Windows.Forms.ComboBox();
this.offsetRadioButton = new System.Windows.Forms.RadioButton();
this.centerRadioButton = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.rasterRadioButton = new System.Windows.Forms.RadioButton();
this.vectorRadioButton = new System.Windows.Forms.RadioButton();
this.label7 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.zoomPercentNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.label8 = new System.Windows.Forms.Label();
this.zoomRadioButton = new System.Windows.Forms.RadioButton();
this.fitToPageRadioButton = new System.Windows.Forms.RadioButton();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.label10 = new System.Windows.Forms.Label();
this.colorsComboBox = new System.Windows.Forms.ComboBox();
this.rasterQualityComboBox = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.hideCropBoundariesCheckBox = new System.Windows.Forms.CheckBox();
this.hideScopeBoxedCheckBox = new System.Windows.Forms.CheckBox();
this.hideUnreferencedViewTagsCheckBox = new System.Windows.Forms.CheckBox();
this.hideRefWorkPlanesCheckBox = new System.Windows.Forms.CheckBox();
this.ViewLinksInBlueCheckBox = new System.Windows.Forms.CheckBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button();
this.saveAsButton = new System.Windows.Forms.Button();
this.revertButton = new System.Windows.Forms.Button();
this.renameButton = new System.Windows.Forms.Button();
this.deleteButton = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.zoomPercentNumericUpDown)).BeginInit();
this.groupBox6.SuspendLayout();
this.groupBox7.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Printer:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 35);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(38, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Name:";
//
// printerNameLabel
//
this.printerNameLabel.AutoSize = true;
this.printerNameLabel.Location = new System.Drawing.Point(58, 9);
this.printerNameLabel.Name = "printerNameLabel";
this.printerNameLabel.Size = new System.Drawing.Size(33, 13);
this.printerNameLabel.TabIndex = 0;
this.printerNameLabel.Text = "blank";
//
// printSetupsComboBox
//
this.printSetupsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.printSetupsComboBox.FormattingEnabled = true;
this.printSetupsComboBox.Location = new System.Drawing.Point(56, 32);
this.printSetupsComboBox.Name = "printSetupsComboBox";
this.printSetupsComboBox.Size = new System.Drawing.Size(358, 21);
this.printSetupsComboBox.TabIndex = 1;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.paperSourceComboBox);
this.groupBox1.Controls.Add(this.paperSizeComboBox);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(15, 75);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 77);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Paper";
//
// paperSourceComboBox
//
this.paperSourceComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.paperSourceComboBox.FormattingEnabled = true;
this.paperSourceComboBox.Location = new System.Drawing.Point(73, 44);
this.paperSourceComboBox.Name = "paperSourceComboBox";
this.paperSourceComboBox.Size = new System.Drawing.Size(121, 21);
this.paperSourceComboBox.TabIndex = 1;
//
// paperSizeComboBox
//
this.paperSizeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.paperSizeComboBox.FormattingEnabled = true;
this.paperSizeComboBox.Location = new System.Drawing.Point(73, 20);
this.paperSizeComboBox.Name = "paperSizeComboBox";
this.paperSizeComboBox.Size = new System.Drawing.Size(121, 21);
this.paperSizeComboBox.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 47);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 13);
this.label4.TabIndex = 0;
this.label4.Text = "S&ource:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 23);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(30, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Size:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.landscapeRadioButton);
this.groupBox2.Controls.Add(this.portraitRadioButton);
this.groupBox2.Location = new System.Drawing.Point(221, 75);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 77);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Orientation";
//
// landscapeRadioButton
//
this.landscapeRadioButton.AutoSize = true;
this.landscapeRadioButton.Location = new System.Drawing.Point(108, 48);
this.landscapeRadioButton.Name = "landscapeRadioButton";
this.landscapeRadioButton.Size = new System.Drawing.Size(78, 17);
this.landscapeRadioButton.TabIndex = 0;
this.landscapeRadioButton.TabStop = true;
this.landscapeRadioButton.Text = "&Landscape";
this.landscapeRadioButton.UseVisualStyleBackColor = true;
//
// portraitRadioButton
//
this.portraitRadioButton.AutoSize = true;
this.portraitRadioButton.Location = new System.Drawing.Point(108, 24);
this.portraitRadioButton.Name = "portraitRadioButton";
this.portraitRadioButton.Size = new System.Drawing.Size(58, 17);
this.portraitRadioButton.TabIndex = 0;
this.portraitRadioButton.TabStop = true;
this.portraitRadioButton.Text = "&Portrait";
this.portraitRadioButton.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.userDefinedMarginYTextBox);
this.groupBox3.Controls.Add(this.userDefinedMarginXTextBox);
this.groupBox3.Controls.Add(this.marginTypeComboBox);
this.groupBox3.Controls.Add(this.offsetRadioButton);
this.groupBox3.Controls.Add(this.centerRadioButton);
this.groupBox3.Location = new System.Drawing.Point(15, 158);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(200, 100);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Paper Placement";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(176, 72);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 3;
this.label6.Text = "=y";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(114, 72);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 3;
this.label5.Text = "=x";
//
// userDefinedMarginYTextBox
//
this.userDefinedMarginYTextBox.Location = new System.Drawing.Point(138, 69);
this.userDefinedMarginYTextBox.Name = "userDefinedMarginYTextBox";
this.userDefinedMarginYTextBox.Size = new System.Drawing.Size(35, 20);
this.userDefinedMarginYTextBox.TabIndex = 2;
this.userDefinedMarginYTextBox.Text = 0.000.ToString("0.000");
//
// userDefinedMarginXTextBox
//
this.userDefinedMarginXTextBox.Location = new System.Drawing.Point(73, 69);
this.userDefinedMarginXTextBox.Name = "userDefinedMarginXTextBox";
this.userDefinedMarginXTextBox.Size = new System.Drawing.Size(35, 20);
this.userDefinedMarginXTextBox.TabIndex = 2;
this.userDefinedMarginXTextBox.Text = 0.000.ToString("0.000");
//
// marginTypeComboBox
//
this.marginTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.marginTypeComboBox.FormattingEnabled = true;
this.marginTypeComboBox.Location = new System.Drawing.Point(73, 42);
this.marginTypeComboBox.Name = "marginTypeComboBox";
this.marginTypeComboBox.Size = new System.Drawing.Size(121, 21);
this.marginTypeComboBox.TabIndex = 1;
//
// offsetRadioButton
//
this.offsetRadioButton.AutoSize = true;
this.offsetRadioButton.Location = new System.Drawing.Point(73, 19);
this.offsetRadioButton.Name = "offsetRadioButton";
this.offsetRadioButton.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.offsetRadioButton.Size = new System.Drawing.Size(109, 17);
this.offsetRadioButton.TabIndex = 0;
this.offsetRadioButton.TabStop = true;
this.offsetRadioButton.Text = "Offset fro&m corner";
this.offsetRadioButton.UseVisualStyleBackColor = true;
//
// centerRadioButton
//
this.centerRadioButton.AutoSize = true;
this.centerRadioButton.Location = new System.Drawing.Point(9, 19);
this.centerRadioButton.Name = "centerRadioButton";
this.centerRadioButton.Size = new System.Drawing.Size(56, 17);
this.centerRadioButton.TabIndex = 0;
this.centerRadioButton.TabStop = true;
this.centerRadioButton.Text = "&Center";
this.centerRadioButton.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.rasterRadioButton);
this.groupBox4.Controls.Add(this.vectorRadioButton);
this.groupBox4.Controls.Add(this.label7);
this.groupBox4.Location = new System.Drawing.Point(221, 158);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(200, 100);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Hidden Line Views";
//
// rasterRadioButton
//
this.rasterRadioButton.AutoSize = true;
this.rasterRadioButton.Location = new System.Drawing.Point(9, 68);
this.rasterRadioButton.Name = "rasterRadioButton";
this.rasterRadioButton.Size = new System.Drawing.Size(111, 17);
this.rasterRadioButton.TabIndex = 1;
this.rasterRadioButton.TabStop = true;
this.rasterRadioButton.Text = "Raster Processin&g";
this.rasterRadioButton.UseVisualStyleBackColor = true;
//
// vectorRadioButton
//
this.vectorRadioButton.AutoSize = true;
this.vectorRadioButton.Location = new System.Drawing.Point(9, 42);
this.vectorRadioButton.Name = "vectorRadioButton";
this.vectorRadioButton.Size = new System.Drawing.Size(146, 17);
this.vectorRadioButton.TabIndex = 1;
this.vectorRadioButton.TabStop = true;
this.vectorRadioButton.Text = "V&ector Processing (faster)";
this.vectorRadioButton.UseVisualStyleBackColor = true;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 21);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(102, 13);
this.label7.TabIndex = 0;
this.label7.Text = "Remove lines using:";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.zoomPercentNumericUpDown);
this.groupBox5.Controls.Add(this.label8);
this.groupBox5.Controls.Add(this.zoomRadioButton);
this.groupBox5.Controls.Add(this.fitToPageRadioButton);
this.groupBox5.Location = new System.Drawing.Point(15, 264);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(200, 100);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Zoom";
//
// zoomPercentNumericUpDown
//
this.zoomPercentNumericUpDown.Location = new System.Drawing.Point(86, 42);
this.zoomPercentNumericUpDown.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.zoomPercentNumericUpDown.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.zoomPercentNumericUpDown.Name = "zoomPercentNumericUpDown";
this.zoomPercentNumericUpDown.Size = new System.Drawing.Size(46, 20);
this.zoomPercentNumericUpDown.TabIndex = 3;
this.zoomPercentNumericUpDown.Value = new decimal(new int[] {
100,
0,
0,
0});
this.zoomPercentNumericUpDown.ValueChanged += new System.EventHandler(this.zoomPercentNumericUpDown_ValueChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(138, 44);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(36, 13);
this.label8.TabIndex = 2;
this.label8.Text = "% size";
//
// zoomRadioButton
//
this.zoomRadioButton.AutoSize = true;
this.zoomRadioButton.Location = new System.Drawing.Point(6, 42);
this.zoomRadioButton.Name = "zoomRadioButton";
this.zoomRadioButton.Size = new System.Drawing.Size(55, 17);
this.zoomRadioButton.TabIndex = 0;
this.zoomRadioButton.TabStop = true;
this.zoomRadioButton.Text = "&Zoom:";
this.zoomRadioButton.UseVisualStyleBackColor = true;
//
// fitToPageRadioButton
//
this.fitToPageRadioButton.AutoSize = true;
this.fitToPageRadioButton.Location = new System.Drawing.Point(6, 19);
this.fitToPageRadioButton.Name = "fitToPageRadioButton";
this.fitToPageRadioButton.Size = new System.Drawing.Size(75, 17);
this.fitToPageRadioButton.TabIndex = 0;
this.fitToPageRadioButton.TabStop = true;
this.fitToPageRadioButton.Text = "&Fit to page";
this.fitToPageRadioButton.UseVisualStyleBackColor = true;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.label10);
this.groupBox6.Controls.Add(this.colorsComboBox);
this.groupBox6.Controls.Add(this.rasterQualityComboBox);
this.groupBox6.Controls.Add(this.label9);
this.groupBox6.Location = new System.Drawing.Point(221, 264);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(200, 100);
this.groupBox6.TabIndex = 2;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Appearance";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 56);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(39, 13);
this.label10.TabIndex = 2;
this.label10.Text = "Colo&rs:";
//
// colorsComboBox
//
this.colorsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.colorsComboBox.FormattingEnabled = true;
this.colorsComboBox.Location = new System.Drawing.Point(9, 72);
this.colorsComboBox.Name = "colorsComboBox";
this.colorsComboBox.Size = new System.Drawing.Size(121, 21);
this.colorsComboBox.TabIndex = 1;
//
// rasterQualityComboBox
//
this.rasterQualityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.rasterQualityComboBox.FormattingEnabled = true;
this.rasterQualityComboBox.Location = new System.Drawing.Point(9, 32);
this.rasterQualityComboBox.Name = "rasterQualityComboBox";
this.rasterQualityComboBox.Size = new System.Drawing.Size(121, 21);
this.rasterQualityComboBox.TabIndex = 1;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 16);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(74, 13);
this.label9.TabIndex = 0;
this.label9.Text = "Raster &quality:";
//
// groupBox7
//
this.groupBox7.Controls.Add(this.hideCropBoundariesCheckBox);
this.groupBox7.Controls.Add(this.hideScopeBoxedCheckBox);
this.groupBox7.Controls.Add(this.hideUnreferencedViewTagsCheckBox);
this.groupBox7.Controls.Add(this.hideRefWorkPlanesCheckBox);
this.groupBox7.Controls.Add(this.ViewLinksInBlueCheckBox);
this.groupBox7.Location = new System.Drawing.Point(15, 370);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(406, 100);
this.groupBox7.TabIndex = 2;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "Options";
//
// hideCropBoundariesCheckBox
//
this.hideCropBoundariesCheckBox.AutoSize = true;
this.hideCropBoundariesCheckBox.Location = new System.Drawing.Point(206, 42);
this.hideCropBoundariesCheckBox.Name = "hideCropBoundariesCheckBox";
this.hideCropBoundariesCheckBox.Size = new System.Drawing.Size(127, 17);
this.hideCropBoundariesCheckBox.TabIndex = 4;
this.hideCropBoundariesCheckBox.Text = "Hide crop &boundaries";
this.hideCropBoundariesCheckBox.UseVisualStyleBackColor = true;
//
// hideScopeBoxedCheckBox
//
this.hideScopeBoxedCheckBox.AutoSize = true;
this.hideScopeBoxedCheckBox.Location = new System.Drawing.Point(206, 19);
this.hideScopeBoxedCheckBox.Name = "hideScopeBoxedCheckBox";
this.hideScopeBoxedCheckBox.Size = new System.Drawing.Size(112, 17);
this.hideScopeBoxedCheckBox.TabIndex = 4;
this.hideScopeBoxedCheckBox.Text = "Hide scope bo&xed";
this.hideScopeBoxedCheckBox.UseVisualStyleBackColor = true;
//
// hideUnreferencedViewTagsCheckBox
//
this.hideUnreferencedViewTagsCheckBox.AutoSize = true;
this.hideUnreferencedViewTagsCheckBox.Location = new System.Drawing.Point(6, 65);
this.hideUnreferencedViewTagsCheckBox.Name = "hideUnreferencedViewTagsCheckBox";
this.hideUnreferencedViewTagsCheckBox.Size = new System.Drawing.Size(162, 17);
this.hideUnreferencedViewTagsCheckBox.TabIndex = 4;
this.hideUnreferencedViewTagsCheckBox.Text = "Hide &unreferenced view tags";
this.hideUnreferencedViewTagsCheckBox.UseVisualStyleBackColor = true;
//
// hideRefWorkPlanesCheckBox
//
this.hideRefWorkPlanesCheckBox.AutoSize = true;
this.hideRefWorkPlanesCheckBox.Location = new System.Drawing.Point(6, 42);
this.hideRefWorkPlanesCheckBox.Name = "hideRefWorkPlanesCheckBox";
this.hideRefWorkPlanesCheckBox.Size = new System.Drawing.Size(125, 17);
this.hideRefWorkPlanesCheckBox.TabIndex = 4;
this.hideRefWorkPlanesCheckBox.Text = "Hide ref/&work planes";
this.hideRefWorkPlanesCheckBox.UseVisualStyleBackColor = true;
//
// ViewLinksInBlueCheckBox
//
this.ViewLinksInBlueCheckBox.AutoSize = true;
this.ViewLinksInBlueCheckBox.Location = new System.Drawing.Point(6, 19);
this.ViewLinksInBlueCheckBox.Name = "ViewLinksInBlueCheckBox";
this.ViewLinksInBlueCheckBox.Size = new System.Drawing.Size(107, 17);
this.ViewLinksInBlueCheckBox.TabIndex = 4;
this.ViewLinksInBlueCheckBox.Text = "View lin&ks in blue";
this.ViewLinksInBlueCheckBox.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(388, 487);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(469, 487);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// saveButton
//
this.saveButton.Location = new System.Drawing.Point(469, 35);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(75, 23);
this.saveButton.TabIndex = 3;
this.saveButton.Text = "&Save";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// saveAsButton
//
this.saveAsButton.Location = new System.Drawing.Point(469, 64);
this.saveAsButton.Name = "saveAsButton";
this.saveAsButton.Size = new System.Drawing.Size(75, 23);
this.saveAsButton.TabIndex = 3;
this.saveAsButton.Text = "Sa&veAs...";
this.saveAsButton.UseVisualStyleBackColor = true;
this.saveAsButton.Click += new System.EventHandler(this.saveAsButton_Click);
//
// revertButton
//
this.revertButton.Enabled = false;
this.revertButton.Location = new System.Drawing.Point(469, 93);
this.revertButton.Name = "revertButton";
this.revertButton.Size = new System.Drawing.Size(75, 23);
this.revertButton.TabIndex = 3;
this.revertButton.Text = "Rever&t";
this.revertButton.UseVisualStyleBackColor = true;
this.revertButton.Click += new System.EventHandler(this.revertButton_Click);
//
// renameButton
//
this.renameButton.Location = new System.Drawing.Point(469, 122);
this.renameButton.Name = "renameButton";
this.renameButton.Size = new System.Drawing.Size(75, 23);
this.renameButton.TabIndex = 3;
this.renameButton.Text = "Ren&ame";
this.renameButton.UseVisualStyleBackColor = true;
this.renameButton.Click += new System.EventHandler(this.renameButton_Click);
//
// deleteButton
//
this.deleteButton.Location = new System.Drawing.Point(469, 151);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(75, 23);
this.deleteButton.TabIndex = 3;
this.deleteButton.Text = "&Delete";
this.deleteButton.UseVisualStyleBackColor = true;
this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click);
//
// PrintSetupForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(556, 522);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.deleteButton);
this.Controls.Add(this.renameButton);
this.Controls.Add(this.revertButton);
this.Controls.Add(this.saveAsButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox7);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.printSetupsComboBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.printerNameLabel);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "PrintSetupForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Print Setup";
this.Load += new System.EventHandler(this.PrintSetupForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.zoomPercentNumericUpDown)).EndInit();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label printerNameLabel;
private System.Windows.Forms.ComboBox printSetupsComboBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button saveAsButton;
private System.Windows.Forms.Button revertButton;
private System.Windows.Forms.Button renameButton;
private System.Windows.Forms.Button deleteButton;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox paperSourceComboBox;
private System.Windows.Forms.ComboBox paperSizeComboBox;
private System.Windows.Forms.RadioButton landscapeRadioButton;
private System.Windows.Forms.RadioButton portraitRadioButton;
private System.Windows.Forms.RadioButton centerRadioButton;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox userDefinedMarginYTextBox;
private System.Windows.Forms.TextBox userDefinedMarginXTextBox;
private System.Windows.Forms.ComboBox marginTypeComboBox;
private System.Windows.Forms.RadioButton offsetRadioButton;
private System.Windows.Forms.RadioButton rasterRadioButton;
private System.Windows.Forms.RadioButton vectorRadioButton;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.RadioButton zoomRadioButton;
private System.Windows.Forms.RadioButton fitToPageRadioButton;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.ComboBox colorsComboBox;
private System.Windows.Forms.ComboBox rasterQualityComboBox;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.CheckBox hideCropBoundariesCheckBox;
private System.Windows.Forms.CheckBox hideScopeBoxedCheckBox;
private System.Windows.Forms.CheckBox hideUnreferencedViewTagsCheckBox;
private System.Windows.Forms.CheckBox hideRefWorkPlanesCheckBox;
private System.Windows.Forms.CheckBox ViewLinksInBlueCheckBox;
private System.Windows.Forms.NumericUpDown zoomPercentNumericUpDown;
}
}
@@ -0,0 +1,551 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public partial class PrintSetupForm : System.Windows.Forms.Form
{
private PrintSTP m_printSetup;
private bool m_stopUpdateFlag;
private readonly double INCHES_IN_FEET = 12.0 ;
public PrintSetupForm(PrintSTP printSetup)
{
m_printSetup = printSetup;
InitializeComponent();
}
private void PrintSetupForm_Load(object sender, EventArgs e)
{
printerNameLabel.Text = m_printSetup.PrinterName;
printSetupsComboBox.DataSource = m_printSetup.PrintSettingNames;
printSetupsComboBox.SelectedItem = m_printSetup.SettingName;
this.printSetupsComboBox.SelectedValueChanged += new System.EventHandler(this.printSetupsComboBox_SelectedValueChanged);
renameButton.Enabled = deleteButton.Enabled =
m_printSetup.SettingName.Equals("<In-Session>") ? false : true;
paperSizeComboBox.DataSource = m_printSetup.PaperSizes;
paperSizeComboBox.SelectedItem = m_printSetup.PaperSize;
this.paperSizeComboBox.SelectedValueChanged += new System.EventHandler(this.sizeComboBox_SelectedValueChanged);
paperSourceComboBox.DataSource = m_printSetup.PaperSources;
paperSourceComboBox.SelectedItem = m_printSetup.PaperSource;
this.paperSourceComboBox.SelectedValueChanged += new System.EventHandler(this.sourceComboBox_SelectedValueChanged);
if (m_printSetup.PageOrientation == PageOrientationType.Landscape)
{
landscapeRadioButton.Checked = true;
}
else
{
portraitRadioButton.Checked = true;
}
this.landscapeRadioButton.CheckedChanged += new System.EventHandler(this.landscapeRadioButton_CheckedChanged);
this.portraitRadioButton.CheckedChanged += new System.EventHandler(this.portraitRadioButton_CheckedChanged);
marginTypeComboBox.DataSource = m_printSetup.MarginTypes;
this.offsetRadioButton.CheckedChanged += new System.EventHandler(this.offsetRadioButton_CheckedChanged);
this.centerRadioButton.CheckedChanged += new System.EventHandler(this.centerRadioButton_CheckedChanged);
this.userDefinedMarginYTextBox.TextChanged += new System.EventHandler(this.userDefinedMarginYTextBox_TextChanged);
this.userDefinedMarginXTextBox.TextChanged += new System.EventHandler(this.userDefinedMarginXTextBox_TextChanged);
marginTypeComboBox.SelectedItem = m_printSetup.SelectedMarginType;
this.marginTypeComboBox.SelectedValueChanged += new System.EventHandler(this.marginTypeComboBox_SelectedValueChanged);
if (m_printSetup.PaperPlacement == PaperPlacementType.Center)
{
centerRadioButton.Checked = true;
offsetRadioButton.Checked = false;
}
else
{
offsetRadioButton.Checked = true;
centerRadioButton.Checked = false;
}
if (m_printSetup.HiddenLineViews == HiddenLineViewsType.RasterProcessing)
{
rasterRadioButton.Checked = true;
}
else
{
vectorRadioButton.Checked = true;
}
this.rasterRadioButton.CheckedChanged += new System.EventHandler(this.rasterRadioButton_CheckedChanged);
this.vectorRadioButton.CheckedChanged += new System.EventHandler(this.vectorRadioButton_CheckedChanged);
if (m_printSetup.ZoomType == ZoomType.Zoom)
{
zoomRadioButton.Checked = true;
zoomPercentNumericUpDown.Value = m_printSetup.Zoom;
}
else
{
fitToPageRadioButton.Checked = true;
}
this.zoomRadioButton.CheckedChanged += new System.EventHandler(this.zoomRadioButton_CheckedChanged);
this.fitToPageRadioButton.CheckedChanged += new System.EventHandler(this.fitToPageRadioButton_CheckedChanged);
rasterQualityComboBox.DataSource = m_printSetup.RasterQualities;
rasterQualityComboBox.SelectedItem = m_printSetup.RasterQuality;
this.rasterQualityComboBox.SelectedValueChanged += new System.EventHandler(this.rasterQualityComboBox_SelectedValueChanged);
colorsComboBox.DataSource = m_printSetup.Colors;
colorsComboBox.SelectedItem = m_printSetup.Color;
this.colorsComboBox.SelectedValueChanged += new System.EventHandler(this.colorsComboBox_SelectedValueChanged);
ViewLinksInBlueCheckBox.Checked = m_printSetup.ViewLinksinBlue;
this.ViewLinksInBlueCheckBox.CheckedChanged += new System.EventHandler(this.ViewLinksInBlueCheckBox_CheckedChanged);
hideScopeBoxedCheckBox.Checked = m_printSetup.HideScopeBoxes;
this.hideScopeBoxedCheckBox.CheckedChanged += new System.EventHandler(this.hideScopeBoxedCheckBox_CheckedChanged);
hideRefWorkPlanesCheckBox.Checked = m_printSetup.HideReforWorkPlanes;
this.hideRefWorkPlanesCheckBox.CheckedChanged += new System.EventHandler(this.hideRefWorkPlanesCheckBox_CheckedChanged);
hideCropBoundariesCheckBox.Checked = m_printSetup.HideCropBoundaries;
this.hideCropBoundariesCheckBox.CheckedChanged += new System.EventHandler(this.hideCropBoundariesCheckBox_CheckedChanged);
hideUnreferencedViewTagsCheckBox.Checked = m_printSetup.HideUnreferencedViewTags;
this.hideUnreferencedViewTagsCheckBox.CheckedChanged += new System.EventHandler(this.hideUnreferencedViewTagsCheckBox_CheckedChanged);
}
private void saveButton_Click(object sender, EventArgs e)
{
m_printSetup.Save();
}
private void printSetupsComboBox_SelectedValueChanged(object sender, EventArgs e)
{
if (m_stopUpdateFlag)
return;
m_printSetup.SettingName = printSetupsComboBox.SelectedItem as string;
paperSizeComboBox.SelectedItem = m_printSetup.PaperSize;
paperSourceComboBox.SelectedItem = m_printSetup.PaperSource;
if (m_printSetup.PageOrientation == PageOrientationType.Landscape)
{
landscapeRadioButton.Checked = true;
}
else
{
portraitRadioButton.Checked = true;
}
if (m_printSetup.PaperPlacement == PaperPlacementType.Center)
{
centerRadioButton.Checked = true;
}
else
{
offsetRadioButton.Checked = true;
}
if (m_printSetup.VerifyMarginType(marginTypeComboBox))
{
marginTypeComboBox.SelectedItem = m_printSetup.SelectedMarginType;
}
if (m_printSetup.HiddenLineViews == HiddenLineViewsType.RasterProcessing)
{
rasterRadioButton.Checked = true;
}
else
{
vectorRadioButton.Checked = true;
}
if (m_printSetup.ZoomType == ZoomType.Zoom)
{
zoomRadioButton.Checked = true;
zoomPercentNumericUpDown.Value = m_printSetup.Zoom;
}
else
{
fitToPageRadioButton.Checked = true;
m_printSetup.ZoomType = ZoomType.Zoom;
zoomPercentNumericUpDown.Value = m_printSetup.Zoom;
m_printSetup.ZoomType = ZoomType.FitToPage;
}
rasterQualityComboBox.SelectedItem = m_printSetup.RasterQuality;
colorsComboBox.SelectedItem = m_printSetup.Color;
ViewLinksInBlueCheckBox.Checked = m_printSetup.ViewLinksinBlue;
hideScopeBoxedCheckBox.Checked = m_printSetup.HideScopeBoxes;
hideRefWorkPlanesCheckBox.Checked = m_printSetup.HideReforWorkPlanes;
hideCropBoundariesCheckBox.Checked = m_printSetup.HideCropBoundaries;
hideUnreferencedViewTagsCheckBox.Checked = m_printSetup.HideUnreferencedViewTags;
renameButton.Enabled = deleteButton.Enabled =
m_printSetup.SettingName.Equals("<In-Session>") ? false : true;
revertButton.Enabled = false;
}
private void sizeComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printSetup.PaperSize = paperSizeComboBox.SelectedItem as string;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void sourceComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printSetup.PaperSource = paperSourceComboBox.SelectedItem as string;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void portraitRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (portraitRadioButton.Checked)
{
m_printSetup.PageOrientation = PageOrientationType.Portrait;
}
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void landscapeRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (landscapeRadioButton.Checked)
{
m_printSetup.PageOrientation = PageOrientationType.Landscape;
}
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void centerRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (!centerRadioButton.Checked)
return;
m_printSetup.PaperPlacement = PaperPlacementType.Center;
m_printSetup.VerifyMarginType(marginTypeComboBox);
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(userDefinedMarginXTextBox);
controlsToEnableOrNot.Add(userDefinedMarginYTextBox);
if (m_printSetup.VerifyUserDefinedMargin(controlsToEnableOrNot))
{
userDefinedMarginXTextBox.Text = (m_printSetup.OriginOffsetX * INCHES_IN_FEET).ToString();
userDefinedMarginYTextBox.Text = (m_printSetup.OriginOffsetY * INCHES_IN_FEET).ToString();
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void offsetRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (!offsetRadioButton.Checked)
return;
m_printSetup.PaperPlacement = PaperPlacementType.LowerLeft;
m_printSetup.VerifyMarginType(marginTypeComboBox);
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(userDefinedMarginXTextBox);
controlsToEnableOrNot.Add(userDefinedMarginYTextBox);
if (m_printSetup.VerifyUserDefinedMargin(controlsToEnableOrNot))
{
userDefinedMarginXTextBox.Text = (m_printSetup.OriginOffsetX * INCHES_IN_FEET).ToString();
userDefinedMarginYTextBox.Text = (m_printSetup.OriginOffsetY * INCHES_IN_FEET).ToString();
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void marginTypeComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printSetup.SelectedMarginType = (MarginType)marginTypeComboBox.SelectedItem;
System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
controlsToEnableOrNot.Add(userDefinedMarginXTextBox);
controlsToEnableOrNot.Add(userDefinedMarginYTextBox);
if (m_printSetup.VerifyUserDefinedMargin(controlsToEnableOrNot))
{
userDefinedMarginXTextBox.Text = (m_printSetup.OriginOffsetX * INCHES_IN_FEET).ToString();
userDefinedMarginYTextBox.Text = (m_printSetup.OriginOffsetY * INCHES_IN_FEET).ToString();
}
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void vectorRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (vectorRadioButton.Checked)
{
m_printSetup.HiddenLineViews = HiddenLineViewsType.VectorProcessing;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void rasterRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (rasterRadioButton.Checked)
{
m_printSetup.HiddenLineViews = HiddenLineViewsType.RasterProcessing;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void fitToPageRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (fitToPageRadioButton.Checked)
{
m_printSetup.ZoomType = ZoomType.FitToPage;
centerRadioButton.Checked = true;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void zoomRadioButton_CheckedChanged(object sender, EventArgs e)
{
if (zoomRadioButton.Checked)
{
m_printSetup.ZoomType = ZoomType.Zoom;
offsetRadioButton.Checked = true;
m_printSetup.Zoom = (int)zoomPercentNumericUpDown.Value;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void zoomPercentNumericUpDown_ValueChanged(object sender, EventArgs e)
{
if (zoomRadioButton.Checked)
{
m_printSetup.Zoom = (int)zoomPercentNumericUpDown.Value;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
}
private void rasterQualityComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printSetup.RasterQuality = (RasterQualityType)rasterQualityComboBox.SelectedItem;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void colorsComboBox_SelectedValueChanged(object sender, EventArgs e)
{
m_printSetup.Color = (ColorDepthType)colorsComboBox.SelectedItem;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void ViewLinksInBlueCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printSetup.ViewLinksinBlue = ViewLinksInBlueCheckBox.Checked;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void hideScopeBoxedCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printSetup.HideScopeBoxes = hideScopeBoxedCheckBox.Checked;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void hideRefWorkPlanesCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printSetup.HideReforWorkPlanes = hideRefWorkPlanesCheckBox.Checked;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void hideCropBoundariesCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printSetup.HideCropBoundaries = hideCropBoundariesCheckBox.Checked;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void hideUnreferencedViewTagsCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_printSetup.HideUnreferencedViewTags = hideUnreferencedViewTagsCheckBox.Checked;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void userDefinedMarginXTextBox_TextChanged(object sender, EventArgs e)
{
double doubleValue;
if (!double.TryParse(userDefinedMarginXTextBox.Text, out doubleValue))
{
PrintMgr.MyMessageBox("Invalid input");
return;
}
m_printSetup.OriginOffsetX = doubleValue / INCHES_IN_FEET;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void userDefinedMarginYTextBox_TextChanged(object sender, EventArgs e)
{
double doubleValue;
if (!double.TryParse(userDefinedMarginYTextBox.Text, out doubleValue))
{
PrintMgr.MyMessageBox("Invalid input");
return;
}
m_printSetup.OriginOffsetY = doubleValue / INCHES_IN_FEET;
if (!revertButton.Enabled)
{
revertButton.Enabled = true;
}
}
private void saveAsButton_Click(object sender, EventArgs e)
{
using (SaveAsForm dlg = new SaveAsForm(m_printSetup))
{
dlg.ShowDialog();
}
m_stopUpdateFlag = true;
printSetupsComboBox.DataSource = m_printSetup.PrintSettingNames;
printSetupsComboBox.Update();
m_stopUpdateFlag = false;
printSetupsComboBox.SelectedItem = m_printSetup.SettingName;
}
private void renameButton_Click(object sender, EventArgs e)
{
using (ReNameForm dlg = new ReNameForm(m_printSetup))
{
dlg.ShowDialog();
}
m_stopUpdateFlag = true;
printSetupsComboBox.DataSource = m_printSetup.PrintSettingNames;
printSetupsComboBox.Update();
m_stopUpdateFlag = false;
printSetupsComboBox.SelectedItem = m_printSetup.SettingName;
}
private void revertButton_Click(object sender, EventArgs e)
{
m_printSetup.Revert();
printSetupsComboBox_SelectedValueChanged(null, null);
}
private void deleteButton_Click(object sender, EventArgs e)
{
m_printSetup.Delete();
m_stopUpdateFlag = true;
printSetupsComboBox.DataSource = m_printSetup.PrintSettingNames;
printSetupsComboBox.Update();
m_stopUpdateFlag = false;
printSetupsComboBox.SelectedItem = m_printSetup.SettingName;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,57 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ViewPrinter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ViewPrinter")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d93020f1-5a5f-4beb-b075-b59bb12d3c32")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+125
View File
@@ -0,0 +1,125 @@
namespace Revit.SDK.Samples.ViewPrinter.CS
{
partial class ReNameForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.previousNameTextBox = new System.Windows.Forms.TextBox();
this.newNameTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Previous:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 0;
this.label2.Text = "New:";
//
// previousNameTextBox
//
this.previousNameTextBox.Location = new System.Drawing.Point(69, 17);
this.previousNameTextBox.Name = "previousNameTextBox";
this.previousNameTextBox.Size = new System.Drawing.Size(211, 20);
this.previousNameTextBox.TabIndex = 1;
//
// newNameTextBox
//
this.newNameTextBox.Location = new System.Drawing.Point(69, 41);
this.newNameTextBox.Name = "newNameTextBox";
this.newNameTextBox.Size = new System.Drawing.Size(211, 20);
this.newNameTextBox.TabIndex = 1;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(124, 81);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 2;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(205, 81);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// ReNameForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(292, 116);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.newNameTextBox);
this.Controls.Add(this.previousNameTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ReNameForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Rename";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox previousNameTextBox;
private System.Windows.Forms.TextBox newNameTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
+29
View File
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public partial class ReNameForm : System.Windows.Forms.Form
{
public ReNameForm(ISettingNameOperation settingWithNameOperation)
{
InitializeComponent();
m_settingWithNameOperation = settingWithNameOperation;
previousNameTextBox.Text =
newNameTextBox.Text =
m_settingWithNameOperation.SettingName;
}
ISettingNameOperation m_settingWithNameOperation;
private void okButton_Click(object sender, EventArgs e)
{
m_settingWithNameOperation.Rename(newNameTextBox.Text);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file not shown.
+104
View File
@@ -0,0 +1,104 @@
namespace Revit.SDK.Samples.ViewPrinter.CS
{
partial class SaveAsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.newNameTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Name:";
//
// newNameTextBox
//
this.newNameTextBox.Location = new System.Drawing.Point(56, 9);
this.newNameTextBox.Name = "newNameTextBox";
this.newNameTextBox.Size = new System.Drawing.Size(224, 20);
this.newNameTextBox.TabIndex = 1;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(124, 42);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 2;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(205, 42);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// SaveAsForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(292, 77);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.newNameTextBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SaveAsForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "New";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox newNameTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public partial class SaveAsForm : System.Windows.Forms.Form
{
public SaveAsForm(ISettingNameOperation settingNameOperation)
{
InitializeComponent();
m_settingNameOperation = settingNameOperation;
newNameTextBox.Text = m_settingNameOperation.Prefix
+ m_settingNameOperation.SettingCount.ToString();
}
ISettingNameOperation m_settingNameOperation;
private void okButton_Click(object sender, EventArgs e)
{
m_settingNameOperation.SaveAs(newNameTextBox.Text);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>ViewPrinter.dll</Assembly>
<ClientId>19cd33f6-228c-4d2d-a81a-251d3c915421</ClientId>
<FullClassName>Revit.SDK.Samples.ViewPrinter.CS.Command</FullClassName>
<Text>View Printer</Text>
<Description>Print user selected printable views.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{15D03F50-CF7C-4173-9577-A4B36012FF90}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ViewPrinter</RootNamespace>
<AssemblyName>ViewPrinter</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="PrintMgr.cs" />
<Compile Include="PrintMgrForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PrintMgrForm.Designer.cs">
<DependentUpon>PrintMgrForm.cs</DependentUpon>
</Compile>
<Compile Include="PrintSTP.cs" />
<Compile Include="PrintSetupForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PrintSetupForm.Designer.cs">
<DependentUpon>PrintSetupForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReNameForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ReNameForm.Designer.cs">
<DependentUpon>ReNameForm.cs</DependentUpon>
</Compile>
<Compile Include="SaveAsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SaveAsForm.Designer.cs">
<DependentUpon>SaveAsForm.cs</DependentUpon>
</Compile>
<Compile Include="ViewSheets.cs" />
<Compile Include="ViewSheetSetForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ViewSheetSetForm.Designer.cs">
<DependentUpon>ViewSheetSetForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="PrintMgrForm.resx">
<SubType>Designer</SubType>
<DependentUpon>PrintMgrForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PrintSetupForm.resx">
<SubType>Designer</SubType>
<DependentUpon>PrintSetupForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ReNameForm.resx">
<SubType>Designer</SubType>
<DependentUpon>ReNameForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SaveAsForm.resx">
<SubType>Designer</SubType>
<DependentUpon>SaveAsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ViewSheetSetForm.resx">
<SubType>Designer</SubType>
<DependentUpon>ViewSheetSetForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Project>
+282
View File
@@ -0,0 +1,282 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.ViewPrinter.CS
{
partial class viewSheetSetForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.viewSheetSetNameComboBox = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.showViewsCheckBox = new System.Windows.Forms.CheckBox();
this.showSheetsCheckBox = new System.Windows.Forms.CheckBox();
this.saveButton = new System.Windows.Forms.Button();
this.saveAsButton = new System.Windows.Forms.Button();
this.revertButton = new System.Windows.Forms.Button();
this.reNameButton = new System.Windows.Forms.Button();
this.deleteButton = new System.Windows.Forms.Button();
this.checkAllButton = new System.Windows.Forms.Button();
this.checkNoneButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.viewSheetSetListView = new System.Windows.Forms.ListView();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Name:";
//
// viewSheetSetNameComboBox
//
this.viewSheetSetNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.viewSheetSetNameComboBox.FormattingEnabled = true;
this.viewSheetSetNameComboBox.Location = new System.Drawing.Point(56, 18);
this.viewSheetSetNameComboBox.Name = "viewSheetSetNameComboBox";
this.viewSheetSetNameComboBox.Size = new System.Drawing.Size(243, 21);
this.viewSheetSetNameComboBox.TabIndex = 1;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.showViewsCheckBox);
this.groupBox1.Controls.Add(this.showSheetsCheckBox);
this.groupBox1.Location = new System.Drawing.Point(12, 293);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(287, 61);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Show";
//
// showViewsCheckBox
//
this.showViewsCheckBox.AutoSize = true;
this.showViewsCheckBox.Checked = true;
this.showViewsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.showViewsCheckBox.Location = new System.Drawing.Point(118, 28);
this.showViewsCheckBox.Name = "showViewsCheckBox";
this.showViewsCheckBox.Size = new System.Drawing.Size(54, 17);
this.showViewsCheckBox.TabIndex = 7;
this.showViewsCheckBox.Text = "&Views";
this.showViewsCheckBox.UseVisualStyleBackColor = true;
this.showViewsCheckBox.CheckedChanged += new System.EventHandler(this.showViewsCheckBox_CheckedChanged);
//
// showSheetsCheckBox
//
this.showSheetsCheckBox.AutoSize = true;
this.showSheetsCheckBox.Checked = true;
this.showSheetsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.showSheetsCheckBox.Location = new System.Drawing.Point(6, 28);
this.showSheetsCheckBox.Name = "showSheetsCheckBox";
this.showSheetsCheckBox.Size = new System.Drawing.Size(57, 17);
this.showSheetsCheckBox.TabIndex = 7;
this.showSheetsCheckBox.Text = "s&heets";
this.showSheetsCheckBox.UseVisualStyleBackColor = true;
this.showSheetsCheckBox.CheckedChanged += new System.EventHandler(this.showSheetsCheckBox_CheckedChanged);
//
// saveButton
//
this.saveButton.Enabled = false;
this.saveButton.Location = new System.Drawing.Point(328, 21);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(172, 23);
this.saveButton.TabIndex = 5;
this.saveButton.Text = "&Save";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// saveAsButton
//
this.saveAsButton.Location = new System.Drawing.Point(328, 50);
this.saveAsButton.Name = "saveAsButton";
this.saveAsButton.Size = new System.Drawing.Size(172, 23);
this.saveAsButton.TabIndex = 5;
this.saveAsButton.Text = "Sa&veAs...";
this.saveAsButton.UseVisualStyleBackColor = true;
this.saveAsButton.Click += new System.EventHandler(this.saveAsButton_Click);
//
// revertButton
//
this.revertButton.Enabled = false;
this.revertButton.Location = new System.Drawing.Point(328, 79);
this.revertButton.Name = "revertButton";
this.revertButton.Size = new System.Drawing.Size(172, 23);
this.revertButton.TabIndex = 5;
this.revertButton.Text = "&Revert";
this.revertButton.UseVisualStyleBackColor = true;
this.revertButton.Click += new System.EventHandler(this.revertButton_Click);
//
// reNameButton
//
this.reNameButton.Location = new System.Drawing.Point(328, 108);
this.reNameButton.Name = "reNameButton";
this.reNameButton.Size = new System.Drawing.Size(172, 23);
this.reNameButton.TabIndex = 5;
this.reNameButton.Text = "Ren&ame";
this.reNameButton.UseVisualStyleBackColor = true;
this.reNameButton.Click += new System.EventHandler(this.reNameButton_Click);
//
// deleteButton
//
this.deleteButton.Location = new System.Drawing.Point(328, 137);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(172, 23);
this.deleteButton.TabIndex = 5;
this.deleteButton.Text = "&Delete";
this.deleteButton.UseVisualStyleBackColor = true;
this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click);
//
// checkAllButton
//
this.checkAllButton.Location = new System.Drawing.Point(328, 186);
this.checkAllButton.Name = "checkAllButton";
this.checkAllButton.Size = new System.Drawing.Size(172, 23);
this.checkAllButton.TabIndex = 5;
this.checkAllButton.Text = "&Check All";
this.checkAllButton.UseVisualStyleBackColor = true;
this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click);
//
// checkNoneButton
//
this.checkNoneButton.Location = new System.Drawing.Point(328, 215);
this.checkNoneButton.Name = "checkNoneButton";
this.checkNoneButton.Size = new System.Drawing.Size(172, 23);
this.checkNoneButton.TabIndex = 5;
this.checkNoneButton.Text = "Check &None";
this.checkNoneButton.UseVisualStyleBackColor = true;
this.checkNoneButton.Click += new System.EventHandler(this.checkNoneButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(425, 370);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 6;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(344, 370);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 6;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// viewSheetSetListView
//
this.viewSheetSetListView.CheckBoxes = true;
this.viewSheetSetListView.Location = new System.Drawing.Point(12, 45);
this.viewSheetSetListView.Name = "viewSheetSetListView";
this.viewSheetSetListView.Size = new System.Drawing.Size(287, 242);
this.viewSheetSetListView.Sorting = System.Windows.Forms.SortOrder.Descending;
this.viewSheetSetListView.TabIndex = 7;
this.viewSheetSetListView.UseCompatibleStateImageBehavior = false;
this.viewSheetSetListView.View = System.Windows.Forms.View.List;
//
// viewSheetSetForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(512, 405);
this.Controls.Add(this.viewSheetSetListView);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.checkNoneButton);
this.Controls.Add(this.checkAllButton);
this.Controls.Add(this.deleteButton);
this.Controls.Add(this.reNameButton);
this.Controls.Add(this.revertButton);
this.Controls.Add(this.saveAsButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.viewSheetSetNameComboBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "viewSheetSetForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "View/Sheet Set";
this.Load += new System.EventHandler(this.ViewSheetSetForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox viewSheetSetNameComboBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button saveAsButton;
private System.Windows.Forms.Button revertButton;
private System.Windows.Forms.Button reNameButton;
private System.Windows.Forms.Button deleteButton;
private System.Windows.Forms.Button checkAllButton;
private System.Windows.Forms.Button checkNoneButton;
private System.Windows.Forms.CheckBox showViewsCheckBox;
private System.Windows.Forms.CheckBox showSheetsCheckBox;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.ListView viewSheetSetListView;
}
}
@@ -0,0 +1,201 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public partial class viewSheetSetForm : System.Windows.Forms.Form
{
public viewSheetSetForm(ViewSheets viewSheets)
{
InitializeComponent();
m_viewSheets = viewSheets;
}
private ViewSheets m_viewSheets;
private bool m_stopUpdateFlag;
private void ViewSheetSetForm_Load(object sender, EventArgs e)
{
viewSheetSetNameComboBox.DataSource = m_viewSheets.ViewSheetSetNames;
this.viewSheetSetNameComboBox.SelectedValueChanged += new System.EventHandler(this.viewSheetSetNameComboBox_SelectedValueChanged);
viewSheetSetNameComboBox.SelectedItem = m_viewSheets.SettingName;
showSheetsCheckBox.Checked = true;
showViewsCheckBox.Checked = true;
ListViewSheetSet();
this.viewSheetSetListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.viewSheetSetListView_ItemChecked);
}
private void ListViewSheetSet()
{
VisibleType vt;
if (showSheetsCheckBox.Checked && showViewsCheckBox.Checked)
{
vt = VisibleType.VT_BothViewAndSheet;
}
else if (showSheetsCheckBox.Checked && !showViewsCheckBox.Checked)
{
vt = VisibleType.VT_SheetOnly;
}
else if (!showSheetsCheckBox.Checked && showViewsCheckBox.Checked)
{
vt = VisibleType.VT_ViewOnly;
}
else
{
vt = VisibleType.VT_None;
}
List<Autodesk.Revit.DB.View> views = m_viewSheets.AvailableViewSheetSet(vt);
viewSheetSetListView.Items.Clear();
foreach (Autodesk.Revit.DB.View view in views)
{
ListViewItem item = new ListViewItem(view.ViewType.ToString() + ": " + view.Name);
item.Checked = m_viewSheets.IsSelected(item.Text);
viewSheetSetListView.Items.Add(item);
}
}
private void viewSheetSetNameComboBox_SelectedValueChanged(object sender, EventArgs e)
{
if (m_stopUpdateFlag)
return;
m_viewSheets.SettingName = viewSheetSetNameComboBox.SelectedItem as string;
ListViewSheetSet();
saveButton.Enabled = revertButton.Enabled = false;
reNameButton.Enabled = deleteButton.Enabled =
m_viewSheets.SettingName.Equals("<In-Session>") ? false : true;
}
private void showSheetsCheckBox_CheckedChanged(object sender, EventArgs e)
{
ListViewSheetSet();
}
private void showViewsCheckBox_CheckedChanged(object sender, EventArgs e)
{
ListViewSheetSet();
}
private void saveButton_Click(object sender, EventArgs e)
{
List<string> names = new List<string>();
foreach (ListViewItem item in viewSheetSetListView.Items)
{
if (item.Checked)
{
names.Add(item.Text);
}
}
m_viewSheets.ChangeCurrentViewSheetSet(names);
m_viewSheets.Save();
}
private void saveAsButton_Click(object sender, EventArgs e)
{
using (SaveAsForm dlg = new SaveAsForm(m_viewSheets))
{
dlg.ShowDialog();
}
m_stopUpdateFlag = true;
viewSheetSetNameComboBox.DataSource = m_viewSheets.ViewSheetSetNames;
viewSheetSetNameComboBox.Update();
m_stopUpdateFlag = false;
viewSheetSetNameComboBox.SelectedItem = m_viewSheets.SettingName;
}
private void revertButton_Click(object sender, EventArgs e)
{
m_viewSheets.Revert();
ViewSheetSetForm_Load(null, null);
}
private void reNameButton_Click(object sender, EventArgs e)
{
using (ReNameForm dlg = new ReNameForm(m_viewSheets))
{
dlg.ShowDialog();
}
m_stopUpdateFlag = true;
viewSheetSetNameComboBox.DataSource = m_viewSheets.ViewSheetSetNames;
viewSheetSetNameComboBox.Update();
m_stopUpdateFlag = false;
viewSheetSetNameComboBox.SelectedItem = m_viewSheets.SettingName;
}
private void deleteButton_Click(object sender, EventArgs e)
{
m_viewSheets.Delete();
m_stopUpdateFlag = true;
viewSheetSetNameComboBox.DataSource = m_viewSheets.ViewSheetSetNames;
viewSheetSetNameComboBox.Update();
m_stopUpdateFlag = false;
viewSheetSetNameComboBox.SelectedItem = m_viewSheets.SettingName;
}
private void checkAllButton_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in viewSheetSetListView.Items)
{
item.Checked = true;
}
}
private void checkNoneButton_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in viewSheetSetListView.Items)
{
item.Checked = false;
}
}
private void viewSheetSetListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
if (!m_viewSheets.SettingName.Equals("<In-Session>")
&& !saveButton.Enabled)
{
saveButton.Enabled = revertButton.Enabled
= reNameButton.Enabled = true;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+274
View File
@@ -0,0 +1,274 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Linq;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ViewPrinter.CS
{
public enum VisibleType
{
VT_ViewOnly,
VT_SheetOnly,
VT_BothViewAndSheet,
VT_None
}
public interface ISettingNameOperation
{
string SettingName
{
get;
set;
}
string Prefix
{
get;
}
int SettingCount
{
get;
}
bool Rename(string name);
bool SaveAs(string newName);
}
/// <summary>
/// Define some config data which is useful in this sample.
/// </summary>
public static class ConstData
{
/// <summary>
/// The const string data which is used as the name
/// for InSessionPrintSetting and InSessionViewSheetSet data
/// </summary>
public const string InSessionName = "<In-Session>";
}
/// <summary>
/// Exposes the View/Sheet Set interfaces just like
/// the View/Sheet Set Dialog (File->Print...; selected views/sheets->Select...) in UI.
/// </summary>
public class ViewSheets : ISettingNameOperation
{
Document m_doc;
ViewSheetSetting m_viewSheetSetting;
public ViewSheets(Document doc)
{
m_doc = doc;
m_viewSheetSetting = doc.PrintManager.ViewSheetSetting;
}
public string SettingName
{
get
{
IViewSheetSet theSet = m_viewSheetSetting.CurrentViewSheetSet;
return (theSet is ViewSheetSet) ?
(theSet as ViewSheetSet).Name : ConstData.InSessionName;
}
set
{
if (value == ConstData.InSessionName)
{
m_viewSheetSetting.CurrentViewSheetSet = m_viewSheetSetting.InSession;
return;
}
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(m_doc);
filteredElementCollector.OfClass(typeof(ViewSheetSet));
IEnumerable<ViewSheetSet> viewSheetSets = filteredElementCollector.Cast<ViewSheetSet>().Where<ViewSheetSet>(viewSheetSet => viewSheetSet.Name.Equals(value as string));
if (viewSheetSets.Count<ViewSheetSet>() > 0)
{
m_viewSheetSetting.CurrentViewSheetSet = viewSheetSets.First<ViewSheetSet>();
}
}
}
public string Prefix
{
get
{
return "Set ";
}
}
public int SettingCount
{
get
{
return (new FilteredElementCollector(m_doc)).OfClass(typeof(ViewSheetSet)).ToElementIds().Count;
}
}
public bool SaveAs(string newName)
{
try
{
return m_viewSheetSetting.SaveAs(newName);
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public bool Rename(string name)
{
try
{
return m_viewSheetSetting.Rename(name);
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public List<string> ViewSheetSetNames
{
get
{
List<string> names = new List<string>();
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(m_doc);
filteredElementCollector.OfClass(typeof(ViewSheetSet));
foreach (Element element in filteredElementCollector)
{
ViewSheetSet viewSheetSet = element as ViewSheetSet;
names.Add(viewSheetSet.Name);
}
names.Add(ConstData.InSessionName);
return names;
}
}
public bool Save()
{
try
{
return m_viewSheetSetting.Save();
}
catch (Exception)
{
return false;
}
}
public void Revert()
{
try
{
m_viewSheetSetting.Revert();
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
}
}
public bool Delete()
{
try
{
return m_viewSheetSetting.Delete();
}
catch (Exception ex)
{
PrintMgr.MyMessageBox(ex.Message);
return false;
}
}
public List<Autodesk.Revit.DB.View> AvailableViewSheetSet(VisibleType visibleType)
{
if (visibleType == VisibleType.VT_None)
return null;
List<Autodesk.Revit.DB.View> views = new List<Autodesk.Revit.DB.View>();
foreach (Autodesk.Revit.DB.View view in m_viewSheetSetting.AvailableViews)
{
if (view.ViewType == Autodesk.Revit.DB.ViewType.DrawingSheet
&& visibleType == VisibleType.VT_ViewOnly)
{
continue; // filter out sheets.
}
if (view.ViewType != Autodesk.Revit.DB.ViewType.DrawingSheet
&& visibleType == VisibleType.VT_SheetOnly)
{
continue; // filter out views.
}
views.Add(view);
}
return views;
}
public bool IsSelected(string viewName)
{
foreach (Autodesk.Revit.DB.View view in m_viewSheetSetting.CurrentViewSheetSet.Views)
{
if (viewName.Equals(view.ViewType.ToString() + ": " + view.Name))
{
return true;
}
}
return false;
}
public void ChangeCurrentViewSheetSet(List<string> names)
{
ViewSet selectedViews = new ViewSet();
if (null != names && 0 < names.Count)
{
foreach (Autodesk.Revit.DB.View view in m_viewSheetSetting.AvailableViews)
{
if (names.Contains(view.ViewType.ToString() + ": " + view.Name))
{
selectedViews.Insert(view);
}
}
}
IViewSheetSet viewSheetSet = m_viewSheetSetting.CurrentViewSheetSet;
viewSheetSet.Views = selectedViews;
Save();
}
}
}