mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-26 12:41:32 +00:00
added Revit 2022 SDK minus except *rvt and *rfa
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// (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.NewRebar.CS
|
||||
{
|
||||
partial class AddConstraint
|
||||
{
|
||||
/// <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.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.constraintTypesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(164, 76);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(72, 23);
|
||||
this.cancelButton.TabIndex = 16;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(74, 76);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(72, 23);
|
||||
this.okButton.TabIndex = 15;
|
||||
this.okButton.Text = "&OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(67, 17);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(81, 13);
|
||||
this.label1.TabIndex = 14;
|
||||
this.label1.Text = "ConstraintType:";
|
||||
//
|
||||
// constraintTypesComboBox
|
||||
//
|
||||
this.constraintTypesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.constraintTypesComboBox.FormattingEnabled = true;
|
||||
this.constraintTypesComboBox.Location = new System.Drawing.Point(65, 41);
|
||||
this.constraintTypesComboBox.Name = "constraintTypesComboBox";
|
||||
this.constraintTypesComboBox.Size = new System.Drawing.Size(188, 21);
|
||||
this.constraintTypesComboBox.TabIndex = 13;
|
||||
//
|
||||
// AddConstraint
|
||||
//
|
||||
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(323, 114);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.constraintTypesComboBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AddConstraint";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Add Constraint";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox constraintTypesComboBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// (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.NewRebar.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// This form provides an entrance for user to add constraints to RebarShape.
|
||||
/// </summary>
|
||||
public partial class AddConstraint : System.Windows.Forms.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public AddConstraint()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, Initialize fields.
|
||||
/// </summary>
|
||||
/// <param name="constraintTypes"></param>
|
||||
public AddConstraint(List<Type> constraintTypes)
|
||||
: this()
|
||||
{
|
||||
constraintTypesComboBox.DataSource = constraintTypes;
|
||||
constraintTypesComboBox.DisplayMember = "Name";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the type from constraintTypesComboBox selection.
|
||||
/// </summary>
|
||||
public Type ConstraintType
|
||||
{
|
||||
get
|
||||
{
|
||||
return constraintTypesComboBox.SelectedItem as Type;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OK Button, Return DialogResult.OK and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel Button, Return DialogResult.Cancel and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,191 @@
|
||||
//
|
||||
// (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.NewRebar.CS
|
||||
{
|
||||
partial class AddParameter
|
||||
{
|
||||
/// <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.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.paramValueTextBox = new System.Windows.Forms.TextBox();
|
||||
this.paramNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.groupBox = new System.Windows.Forms.GroupBox();
|
||||
this.paramFormulaRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.paramDoubleRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(43, 112);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(34, 13);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Value";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(43, 79);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "Name";
|
||||
//
|
||||
// paramValueTextBox
|
||||
//
|
||||
this.paramValueTextBox.Location = new System.Drawing.Point(102, 105);
|
||||
this.paramValueTextBox.Name = "paramValueTextBox";
|
||||
this.paramValueTextBox.Size = new System.Drawing.Size(142, 20);
|
||||
this.paramValueTextBox.TabIndex = 6;
|
||||
//
|
||||
// paramNameTextBox
|
||||
//
|
||||
this.paramNameTextBox.Location = new System.Drawing.Point(102, 79);
|
||||
this.paramNameTextBox.Name = "paramNameTextBox";
|
||||
this.paramNameTextBox.Size = new System.Drawing.Size(142, 20);
|
||||
this.paramNameTextBox.TabIndex = 5;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(64, 146);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(72, 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(159, 146);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(72, 23);
|
||||
this.cancelButton.TabIndex = 10;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// groupBox
|
||||
//
|
||||
this.groupBox.Controls.Add(this.paramFormulaRadioButton);
|
||||
this.groupBox.Controls.Add(this.paramDoubleRadioButton);
|
||||
this.groupBox.Location = new System.Drawing.Point(43, 12);
|
||||
this.groupBox.Name = "groupBox";
|
||||
this.groupBox.Size = new System.Drawing.Size(201, 47);
|
||||
this.groupBox.TabIndex = 11;
|
||||
this.groupBox.TabStop = false;
|
||||
this.groupBox.Text = "Parameter Type";
|
||||
//
|
||||
// paramFormulaRadioButton
|
||||
//
|
||||
this.paramFormulaRadioButton.AutoSize = true;
|
||||
this.paramFormulaRadioButton.Location = new System.Drawing.Point(116, 19);
|
||||
this.paramFormulaRadioButton.Name = "paramFormulaRadioButton";
|
||||
this.paramFormulaRadioButton.Size = new System.Drawing.Size(62, 17);
|
||||
this.paramFormulaRadioButton.TabIndex = 1;
|
||||
this.paramFormulaRadioButton.Text = "Formula";
|
||||
this.paramFormulaRadioButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// paramDoubleRadioButton
|
||||
//
|
||||
this.paramDoubleRadioButton.AutoSize = true;
|
||||
this.paramDoubleRadioButton.Checked = true;
|
||||
this.paramDoubleRadioButton.Location = new System.Drawing.Point(21, 19);
|
||||
this.paramDoubleRadioButton.Name = "paramDoubleRadioButton";
|
||||
this.paramDoubleRadioButton.Size = new System.Drawing.Size(59, 17);
|
||||
this.paramDoubleRadioButton.TabIndex = 0;
|
||||
this.paramDoubleRadioButton.TabStop = true;
|
||||
this.paramDoubleRadioButton.Text = "Double";
|
||||
this.paramDoubleRadioButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AddParameter
|
||||
//
|
||||
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(285, 181);
|
||||
this.Controls.Add(this.groupBox);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.paramValueTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.paramNameTextBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AddParameter";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Add Parameter";
|
||||
this.groupBox.ResumeLayout(false);
|
||||
this.groupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox paramValueTextBox;
|
||||
private System.Windows.Forms.TextBox paramNameTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.GroupBox groupBox;
|
||||
private System.Windows.Forms.RadioButton paramFormulaRadioButton;
|
||||
private System.Windows.Forms.RadioButton paramDoubleRadioButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// (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 System.Text.RegularExpressions;
|
||||
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.NewRebar.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// This form provides an entrance for user to add parameters to RebarShape.
|
||||
/// </summary>
|
||||
public partial class AddParameter : System.Windows.Forms.Form
|
||||
{
|
||||
List<RebarShapeParameter> m_parameterList;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public AddParameter()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, initialize fields.
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
public AddParameter(List<RebarShapeParameter> list)
|
||||
: this()
|
||||
{
|
||||
m_parameterList = list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is it formula parameter or not?
|
||||
/// </summary>
|
||||
public bool IsFormula
|
||||
{
|
||||
get
|
||||
{
|
||||
return paramFormulaRadioButton.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameter name from paramNameTextBox.
|
||||
/// </summary>
|
||||
public string ParamName
|
||||
{
|
||||
get
|
||||
{
|
||||
return paramNameTextBox.Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameter value from paramValueTextBox.
|
||||
/// </summary>
|
||||
public string ParamValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return paramValueTextBox.Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel Button, Return DialogResult.Cancel and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OK button, check the correction of data, then Return DialogResult.OK
|
||||
/// and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ParamName) || string.IsNullOrEmpty(ParamValue))
|
||||
{
|
||||
TaskDialog.Show("Revit", "Parameter Name and Value should not be null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsFormula)
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.Parse(ParamValue);
|
||||
}
|
||||
catch
|
||||
{
|
||||
TaskDialog.Show("Revit", "Input value - " + ParamValue + " - should be double.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure Parameter name should be started with letter
|
||||
// And just contains letters, numbers and underlines
|
||||
Regex regex = new Regex("^[a-zA-Z]\\w*$");
|
||||
if (!regex.IsMatch(ParamName))
|
||||
{
|
||||
TaskDialog.Show("Revit", "Parameter name should be started with letter \r\n And just contains letters, numbers and underlines.");
|
||||
paramNameTextBox.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the name is unique.
|
||||
foreach (RebarShapeParameter param in m_parameterList)
|
||||
{
|
||||
if (param.Name.Equals(ParamName))
|
||||
{
|
||||
TaskDialog.Show("Revit", "The name is already exist, please input again.");
|
||||
paramNameTextBox.Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
//
|
||||
// (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.NewRebar.CS
|
||||
{
|
||||
partial class NewRebarForm
|
||||
{
|
||||
/// <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.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.rebarShapesGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.shapesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.createShapeButton = new System.Windows.Forms.Button();
|
||||
this.rebarBarTypeGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.barTypesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.arcTypecomboBox = new System.Windows.Forms.ComboBox();
|
||||
this.segmentCountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.bySegmentsradioButton = new System.Windows.Forms.RadioButton();
|
||||
this.byArcradioButton = new System.Windows.Forms.RadioButton();
|
||||
this.rebarShapesGroupBox.SuspendLayout();
|
||||
this.rebarBarTypeGroupBox.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(141, 233);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(89, 26);
|
||||
this.okButton.TabIndex = 4;
|
||||
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(252, 233);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(89, 26);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// rebarShapesGroupBox
|
||||
//
|
||||
this.rebarShapesGroupBox.Controls.Add(this.shapesComboBox);
|
||||
this.rebarShapesGroupBox.Location = new System.Drawing.Point(26, 12);
|
||||
this.rebarShapesGroupBox.Name = "rebarShapesGroupBox";
|
||||
this.rebarShapesGroupBox.Size = new System.Drawing.Size(204, 77);
|
||||
this.rebarShapesGroupBox.TabIndex = 7;
|
||||
this.rebarShapesGroupBox.TabStop = false;
|
||||
this.rebarShapesGroupBox.Text = "RebarShape";
|
||||
//
|
||||
// shapesComboBox
|
||||
//
|
||||
this.shapesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.shapesComboBox.FormattingEnabled = true;
|
||||
this.shapesComboBox.Location = new System.Drawing.Point(31, 31);
|
||||
this.shapesComboBox.Name = "shapesComboBox";
|
||||
this.shapesComboBox.Size = new System.Drawing.Size(149, 21);
|
||||
this.shapesComboBox.TabIndex = 8;
|
||||
//
|
||||
// createShapeButton
|
||||
//
|
||||
this.createShapeButton.Location = new System.Drawing.Point(20, 151);
|
||||
this.createShapeButton.Name = "createShapeButton";
|
||||
this.createShapeButton.Size = new System.Drawing.Size(162, 29);
|
||||
this.createShapeButton.TabIndex = 9;
|
||||
this.createShapeButton.Text = "Create Rebar &Shape ...";
|
||||
this.createShapeButton.UseVisualStyleBackColor = true;
|
||||
this.createShapeButton.Click += new System.EventHandler(this.createShapeButton_Click);
|
||||
//
|
||||
// rebarBarTypeGroupBox
|
||||
//
|
||||
this.rebarBarTypeGroupBox.Controls.Add(this.barTypesComboBox);
|
||||
this.rebarBarTypeGroupBox.Location = new System.Drawing.Point(26, 116);
|
||||
this.rebarBarTypeGroupBox.Name = "rebarBarTypeGroupBox";
|
||||
this.rebarBarTypeGroupBox.Size = new System.Drawing.Size(204, 82);
|
||||
this.rebarBarTypeGroupBox.TabIndex = 8;
|
||||
this.rebarBarTypeGroupBox.TabStop = false;
|
||||
this.rebarBarTypeGroupBox.Text = "RebarBarType";
|
||||
//
|
||||
// barTypesComboBox
|
||||
//
|
||||
this.barTypesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.barTypesComboBox.FormattingEnabled = true;
|
||||
this.barTypesComboBox.Location = new System.Drawing.Point(30, 35);
|
||||
this.barTypesComboBox.Name = "barTypesComboBox";
|
||||
this.barTypesComboBox.Size = new System.Drawing.Size(150, 21);
|
||||
this.barTypesComboBox.TabIndex = 1;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.nameLabel);
|
||||
this.groupBox2.Controls.Add(this.nameTextBox);
|
||||
this.groupBox2.Controls.Add(this.arcTypecomboBox);
|
||||
this.groupBox2.Controls.Add(this.segmentCountTextBox);
|
||||
this.groupBox2.Controls.Add(this.bySegmentsradioButton);
|
||||
this.groupBox2.Controls.Add(this.byArcradioButton);
|
||||
this.groupBox2.Controls.Add(this.createShapeButton);
|
||||
this.groupBox2.Location = new System.Drawing.Point(249, 12);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(213, 186);
|
||||
this.groupBox2.TabIndex = 11;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Create Rebar Shape";
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(20, 36);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 21;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Location = new System.Drawing.Point(79, 31);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(103, 20);
|
||||
this.nameTextBox.TabIndex = 20;
|
||||
//
|
||||
// arcTypecomboBox
|
||||
//
|
||||
this.arcTypecomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.arcTypecomboBox.FormattingEnabled = true;
|
||||
this.arcTypecomboBox.Location = new System.Drawing.Point(79, 68);
|
||||
this.arcTypecomboBox.Name = "arcTypecomboBox";
|
||||
this.arcTypecomboBox.Size = new System.Drawing.Size(103, 21);
|
||||
this.arcTypecomboBox.TabIndex = 19;
|
||||
//
|
||||
// segmentCountTextBox
|
||||
//
|
||||
this.segmentCountTextBox.Enabled = false;
|
||||
this.segmentCountTextBox.Location = new System.Drawing.Point(108, 103);
|
||||
this.segmentCountTextBox.Name = "segmentCountTextBox";
|
||||
this.segmentCountTextBox.Size = new System.Drawing.Size(74, 20);
|
||||
this.segmentCountTextBox.TabIndex = 18;
|
||||
//
|
||||
// bySegmentsradioButton
|
||||
//
|
||||
this.bySegmentsradioButton.AutoSize = true;
|
||||
this.bySegmentsradioButton.Location = new System.Drawing.Point(20, 104);
|
||||
this.bySegmentsradioButton.Name = "bySegmentsradioButton";
|
||||
this.bySegmentsradioButton.Size = new System.Drawing.Size(87, 17);
|
||||
this.bySegmentsradioButton.TabIndex = 17;
|
||||
this.bySegmentsradioButton.Text = "By Segments";
|
||||
this.bySegmentsradioButton.UseVisualStyleBackColor = true;
|
||||
this.bySegmentsradioButton.CheckedChanged += new System.EventHandler(this.bySegmentsradioButton_CheckedChanged);
|
||||
//
|
||||
// byArcradioButton
|
||||
//
|
||||
this.byArcradioButton.AutoSize = true;
|
||||
this.byArcradioButton.Checked = true;
|
||||
this.byArcradioButton.Location = new System.Drawing.Point(20, 72);
|
||||
this.byArcradioButton.Name = "byArcradioButton";
|
||||
this.byArcradioButton.Size = new System.Drawing.Size(56, 17);
|
||||
this.byArcradioButton.TabIndex = 16;
|
||||
this.byArcradioButton.TabStop = true;
|
||||
this.byArcradioButton.Text = "By Arc";
|
||||
this.byArcradioButton.UseVisualStyleBackColor = true;
|
||||
this.byArcradioButton.CheckedChanged += new System.EventHandler(this.byArcradioButton_CheckedChanged);
|
||||
//
|
||||
// NewRebarForm
|
||||
//
|
||||
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(484, 281);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.rebarBarTypeGroupBox);
|
||||
this.Controls.Add(this.rebarShapesGroupBox);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "NewRebarForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Create Rebar";
|
||||
this.Load += new System.EventHandler(this.NewRebarForm_Load);
|
||||
this.rebarShapesGroupBox.ResumeLayout(false);
|
||||
this.rebarBarTypeGroupBox.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.GroupBox rebarShapesGroupBox;
|
||||
private System.Windows.Forms.Button createShapeButton;
|
||||
private System.Windows.Forms.ComboBox shapesComboBox;
|
||||
private System.Windows.Forms.GroupBox rebarBarTypeGroupBox;
|
||||
private System.Windows.Forms.ComboBox barTypesComboBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.ComboBox arcTypecomboBox;
|
||||
private System.Windows.Forms.TextBox segmentCountTextBox;
|
||||
private System.Windows.Forms.RadioButton bySegmentsradioButton;
|
||||
private System.Windows.Forms.RadioButton byArcradioButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
//
|
||||
// (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 System.Reflection;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.NewRebar.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the main form for user to operate the Rebar creation.
|
||||
/// </summary>
|
||||
public partial class NewRebarForm : System.Windows.Forms.Form
|
||||
{
|
||||
///// <summary>
|
||||
///// Revit Application object.
|
||||
///// </summary>
|
||||
//Autodesk.Revit.ApplicationServices.Application m_rvtApp;
|
||||
|
||||
/// <summary>
|
||||
/// Revit Document object.
|
||||
/// </summary>
|
||||
Document m_rvtDoc;
|
||||
|
||||
/// <summary>
|
||||
/// All RebarBarTypes of Revit current document.
|
||||
/// </summary>
|
||||
List<RebarBarType> m_rebarBarTypes = new List<RebarBarType>();
|
||||
|
||||
/// <summary>
|
||||
/// All RebarShape of Revit current document.
|
||||
/// </summary>
|
||||
List<RebarShape> m_rebarShapes = new List<RebarShape>();
|
||||
|
||||
/// <summary>
|
||||
/// Control binding source, provides data source for RebarBarType list box.
|
||||
/// </summary>
|
||||
BindingSource m_barTypesBinding = new BindingSource();
|
||||
|
||||
/// <summary>
|
||||
/// Control binding source, provides data source for RebarShapes list box.
|
||||
/// </summary>
|
||||
BindingSource m_shapesBinding = new BindingSource();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public NewRebarForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, initialize fields of RebarBarTypes and RebarShapes.
|
||||
/// </summary>
|
||||
/// <param name="rvtApp"></param>
|
||||
public NewRebarForm(Autodesk.Revit.DB.Document rvtDoc)
|
||||
: this()
|
||||
{
|
||||
m_rvtDoc = rvtDoc;
|
||||
|
||||
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(m_rvtDoc);
|
||||
filteredElementCollector.OfClass(typeof(RebarBarType));
|
||||
m_rebarBarTypes = filteredElementCollector.Cast<RebarBarType>().ToList<RebarBarType>();
|
||||
|
||||
filteredElementCollector = new FilteredElementCollector(m_rvtDoc);
|
||||
filteredElementCollector.OfClass(typeof(RebarShape));
|
||||
m_rebarShapes = filteredElementCollector.Cast<RebarShape>().ToList<RebarShape>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return RebarBarType from selection of barTypesComboBox.
|
||||
/// </summary>
|
||||
public RebarBarType RebarBarType
|
||||
{
|
||||
get
|
||||
{
|
||||
return barTypesComboBox.SelectedItem as RebarBarType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return RebarShape from selection of shapesComboBox.
|
||||
/// </summary>
|
||||
public RebarShape RebarShape
|
||||
{
|
||||
get
|
||||
{
|
||||
return shapesComboBox.SelectedItem as RebarShape;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OK Button, return DialogResult.OK and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel Button, return DialogResult.Cancel and close this form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Present a dialog to customize a RebarShape.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void createShapeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Make sure the name is not null or empty.
|
||||
if (string.IsNullOrEmpty(nameTextBox.Text.Trim()))
|
||||
{
|
||||
TaskDialog.Show("Revit", "Please give a name to create a rebar shape.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the input name is started with letter and
|
||||
// just contains letters, numbers and underlines.
|
||||
Regex regex = new Regex("^[a-zA-Z]\\w+$");
|
||||
if (!regex.IsMatch(nameTextBox.Text.Trim()))
|
||||
{
|
||||
TaskDialog.Show("Revit", "Please input the name starting with letter and just containing letters, numbers and underlines. String is " + nameTextBox.Text.ToString());
|
||||
nameTextBox.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a RebarShapeDefinition.
|
||||
RebarShapeDef shapeDef = null;
|
||||
|
||||
if (byArcradioButton.Checked)
|
||||
{
|
||||
// Create arc shape.
|
||||
RebarShapeDefinitionByArc arcShapeDefinition = null;
|
||||
RebarShapeDefinitionByArcType arcType = (RebarShapeDefinitionByArcType)Enum.Parse(typeof(RebarShapeDefinitionByArcType), arcTypecomboBox.Text);
|
||||
if (arcType != RebarShapeDefinitionByArcType.Spiral)
|
||||
{
|
||||
arcShapeDefinition = new RebarShapeDefinitionByArc(m_rvtDoc, arcType);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set default value for Spiral-Shape definition.
|
||||
arcShapeDefinition = new RebarShapeDefinitionByArc(m_rvtDoc, 10.0, 3.0, 0, 0);
|
||||
}
|
||||
shapeDef = new RebarShapeDefByArc(arcShapeDefinition);
|
||||
}
|
||||
else if (bySegmentsradioButton.Checked)
|
||||
{
|
||||
// Create straight segments shape.
|
||||
int segmentCount = 0;
|
||||
if (int.TryParse(segmentCountTextBox.Text, out segmentCount) && segmentCount > 0)
|
||||
{
|
||||
shapeDef = new RebarShapeDefBySegment(new RebarShapeDefinitionBySegments(m_rvtDoc, segmentCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskDialog.Show("Revit", "Please input a valid positive integer as segments count.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int startHookAngle = 0;
|
||||
int endHookAngle = 0;
|
||||
RebarHookOrientation startHookOrientation = RebarHookOrientation.Left;
|
||||
RebarHookOrientation endHookOrientation = RebarHookOrientation.Left;
|
||||
|
||||
bool doCreate = false;
|
||||
|
||||
using (NewRebarShapeForm form = new NewRebarShapeForm(m_rvtDoc, shapeDef))
|
||||
{
|
||||
// Present a form to customize the shape.
|
||||
if (DialogResult.OK == form.ShowDialog())
|
||||
{
|
||||
doCreate = true;
|
||||
if (form.NeedSetHooks)
|
||||
{
|
||||
// Set hooks for rebar shape.
|
||||
startHookAngle = form.StartHookAngle;
|
||||
endHookAngle = form.EndHookAngle;
|
||||
startHookOrientation = form.StartHookOrientation;
|
||||
endHookOrientation = form.EndHookOrientation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doCreate)
|
||||
{
|
||||
// Create the RebarShape.
|
||||
RebarShape createdRebarShape = RebarShape.Create(m_rvtDoc, shapeDef.RebarshapeDefinition, null,
|
||||
RebarStyle.Standard, StirrupTieAttachmentType.InteriorFace,
|
||||
startHookAngle, startHookOrientation,
|
||||
endHookAngle, endHookOrientation,
|
||||
0);
|
||||
createdRebarShape.Name = nameTextBox.Text.Trim();
|
||||
|
||||
// Add the created shape to the candidate list.
|
||||
m_rebarShapes.Add(createdRebarShape);
|
||||
m_shapesBinding.ResetBindings(false);
|
||||
shapesComboBox.SelectedItem = createdRebarShape;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the status of some controls.
|
||||
/// </summary>
|
||||
private void UpdateUIStatus()
|
||||
{
|
||||
segmentCountTextBox.Enabled = bySegmentsradioButton.Checked;
|
||||
arcTypecomboBox.Enabled = byArcradioButton.Checked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// byArcradioButton check status change event.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void byArcradioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateUIStatus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// bySegmentsradioButton check status change event.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void bySegmentsradioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateUIStatus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load event, Initialize controls data source.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void NewRebarForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
m_barTypesBinding.DataSource = m_rebarBarTypes;
|
||||
m_shapesBinding.DataSource = m_rebarShapes;
|
||||
|
||||
arcTypecomboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
arcTypecomboBox.DataSource = Enum.GetNames(typeof(RebarShapeDefinitionByArcType));
|
||||
|
||||
shapesComboBox.Sorted = true;
|
||||
barTypesComboBox.Sorted = true;
|
||||
shapesComboBox.DataSource = m_shapesBinding;
|
||||
shapesComboBox.DisplayMember = "Name";
|
||||
barTypesComboBox.DataSource = m_barTypesBinding;
|
||||
barTypesComboBox.DisplayMember = "Name";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,339 @@
|
||||
//
|
||||
// (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.NewRebar.CS
|
||||
{
|
||||
partial class NewRebarShapeForm
|
||||
{
|
||||
/// <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.addParameterButton = new System.Windows.Forms.Button();
|
||||
this.addConstraintButton = new System.Windows.Forms.Button();
|
||||
this.parameterListBox = new System.Windows.Forms.ListBox();
|
||||
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
|
||||
this.constraintListBox = new System.Windows.Forms.ListBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.parameterGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.hookGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.endHookOrientationcomboBox = new System.Windows.Forms.ComboBox();
|
||||
this.startHookOrientationComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.endHookAngleComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.startHookAngleComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.useHooksCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.parameterGroupBox.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.hookGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// addParameterButton
|
||||
//
|
||||
this.addParameterButton.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.addParameterButton.Location = new System.Drawing.Point(3, 195);
|
||||
this.addParameterButton.Name = "addParameterButton";
|
||||
this.addParameterButton.Size = new System.Drawing.Size(137, 31);
|
||||
this.addParameterButton.TabIndex = 2;
|
||||
this.addParameterButton.Text = "Add &Parameter";
|
||||
this.addParameterButton.UseVisualStyleBackColor = true;
|
||||
this.addParameterButton.Click += new System.EventHandler(this.addParameterButton_Click);
|
||||
//
|
||||
// addConstraintButton
|
||||
//
|
||||
this.addConstraintButton.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.addConstraintButton.Location = new System.Drawing.Point(3, 195);
|
||||
this.addConstraintButton.Name = "addConstraintButton";
|
||||
this.addConstraintButton.Size = new System.Drawing.Size(200, 31);
|
||||
this.addConstraintButton.TabIndex = 3;
|
||||
this.addConstraintButton.Text = "Add Con&straint";
|
||||
this.addConstraintButton.UseVisualStyleBackColor = true;
|
||||
this.addConstraintButton.Click += new System.EventHandler(this.addConstraintButton_Click);
|
||||
//
|
||||
// parameterListBox
|
||||
//
|
||||
this.parameterListBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.parameterListBox.FormattingEnabled = true;
|
||||
this.parameterListBox.HorizontalScrollbar = true;
|
||||
this.parameterListBox.Location = new System.Drawing.Point(3, 16);
|
||||
this.parameterListBox.Name = "parameterListBox";
|
||||
this.parameterListBox.Size = new System.Drawing.Size(137, 173);
|
||||
this.parameterListBox.TabIndex = 4;
|
||||
this.parameterListBox.SelectedIndexChanged += new System.EventHandler(this.parameterListBox_SelectedIndexChanged);
|
||||
//
|
||||
// propertyGrid
|
||||
//
|
||||
this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.propertyGrid.Location = new System.Drawing.Point(3, 16);
|
||||
this.propertyGrid.Name = "propertyGrid";
|
||||
this.propertyGrid.Size = new System.Drawing.Size(222, 365);
|
||||
this.propertyGrid.TabIndex = 5;
|
||||
//
|
||||
// constraintListBox
|
||||
//
|
||||
this.constraintListBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.constraintListBox.FormattingEnabled = true;
|
||||
this.constraintListBox.Location = new System.Drawing.Point(3, 16);
|
||||
this.constraintListBox.Name = "constraintListBox";
|
||||
this.constraintListBox.Size = new System.Drawing.Size(200, 173);
|
||||
this.constraintListBox.TabIndex = 6;
|
||||
this.constraintListBox.SelectedIndexChanged += new System.EventHandler(this.constraintListBox_SelectedIndexChanged);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(237, 425);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.okButton.TabIndex = 7;
|
||||
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(342, 425);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.cancelButton.TabIndex = 8;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// parameterGroupBox
|
||||
//
|
||||
this.parameterGroupBox.Controls.Add(this.parameterListBox);
|
||||
this.parameterGroupBox.Controls.Add(this.addParameterButton);
|
||||
this.parameterGroupBox.Location = new System.Drawing.Point(12, 26);
|
||||
this.parameterGroupBox.Name = "parameterGroupBox";
|
||||
this.parameterGroupBox.Size = new System.Drawing.Size(143, 229);
|
||||
this.parameterGroupBox.TabIndex = 9;
|
||||
this.parameterGroupBox.TabStop = false;
|
||||
this.parameterGroupBox.Text = "Parameters";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.constraintListBox);
|
||||
this.groupBox2.Controls.Add(this.addConstraintButton);
|
||||
this.groupBox2.Location = new System.Drawing.Point(181, 26);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(206, 229);
|
||||
this.groupBox2.TabIndex = 10;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Constraints";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.propertyGrid);
|
||||
this.groupBox3.Location = new System.Drawing.Point(413, 26);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(228, 384);
|
||||
this.groupBox3.TabIndex = 11;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Properties";
|
||||
//
|
||||
// hookGroupBox
|
||||
//
|
||||
this.hookGroupBox.Controls.Add(this.label4);
|
||||
this.hookGroupBox.Controls.Add(this.label3);
|
||||
this.hookGroupBox.Controls.Add(this.label2);
|
||||
this.hookGroupBox.Controls.Add(this.label1);
|
||||
this.hookGroupBox.Controls.Add(this.endHookOrientationcomboBox);
|
||||
this.hookGroupBox.Controls.Add(this.startHookOrientationComboBox);
|
||||
this.hookGroupBox.Controls.Add(this.endHookAngleComboBox);
|
||||
this.hookGroupBox.Controls.Add(this.startHookAngleComboBox);
|
||||
this.hookGroupBox.Controls.Add(this.useHooksCheckBox);
|
||||
this.hookGroupBox.Location = new System.Drawing.Point(15, 257);
|
||||
this.hookGroupBox.Name = "hookGroupBox";
|
||||
this.hookGroupBox.Size = new System.Drawing.Size(368, 153);
|
||||
this.hookGroupBox.TabIndex = 12;
|
||||
this.hookGroupBox.TabStop = false;
|
||||
this.hookGroupBox.Text = "Rebar Hook";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(222, 100);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(109, 13);
|
||||
this.label4.TabIndex = 8;
|
||||
this.label4.Text = "End Hook Orientation";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(23, 100);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(85, 13);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "End Hook Angle";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(222, 42);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(112, 13);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "Start Hook Orientation";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(23, 42);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(88, 13);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "Start Hook Angle";
|
||||
//
|
||||
// endHookOrientationcomboBox
|
||||
//
|
||||
this.endHookOrientationcomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.endHookOrientationcomboBox.Enabled = false;
|
||||
this.endHookOrientationcomboBox.FormattingEnabled = true;
|
||||
this.endHookOrientationcomboBox.Location = new System.Drawing.Point(222, 120);
|
||||
this.endHookOrientationcomboBox.Name = "endHookOrientationcomboBox";
|
||||
this.endHookOrientationcomboBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.endHookOrientationcomboBox.TabIndex = 4;
|
||||
//
|
||||
// startHookOrientationComboBox
|
||||
//
|
||||
this.startHookOrientationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.startHookOrientationComboBox.Enabled = false;
|
||||
this.startHookOrientationComboBox.FormattingEnabled = true;
|
||||
this.startHookOrientationComboBox.Location = new System.Drawing.Point(222, 62);
|
||||
this.startHookOrientationComboBox.Name = "startHookOrientationComboBox";
|
||||
this.startHookOrientationComboBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.startHookOrientationComboBox.TabIndex = 3;
|
||||
//
|
||||
// endHookAngleComboBox
|
||||
//
|
||||
this.endHookAngleComboBox.Enabled = false;
|
||||
this.endHookAngleComboBox.FormattingEnabled = true;
|
||||
this.endHookAngleComboBox.Location = new System.Drawing.Point(23, 120);
|
||||
this.endHookAngleComboBox.Name = "endHookAngleComboBox";
|
||||
this.endHookAngleComboBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.endHookAngleComboBox.TabIndex = 2;
|
||||
//
|
||||
// startHookAngleComboBox
|
||||
//
|
||||
this.startHookAngleComboBox.Enabled = false;
|
||||
this.startHookAngleComboBox.FormattingEnabled = true;
|
||||
this.startHookAngleComboBox.Location = new System.Drawing.Point(23, 62);
|
||||
this.startHookAngleComboBox.Name = "startHookAngleComboBox";
|
||||
this.startHookAngleComboBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.startHookAngleComboBox.TabIndex = 1;
|
||||
//
|
||||
// useHooksCheckBox
|
||||
//
|
||||
this.useHooksCheckBox.AutoSize = true;
|
||||
this.useHooksCheckBox.Location = new System.Drawing.Point(23, 20);
|
||||
this.useHooksCheckBox.Name = "useHooksCheckBox";
|
||||
this.useHooksCheckBox.Size = new System.Drawing.Size(103, 17);
|
||||
this.useHooksCheckBox.TabIndex = 0;
|
||||
this.useHooksCheckBox.Text = "Set Rebar Hook";
|
||||
this.useHooksCheckBox.UseVisualStyleBackColor = true;
|
||||
this.useHooksCheckBox.CheckedChanged += new System.EventHandler(this.useHooksCheckBox_CheckedChanged);
|
||||
//
|
||||
// NewRebarShapeForm
|
||||
//
|
||||
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(661, 465);
|
||||
this.Controls.Add(this.hookGroupBox);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.parameterGroupBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "NewRebarShapeForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Create RebarShape";
|
||||
this.Load += new System.EventHandler(this.NewRebarShapeForm_Load);
|
||||
this.parameterGroupBox.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.hookGroupBox.ResumeLayout(false);
|
||||
this.hookGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button addParameterButton;
|
||||
private System.Windows.Forms.Button addConstraintButton;
|
||||
private System.Windows.Forms.ListBox parameterListBox;
|
||||
private System.Windows.Forms.PropertyGrid propertyGrid;
|
||||
private System.Windows.Forms.ListBox constraintListBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.GroupBox parameterGroupBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.GroupBox hookGroupBox;
|
||||
private System.Windows.Forms.ComboBox endHookOrientationcomboBox;
|
||||
private System.Windows.Forms.ComboBox startHookOrientationComboBox;
|
||||
private System.Windows.Forms.ComboBox endHookAngleComboBox;
|
||||
private System.Windows.Forms.ComboBox startHookAngleComboBox;
|
||||
private System.Windows.Forms.CheckBox useHooksCheckBox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
//
|
||||
// (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 System.Reflection;
|
||||
using System.IO;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.NewRebar.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// This form is provided for user to define a new RebarShape.
|
||||
/// </summary>
|
||||
public partial class NewRebarShapeForm : System.Windows.Forms.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// RebarShapeDef object.
|
||||
/// </summary>
|
||||
private RebarShapeDef m_rebarShapeDef;
|
||||
|
||||
/// <summary>
|
||||
/// Autodesk Revit Application object.
|
||||
/// </summary>
|
||||
private Autodesk.Revit.ApplicationServices.Application m_rvtApp;
|
||||
|
||||
/// <summary>
|
||||
/// Autodesk Revit Document Object.
|
||||
/// </summary>
|
||||
private Autodesk.Revit.DB.Document m_rvtDoc;
|
||||
|
||||
/// <summary>
|
||||
/// Binding source for parameters ListBox.
|
||||
/// </summary>
|
||||
private BindingSource m_parametersListBoxBinding = new BindingSource();
|
||||
|
||||
/// <summary>
|
||||
/// Binding source for constraints ListBox.
|
||||
/// </summary>
|
||||
private BindingSource m_constraintsListBoxBinding = new BindingSource();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public NewRebarShapeForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, Initialize the fields.
|
||||
/// </summary>
|
||||
/// <param name="rvtApp">Revit Application object</param>
|
||||
/// <param name="shapeDef">RebarShapeDef object</param>
|
||||
public NewRebarShapeForm(Autodesk.Revit.DB.Document rvtDoc, RebarShapeDef shapeDef)
|
||||
: this()
|
||||
{
|
||||
m_rebarShapeDef = shapeDef;
|
||||
m_rvtDoc = rvtDoc;
|
||||
m_rvtApp = rvtDoc.Application;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If this return true, the hook of RebarShape will be set, otherwise not.
|
||||
/// </summary>
|
||||
public bool NeedSetHooks
|
||||
{
|
||||
get
|
||||
{
|
||||
return useHooksCheckBox.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return start hook angle.
|
||||
/// </summary>
|
||||
public int StartHookAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(startHookAngleComboBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return end hook angle.
|
||||
/// </summary>
|
||||
public int EndHookAngle
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(endHookAngleComboBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return start hook orientation.
|
||||
/// </summary>
|
||||
public RebarHookOrientation StartHookOrientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return (RebarHookOrientation)Enum.Parse(
|
||||
typeof(RebarHookOrientation), startHookOrientationComboBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return end hook orientation.
|
||||
/// </summary>
|
||||
public RebarHookOrientation EndHookOrientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return (RebarHookOrientation)Enum.Parse(
|
||||
typeof(RebarHookOrientation), endHookOrientationcomboBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a definition group if there exists one, otherwise, a new one will be created.
|
||||
/// </summary>
|
||||
/// <returns>Definition group</returns>
|
||||
private DefinitionGroup GetOrCreateDefinitionGroup()
|
||||
{
|
||||
DefinitionFile file = null;
|
||||
|
||||
int count = 0;
|
||||
// A count is to avoid infinite loop
|
||||
while (null == file && count < 100)
|
||||
{
|
||||
file = m_rvtApp.OpenSharedParameterFile();
|
||||
if (file == null)
|
||||
{
|
||||
// If Shared parameter file does not exist, then create a new one.
|
||||
string shapeFile =
|
||||
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
|
||||
+ "\\ParameterFile.txt";
|
||||
|
||||
// Fill Schema data of Revit shared parameter file.
|
||||
// If no this schema data, OpenSharedParameterFile may alway return null.
|
||||
System.Text.StringBuilder contents = new System.Text.StringBuilder();
|
||||
contents.AppendLine("# This is a Revit shared parameter file.");
|
||||
contents.AppendLine("# Do not edit manually.");
|
||||
contents.AppendLine("*META VERSION MINVERSION");
|
||||
contents.AppendLine("META 2 1");
|
||||
contents.AppendLine("*GROUP ID NAME");
|
||||
contents.AppendLine("*PARAM GUID NAME DATATYPE DATACATEGORY GROUP VISIBLE");
|
||||
|
||||
// Write Schema data of Revit shared parameter file.
|
||||
File.WriteAllText(shapeFile, contents.ToString());
|
||||
|
||||
// Set Revit shared parameter file
|
||||
m_rvtApp.SharedParametersFilename = shapeFile;
|
||||
}
|
||||
|
||||
// To avoid infinite loop.
|
||||
++count;
|
||||
}
|
||||
|
||||
// Get or create a definition group "Rebar Shape Parameters".
|
||||
DefinitionGroup group = file.Groups.get_Item("Rebar Shape Parameters");
|
||||
if (group == null)
|
||||
group = file.Groups.Create("Rebar Shape Parameters");
|
||||
return group;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Present a dialog to add a parameter to RebarShapeDef.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void addParameterButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (AddParameter addParam = new AddParameter(m_rebarShapeDef.Parameters))
|
||||
{
|
||||
if( DialogResult.OK == addParam.ShowDialog())
|
||||
{
|
||||
Type paramType = addParam.IsFormula ?
|
||||
typeof(RebarShapeParameterFormula) :
|
||||
typeof(RebarShapeParameterDouble);
|
||||
|
||||
object paramName = addParam.ParamName;
|
||||
object paramValue = addParam.ParamValue;
|
||||
if (!addParam.IsFormula)
|
||||
paramValue = double.Parse(addParam.ParamValue);
|
||||
|
||||
// Add the parameter to RebarShapeDef.
|
||||
RebarShapeParameter param = m_rebarShapeDef.AddParameter(paramType, paramName, paramValue);
|
||||
propertyGrid.SelectedObject = param;
|
||||
m_parametersListBoxBinding.ResetBindings(false);
|
||||
parameterListBox.SelectedItem = param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Present a dialog to add a constraint to RebarShapeDef.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void addConstraintButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (AddConstraint addConstraint = new AddConstraint(m_rebarShapeDef.AllowedConstraintTypes()))
|
||||
{
|
||||
if(DialogResult.OK == addConstraint.ShowDialog())
|
||||
{
|
||||
Type constraintType = addConstraint.ConstraintType;
|
||||
|
||||
// Add the constraint to RebarShapeDef.
|
||||
ConstraintOnRebarShape constraint = m_rebarShapeDef.AddConstraint(constraintType);
|
||||
propertyGrid.SelectedObject = constraint;
|
||||
m_constraintsListBoxBinding.ResetBindings(false);
|
||||
constraintListBox.SelectedItem = constraint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OK Button, commit the RebarShapeDef, if there are not any exception,
|
||||
/// The RebarShape will be added to Revit Document successfully.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_rebarShapeDef.Commit(m_rvtDoc, GetOrCreateDefinitionGroup());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskDialog.Show("Revit", "Rebar shape creation failed:" + ex.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel Button, Cancel the creation of RebarShape.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load event, Initialize the controls data.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void NewRebarShapeForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Initialize parameters' and constraints' listBox data source.
|
||||
m_parametersListBoxBinding.DataSource = m_rebarShapeDef.Parameters;
|
||||
m_constraintsListBoxBinding.DataSource = m_rebarShapeDef.Constraints;
|
||||
parameterListBox.DataSource = m_parametersListBoxBinding;
|
||||
constraintListBox.DataSource = m_constraintsListBoxBinding;
|
||||
parameterListBox.DisplayMember = "Name";
|
||||
constraintListBox.DisplayMember = "Name";
|
||||
m_parametersListBoxBinding.ResetBindings(true);
|
||||
m_constraintsListBoxBinding.ResetBindings(true);
|
||||
|
||||
// Initialize start and end hook angles comboBox data source.
|
||||
int[] startAngles = new int[4] { 0, 90, 135, 180 };
|
||||
int[] endAngles = new int[4] { 0, 90, 135, 180 };
|
||||
startHookAngleComboBox.DataSource = startAngles;
|
||||
endHookAngleComboBox.DataSource = endAngles;
|
||||
|
||||
// Initialize start and end hook orientation comboBox data source.
|
||||
string[] startOritationNames = Enum.GetNames(typeof(RebarHookOrientation));
|
||||
string[] endOritationNames = Enum.GetNames(typeof(RebarHookOrientation));
|
||||
startHookOrientationComboBox.DataSource = startOritationNames;
|
||||
endHookOrientationcomboBox.DataSource = endOritationNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the selection in the constraint listBox is changed, the property grid's
|
||||
/// content should be changed too.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void constraintListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
propertyGrid.SelectedObject = constraintListBox.SelectedItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the selection in the parameter listBox is changed, the property grid's
|
||||
/// content should be changed too.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void parameterListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
propertyGrid.SelectedObject = parameterListBox.SelectedItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the check status of useHooksCheckBox is changed, other comboBox's
|
||||
/// enabled status should be changed too.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void useHooksCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool isEnalbled = useHooksCheckBox.Checked;
|
||||
startHookAngleComboBox.Enabled = isEnalbled;
|
||||
startHookOrientationComboBox.Enabled = isEnalbled;
|
||||
endHookAngleComboBox.Enabled = isEnalbled;
|
||||
endHookOrientationcomboBox.Enabled = isEnalbled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user