integrate Revit 2025 SDK

This commit is contained in:
Jeremy Tammik
2024-04-11 13:47:20 +02:00
parent e786953544
commit f414362f2b
889 changed files with 26676 additions and 26865 deletions
@@ -1,5 +1,5 @@
'
' (C) Copyright 2003-2019 by Autodesk, Inc.
' (C) Copyright 2003-2023 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,
@@ -52,4 +52,6 @@ Imports System.Runtime.InteropServices
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.*")>
<Assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("windows7.0")>
@@ -29,7 +29,7 @@ Imports System.Collections
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.DB.Structure
Imports autodesk.Revit.DB.Structure
' All Autodesk Revit external commands must support this interface
@@ -168,7 +168,7 @@ Public Class MaterialProperties
m_revit = revit
If Not (Init()) Then
'there must be exactly one beam, column or brace selected
TaskDialog.Show("Revit", "You should select only one beam, structural column or brace.")
Autodesk.Revit.UI.TaskDialog.Show("Revit", "You should select only one beam, structural column or brace.")
Return Autodesk.Revit.UI.Result.Failed
End If
@@ -178,7 +178,7 @@ Public Class MaterialProperties
Try
displayForm.ShowDialog()
Catch ex As Exception
TaskDialog.Show("Revit", "Sorry that your command failed.")
Autodesk.Revit.UI.TaskDialog.Show("Revit", "Sorry that your command failed.")
Return Autodesk.Revit.UI.Result.Failed
End Try
documentTransaction.Commit()
@@ -1,150 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A4DABB0B-29A5-4749-BBD5-224D942E718E}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>MaterialProperties</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>Revit.SDK.Samples.MaterialProperties.VB.NET</RootNamespace>
<StartupObject>Revit.SDK.Samples.MaterialProperties.VB.NET.%28None%29</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Windows</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
<!--Added [false] deterministic property to prevent CS8357 when AssemblyInfo.cs contains wildcard in version string-->
<Deterministic>false</Deterministic>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<WarningLevel>1</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Release\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
<WarningLevel>1</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="MaterialProperties.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="MaterialPropertiesForm.vb">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="MaterialPropertiesForm.resx">
<DependentUpon>MaterialPropertiesForm.vb</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.VB.targets" />
<Import Project="$(SolutionDir)VSProps\SDKSamples.VB.Sdk.props" />
<Import Project="$(SolutionDir)VSProps\SDKSamples.VB.Sdk.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.py"
if exist %25FILEFORSAMPLEREG%25 py -3 %25FILEFORSAMPLEREG%25 "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
@@ -63,225 +63,225 @@ Public Class MaterialPropertiesForm
Friend WithEvents changeButton As System.Windows.Forms.Button
Friend WithEvents applyButton As System.Windows.Forms.Button
Friend WithEvents okButton As System.Windows.Forms.Button
Friend WithEvents parameterDataGrid As System.Windows.Forms.DataGrid
Friend WithEvents subTypeComboBox As System.Windows.Forms.ComboBox
Friend WithEvents typeComboBox As System.Windows.Forms.ComboBox
Friend WithEvents typeLable As System.Windows.Forms.Label
Friend WithEvents exitButton As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.changeButton = New System.Windows.Forms.Button
Me.applyButton = New System.Windows.Forms.Button
Me.exitButton = New System.Windows.Forms.Button
Me.okButton = New System.Windows.Forms.Button
Me.parameterDataGrid = New System.Windows.Forms.DataGrid
Me.subTypeComboBox = New System.Windows.Forms.ComboBox
Me.typeComboBox = New System.Windows.Forms.ComboBox
Me.typeLable = New System.Windows.Forms.Label
CType(Me.parameterDataGrid, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'changeButton
'
Me.changeButton.Location = New System.Drawing.Point(353, 455)
Me.changeButton.Name = "changeButton"
Me.changeButton.Size = New System.Drawing.Size(128, 23)
Me.changeButton.TabIndex = 16
Me.changeButton.Text = "Change &Unit Weight"
'
'applyButton
'
Me.applyButton.Location = New System.Drawing.Point(267, 455)
Me.applyButton.Name = "applyButton"
Me.applyButton.Size = New System.Drawing.Size(75, 23)
Me.applyButton.TabIndex = 15
Me.applyButton.Text = "&Apply"
'
'exitButton
'
Me.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.exitButton.Location = New System.Drawing.Point(173, 455)
Me.exitButton.Name = "exitButton"
Me.exitButton.Size = New System.Drawing.Size(75, 23)
Me.exitButton.TabIndex = 14
Me.exitButton.Text = "&Cancel"
'
'okButton
'
Me.okButton.Location = New System.Drawing.Point(87, 455)
Me.okButton.Name = "okButton"
Me.okButton.Size = New System.Drawing.Size(75, 23)
Me.okButton.TabIndex = 13
Me.okButton.Text = "&OK"
'
'parameterDataGrid
'
Me.parameterDataGrid.CaptionVisible = False
Me.parameterDataGrid.DataMember = ""
Me.parameterDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.parameterDataGrid.Location = New System.Drawing.Point(12, 69)
Me.parameterDataGrid.Name = "parameterDataGrid"
Me.parameterDataGrid.ReadOnly = True
Me.parameterDataGrid.RowHeadersVisible = False
Me.parameterDataGrid.Size = New System.Drawing.Size(480, 380)
Me.parameterDataGrid.TabIndex = 12
'
'subTypeComboBox
'
Me.subTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.subTypeComboBox.Location = New System.Drawing.Point(100, 42)
Me.subTypeComboBox.Name = "subTypeComboBox"
Me.subTypeComboBox.Size = New System.Drawing.Size(264, 21)
Me.subTypeComboBox.TabIndex = 11
'
'typeComboBox
'
Me.typeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.typeComboBox.Location = New System.Drawing.Point(100, 7)
Me.typeComboBox.Name = "typeComboBox"
Me.typeComboBox.Size = New System.Drawing.Size(264, 21)
Me.typeComboBox.TabIndex = 10
'
'typeLable
'
Me.typeLable.Location = New System.Drawing.Point(13, 7)
Me.typeLable.Name = "typeLable"
Me.typeLable.Size = New System.Drawing.Size(80, 23)
Me.typeLable.TabIndex = 9
Me.typeLable.Text = "Material Type:"
'
'MaterialPropertiesForm
'
Me.AcceptButton = Me.okButton
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.CancelButton = Me.exitButton
Me.ClientSize = New System.Drawing.Size(502, 481)
Me.Controls.Add(Me.changeButton)
Me.Controls.Add(Me.applyButton)
Me.Controls.Add(Me.exitButton)
Me.Controls.Add(Me.okButton)
Me.Controls.Add(Me.parameterDataGrid)
Me.Controls.Add(Me.subTypeComboBox)
Me.Controls.Add(Me.typeComboBox)
Me.Controls.Add(Me.typeLable)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "MaterialPropertiesForm"
Me.ShowInTaskbar = False
Me.Text = "Material Properties"
CType(Me.parameterDataGrid, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Friend WithEvents parameterDataGridView As System.Windows.Forms.DataGridView
Friend WithEvents subTypeComboBox As System.Windows.Forms.ComboBox
Friend WithEvents typeComboBox As System.Windows.Forms.ComboBox
Friend WithEvents typeLable As System.Windows.Forms.Label
Friend WithEvents exitButton As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.changeButton = New System.Windows.Forms.Button
Me.applyButton = New System.Windows.Forms.Button
Me.exitButton = New System.Windows.Forms.Button
Me.okButton = New System.Windows.Forms.Button
Me.parameterDataGridView = New System.Windows.Forms.DataGridView
Me.subTypeComboBox = New System.Windows.Forms.ComboBox
Me.typeComboBox = New System.Windows.Forms.ComboBox
Me.typeLable = New System.Windows.Forms.Label
CType(Me.parameterDataGridView, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'changeButton
'
Me.changeButton.Location = New System.Drawing.Point(353, 455)
Me.changeButton.Name = "changeButton"
Me.changeButton.Size = New System.Drawing.Size(128, 23)
Me.changeButton.TabIndex = 16
Me.changeButton.Text = "Change &Unit Weight"
'
'applyButton
'
Me.applyButton.Location = New System.Drawing.Point(267, 455)
Me.applyButton.Name = "applyButton"
Me.applyButton.Size = New System.Drawing.Size(75, 23)
Me.applyButton.TabIndex = 15
Me.applyButton.Text = "&Apply"
'
'exitButton
'
Me.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.exitButton.Location = New System.Drawing.Point(173, 455)
Me.exitButton.Name = "exitButton"
Me.exitButton.Size = New System.Drawing.Size(75, 23)
Me.exitButton.TabIndex = 14
Me.exitButton.Text = "&Cancel"
'
'okButton
'
Me.okButton.Location = New System.Drawing.Point(87, 455)
Me.okButton.Name = "okButton"
Me.okButton.Size = New System.Drawing.Size(75, 23)
Me.okButton.TabIndex = 13
Me.okButton.Text = "&OK"
'
'parameterDataGridView
'
'Me.parameterDataGridView.CaptionVisible = False
Me.parameterDataGridView.DataMember = ""
'Me.parameterDataGridView.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.parameterDataGridView.Location = New System.Drawing.Point(12, 69)
Me.parameterDataGridView.Name = "parameterDataGridView"
Me.parameterDataGridView.ReadOnly = True
Me.parameterDataGridView.RowHeadersVisible = False
Me.parameterDataGridView.Size = New System.Drawing.Size(480, 380)
Me.parameterDataGridView.TabIndex = 12
'
'subTypeComboBox
'
Me.subTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.subTypeComboBox.Location = New System.Drawing.Point(100, 42)
Me.subTypeComboBox.Name = "subTypeComboBox"
Me.subTypeComboBox.Size = New System.Drawing.Size(264, 21)
Me.subTypeComboBox.TabIndex = 11
'
'typeComboBox
'
Me.typeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.typeComboBox.Location = New System.Drawing.Point(100, 7)
Me.typeComboBox.Name = "typeComboBox"
Me.typeComboBox.Size = New System.Drawing.Size(264, 21)
Me.typeComboBox.TabIndex = 10
'
'typeLable
'
Me.typeLable.Location = New System.Drawing.Point(13, 7)
Me.typeLable.Name = "typeLable"
Me.typeLable.Size = New System.Drawing.Size(80, 23)
Me.typeLable.TabIndex = 9
Me.typeLable.Text = "Material Type:"
'
'MaterialPropertiesForm
'
Me.AcceptButton = Me.okButton
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.CancelButton = Me.exitButton
Me.ClientSize = New System.Drawing.Size(502, 481)
Me.Controls.Add(Me.changeButton)
Me.Controls.Add(Me.applyButton)
Me.Controls.Add(Me.exitButton)
Me.Controls.Add(Me.okButton)
Me.Controls.Add(Me.parameterDataGridView)
Me.Controls.Add(Me.subTypeComboBox)
Me.Controls.Add(Me.typeComboBox)
Me.Controls.Add(Me.typeLable)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "MaterialPropertiesForm"
Me.ShowInTaskbar = False
Me.Text = "Material Properties"
CType(Me.parameterDataGridView, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
End Sub
#End Region
Dim m_dataBuffer As MaterialProperties = Nothing
Dim m_dataBuffer As MaterialProperties = Nothing
'set selected element's material to current selection and close form
Private Sub okButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles okButton.Click
If Not (subTypeComboBox.SelectedValue Is Nothing) Then
m_dataBuffer.SetMaterial(subTypeComboBox.SelectedValue)
End If
Me.Close()
End Sub
'set selected element's material to current selection and close form
Private Sub okButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles okButton.Click
If Not (subTypeComboBox.SelectedValue Is Nothing) Then
m_dataBuffer.SetMaterial(subTypeComboBox.SelectedValue)
End If
Me.Close()
End Sub
'close form
Private Sub cancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
'close form
Private Sub cancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
'set selected element's material to current selection
Private Sub applyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles applyButton.Click
If Not (subTypeComboBox.SelectedValue Is Nothing) Then
m_dataBuffer.SetMaterial(subTypeComboBox.SelectedValue)
End If
End Sub
'set selected element's material to current selection
Private Sub applyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles applyButton.Click
If Not (subTypeComboBox.SelectedValue Is Nothing) Then
m_dataBuffer.SetMaterial(subTypeComboBox.SelectedValue)
End If
End Sub
'change unit weight all instances of the elements that use this material
Private Sub changeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles changeButton.Click
Autodesk.Revit.UI.TaskDialog.Show("Revit", "This will change the unit weight of all instances that use this material in current document.")
'change unit weight all instances of the elements that use this material
Private Sub changeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles changeButton.Click
Autodesk.Revit.UI.TaskDialog.Show("Revit", "This will change the unit weight of all instances that use this material in current document.")
If Not (m_dataBuffer.ChangeUnitWeight()) Then
Autodesk.Revit.UI.TaskDialog.Show("Revit", "Failed to change the unit weight.")
If Not (m_dataBuffer.ChangeUnitWeight()) Then
Autodesk.Revit.UI.TaskDialog.Show("Revit", "Failed to change the unit weight.")
Return
End If
LoadCurrentMaterial()
End Sub
' when typeComboBox changed, then update the subTypeCombobox
Private Sub typeComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles typeComboBox.SelectedIndexChanged
If (CType(typeComboBox.SelectedIndex, StructuralAssetClass) = StructuralAssetClass.Metal) Then
applyButton.Enabled = True
changeButton.Enabled = True
subTypeComboBox.Enabled = True
subTypeComboBox.DataSource = m_dataBuffer.SteelCollection
subTypeComboBox.DisplayMember = "MaterialName"
subTypeComboBox.ValueMember = "Material"
parameterDataGridView.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
ElseIf (CType(typeComboBox.SelectedIndex, StructuralAssetClass) = StructuralAssetClass.Concrete) Then
applyButton.Enabled = True
changeButton.Enabled = True
subTypeComboBox.Enabled = True
subTypeComboBox.DataSource = m_dataBuffer.ConcreteCollection
subTypeComboBox.DisplayMember = "MaterialName"
subTypeComboBox.ValueMember = "Material"
parameterDataGridView.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
Else
applyButton.Enabled = False
changeButton.Enabled = False
subTypeComboBox.DataSource = New ArrayList
subTypeComboBox.Enabled = False
parameterDataGridView.DataSource = New DataTable
End If
If typeComboBox.SelectedIndex = CInt(m_dataBuffer.CurrentType) Then
If (m_dataBuffer.CurrentMaterial Is Nothing Or (m_dataBuffer.CurrentType <> StructuralAssetClass.Metal And m_dataBuffer.CurrentType <> StructuralAssetClass.Concrete)) Then
Return
End If
LoadCurrentMaterial()
End Sub
End If
' when typeComboBox changed, then update the subTypeCombobox
Private Sub typeComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles typeComboBox.SelectedIndexChanged
If (CType(typeComboBox.SelectedIndex, StructuralAssetClass) = StructuralAssetClass.Metal) Then
applyButton.Enabled = True
changeButton.Enabled = True
subTypeComboBox.Enabled = True
subTypeComboBox.DataSource = m_dataBuffer.SteelCollection
subTypeComboBox.DisplayMember = "MaterialName"
subTypeComboBox.ValueMember = "Material"
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
ElseIf (CType(typeComboBox.SelectedIndex, StructuralAssetClass) = StructuralAssetClass.Concrete) Then
applyButton.Enabled = True
changeButton.Enabled = True
subTypeComboBox.Enabled = True
subTypeComboBox.DataSource = m_dataBuffer.ConcreteCollection
subTypeComboBox.DisplayMember = "MaterialName"
subTypeComboBox.ValueMember = "Material"
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
Else
applyButton.Enabled = False
changeButton.Enabled = False
subTypeComboBox.DataSource = New ArrayList
subTypeComboBox.Enabled = False
parameterDataGrid.DataSource = New DataTable
End If
If typeComboBox.SelectedIndex = CInt(m_dataBuffer.CurrentType) Then
If (m_dataBuffer.CurrentMaterial Is Nothing Or (m_dataBuffer.CurrentType <> StructuralAssetClass.Metal And m_dataBuffer.CurrentType <> StructuralAssetClass.Concrete)) Then
Return
End If
Dim tmp As Autodesk.Revit.DB.Material
tmp = m_dataBuffer.CurrentMaterial
If (tmp Is Nothing) Then
Return
End If
subTypeComboBox.SelectedValue = tmp
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, _
Dim tmp As Autodesk.Revit.DB.Material
tmp = m_dataBuffer.CurrentMaterial
If (tmp Is Nothing) Then
Return
End If
subTypeComboBox.SelectedValue = tmp
parameterDataGridView.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue,
CType(typeComboBox.SelectedIndex, StructuralAssetClass))
ElseIf subTypeComboBox.Items.Count = 0 Then
parameterDataGrid.DataSource = New DataTable
End If
End Sub
ElseIf subTypeComboBox.Items.Count = 0 Then
parameterDataGridView.DataSource = New DataTable
End If
End Sub
'change the content in datagrid according to selected material type
Private Sub subTypeComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles subTypeComboBox.SelectedIndexChanged
If subTypeComboBox.SelectedValue Is Nothing Then
parameterDataGrid.DataSource = New DataTable
End If
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
End Sub
'change the content in datagrid according to selected material type
Private Sub subTypeComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles subTypeComboBox.SelectedIndexChanged
If subTypeComboBox.SelectedValue Is Nothing Then
parameterDataGridView.DataSource = New DataTable
End If
parameterDataGridView.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, CType(typeComboBox.SelectedIndex, StructuralAssetClass))
End Sub
'update display data to selected element's material
Private Sub LoadCurrentMaterial()
typeComboBox.DataSource = m_dataBuffer.MaterialTypes
typeComboBox.SelectedIndex = CInt(m_dataBuffer.CurrentType)
If (m_dataBuffer.CurrentMaterial Is Nothing Or (m_dataBuffer.CurrentType <> StructuralAssetClass.Metal And m_dataBuffer.CurrentType <> StructuralAssetClass.Concrete)) Then
Return
End If
'update display data to selected element's material
Private Sub LoadCurrentMaterial()
typeComboBox.DataSource = m_dataBuffer.MaterialTypes
typeComboBox.SelectedIndex = CInt(m_dataBuffer.CurrentType)
If (m_dataBuffer.CurrentMaterial Is Nothing Or (m_dataBuffer.CurrentType <> StructuralAssetClass.Metal And m_dataBuffer.CurrentType <> StructuralAssetClass.Concrete)) Then
Return
End If
Dim tmp As Autodesk.Revit.DB.Material
tmp = m_dataBuffer.CurrentMaterial
If (tmp Is Nothing) Then
Return
End If
subTypeComboBox.SelectedValue = tmp
parameterDataGrid.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue, _
Dim tmp As autodesk.Revit.DB.Material
tmp = m_dataBuffer.CurrentMaterial
If (tmp Is Nothing) Then
Return
End If
subTypeComboBox.SelectedValue = tmp
parameterDataGridView.DataSource = m_dataBuffer.GetParameterTable(subTypeComboBox.SelectedValue,
CType(typeComboBox.SelectedIndex, StructuralAssetClass))
End Sub
End Sub
' when the form loading, then load the current material of your selected beam, column or brace
Private Sub MaterialPropertiesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
parameterDataGrid.PreferredColumnWidth = parameterDataGrid.Width / 2 - 2
LoadCurrentMaterial()
' when the form loading, then load the current material of your selected beam, column or brace
Private Sub MaterialPropertiesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'parameterDataGridView.PreferredColumnWidth = parameterDataGridView.Width / 2 - 2
LoadCurrentMaterial()
End Sub
End Class