added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,80 @@
using System;
using System.ComponentModel;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// Wrapper class for Construction
/// </summary>
[TypeConverter(typeof(ConstructionWrapperConverter))]
public class ConstructionWrapper : IComparable, IWrapper
{
#region Fields
/// <summary>
/// Construction
/// </summary>
private Construction m_construction;
#endregion
#region Constructors
/// <summary>
/// Initializes private variables.
/// </summary>
/// <param name="construction">Construction</param>
public ConstructionWrapper(Construction construction)
{
m_construction = construction;
}
#endregion
#region Properties
#region IComparable Members
/// <summary>
/// Compares the names of Constructions.
/// </summary>
/// <param name="obj">ConstructionWrapper used to compare</param>
/// <returns>A 32-bit signed integer that indicates the relative order of the objects
/// being compared. The return value has these meanings:
/// Value Condition Less than zero This instance is less than value.
/// Zero This instance is equal to value. Greater than zero This instance is
/// greater than value.-or- value is null.</returns>
public int CompareTo(object obj)
{
ConstructionWrapper wrapper = obj as ConstructionWrapper;
if (wrapper != null)
{
return this.Name.CompareTo(wrapper.Name);
}
return 1;
}
#endregion
#region IWrapper Members
/// <summary>
/// Gets the handle object.
/// </summary>
[Browsable(false)]
public object Handle
{
get { return m_construction; }
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
[Browsable(false)]
public String Name
{
get
{
return m_construction.Name;
}
}
#endregion
#endregion
}
}
@@ -0,0 +1,271 @@
using System;
using System.ComponentModel;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Analysis;
using Autodesk.Revit.DB.Mechanical;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// Wrapper class for gbXMLParamElem
/// </summary>
public class EnergyDataSettingsWrapper : IWrapper
{
#region Fields
/// <summary>
/// gbXMLParamElem
/// </summary>
private EnergyDataSettings m_energyDataSettings;
/// <summary>
/// Revit Document
/// </summary>
private Document m_document;
#endregion
#region Constructors
/// <summary>
/// Initializes private variables.
/// </summary>
/// <param name="gbXMLParamElem">gbXMLParamElem</param>
public EnergyDataSettingsWrapper(Document document)
{
m_document = document;
m_energyDataSettings = EnergyDataSettings.GetFromDocument(document);
}
#endregion
#region Properties
/// <summary>
/// Gets or sets Building Type
/// </summary>
[Category("Common"), DisplayName("Building Type")]
[TypeConverter(typeof(BuildingTypeConverter))]
public gbXMLBuildingType BuildingType
{
get
{
return m_energyDataSettings.BuildingType;
}
set
{
m_energyDataSettings.BuildingType = value;
}
}
/// <summary>
/// Gets or sets Ground Plane
/// </summary>
[Category("Common"), DisplayName("Ground Plane")]
[TypeConverter(typeof(ElementIdConverter<Level>))]
public ElementId GroundPlane
{
get
{
return m_energyDataSettings.GroundPlane;
}
set
{
m_energyDataSettings.GroundPlane = value;
}
}
/// <summary>
/// Gets or sets Building Service
/// </summary>
[Category("Detailed Model"), DisplayName("Building Service")]
[TypeConverter(typeof(ServiceTypeConverter))]
[RevitVersion(ProductType.MEP)]
public gbXMLServiceType BuildingService
{
get
{
return m_energyDataSettings.ServiceType;
}
set
{
m_energyDataSettings.ServiceType = value;
}
}
/// <summary>
/// Gets Building Construction
/// </summary>
[Category("Detailed Model"), DisplayName("Building Construction"), TypeConverter(typeof(WrapperConverter)), RevitVersion(ProductType.MEP)]
public MEPBuildingConstructionWrapper BuildingConstruction
{
get
{
ElementId eid = EnergyDataSettings.GetBuildingConstructionSetElementId(m_document);
MEPBuildingConstruction mEPBuildingConstruction = RevitStartInfo.GetElement(eid) as MEPBuildingConstruction;
//MEPBuildingConstruction mEPBuildingConstruction = RevitStartInfo.GetElement(m_energyDataSettings.ConstructionSetElementId) as MEPBuildingConstruction;
if(mEPBuildingConstruction != null)
return new MEPBuildingConstructionWrapper(mEPBuildingConstruction);
return null;
}
}
/// <summary>
/// Gets and Sets BuildingConstructionClass
/// </summary>
[Category("Detailed Model"), DisplayName("Building Infiltration Class")]
[TypeConverter(typeof(HVACLoadConstructionClassConverter))]
[RevitVersion(ProductType.MEP)]
public HVACLoadConstructionClass BuildingConstructionClass
{
get
{
return m_energyDataSettings.BuildingConstructionClass;
}
set
{
m_energyDataSettings.BuildingConstructionClass = value;
}
}
/// <summary>
/// Gets or sets Project Phase
/// </summary>
[Category("Detailed Model"), DisplayName("Project Phase")]
[TypeConverter(typeof(ElementIdConverter<Phase>))]
public ElementId ProjectPhase
{
get
{
return m_energyDataSettings.ProjectPhase;
}
set
{
m_energyDataSettings.ProjectPhase = value;
}
}
/// <summary>
/// Gets or sets Sliver Space Tolerance
/// </summary>
[Category("Detailed Model"), DisplayName("Sliver Space Tolerance")]
public Double SliverSpaceTolerance
{
get
{
return m_energyDataSettings.SliverSpaceTolerance;
}
set
{
m_energyDataSettings.SliverSpaceTolerance = value;
}
}
/// <summary>
/// Gets or sets Export Complexity
/// </summary>
[Category("Detailed Model"), DisplayName("Export Complexity")]
[TypeConverter(typeof(ExportComplexityConverter))]
public gbXMLExportComplexity ExportComplexity
{
get
{
return m_energyDataSettings.ExportComplexity;
}
set
{
m_energyDataSettings.ExportComplexity = value;
}
}
/// <summary>
/// Gets or sets Export Default Values
/// </summary>
[Category("Detailed Model"), DisplayName("Export Default Values")]
[RevitVersion(ProductType.MEP)]
public bool ExportDefaultValues
{
get
{
return m_energyDataSettings.ExportDefaults;
}
set
{
m_energyDataSettings.ExportDefaults = value;
}
}
/// <summary>
/// Gets and Sets ProjectReportType
/// </summary>
[Category("Detailed Model"), DisplayName("Report Type")]
[TypeConverter(typeof(HVACLoadLoadsReportTypeConverter))]
[RevitVersion(ProductType.MEP)]
public HVACLoadLoadsReportType ProjectReportType
{
get
{
return m_energyDataSettings.ProjectReportType;
}
set
{
m_energyDataSettings.ProjectReportType = value;
}
}
/// <summary>
/// Gets Project Location
/// </summary>
[DisplayName("Project Location"), TypeConverter(typeof(ProjectLocationConverter)), RevitVersion(ProductType.MEP, ProductType.Architecture)]
public ProjectLocation ProjectLocation
{
get
{
return m_document.ActiveProjectLocation;
}
set
{
m_document.ActiveProjectLocation = value;
}
}
/// <summary>
/// Gets Site Location
/// </summary>
[DisplayName("Site Location"), TypeConverter(typeof(WrapperConverter)), RevitVersion(ProductType.MEP, ProductType.Architecture)]
public SiteLocationWrapper SiteLocation
{
get
{
return new SiteLocationWrapper(m_document.SiteLocation);
}
}
#region IWrapper Members
/// <summary>
/// Gets the handle object.
/// </summary>
[Browsable(false)]
public object Handle
{
get
{
return m_energyDataSettings;
}
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
[Browsable(false)]
public string Name
{
get
{
return "";
}
set
{
}
}
#endregion
#endregion
}
}
@@ -0,0 +1,237 @@
using System.Collections.Generic;
using System.ComponentModel;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using ConstructionType = Autodesk.Revit.DB.Analysis.ConstructionType;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// Wrapper class for MEPBuildingConstruction
/// </summary>
public class MEPBuildingConstructionWrapper : IWrapper
{
#region Fields
/// <summary>
/// MEPBuildingConstruction
/// </summary>
private MEPBuildingConstruction m_mEPBuildingConstruction;
#endregion
#region Constructors
/// <summary>
/// Initializes private variables.
/// </summary>
/// <param name="mEPBuildingConstruction">MEPBuildingConstruction</param>
public MEPBuildingConstructionWrapper(MEPBuildingConstruction mEPBuildingConstruction)
{
m_mEPBuildingConstruction = mEPBuildingConstruction;
}
#endregion
#region Properties
/// <summary>
/// Gets or sets Roofs
/// </summary>
[DisplayName("Roofs")]
public ConstructionWrapper Roof
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Roof));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Roof, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Exterior Walls
/// </summary>
[DisplayName("Exterior Walls")]
public ConstructionWrapper ExteriorWall
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.ExteriorWall));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.ExteriorWall, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Interior Walls
/// </summary>
[DisplayName("Interior Walls")]
public ConstructionWrapper InteriorWall
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.InteriorWall));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.InteriorWall, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Ceilings
/// </summary>
[DisplayName("Ceilings")]
public ConstructionWrapper Ceiling
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Ceiling));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Ceiling, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Doors
/// </summary>
[DisplayName("Doors")]
public ConstructionWrapper Door
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Door));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Door, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Slabs
/// </summary>
[DisplayName("Slabs")]
public ConstructionWrapper Slab
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Slab));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Slab, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Floors
/// </summary>
[DisplayName("Floors")]
public ConstructionWrapper Floor
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Floor));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Floor, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Exterior Windows
/// </summary>
[DisplayName("Exterior Windows")]
public ConstructionWrapper ExteriorWindow
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.ExteriorWindow));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.ExteriorWindow, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Interior Windows
/// </summary>
[DisplayName("Interior Windows")]
public ConstructionWrapper InteriorWindow
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.ExteriorWindow));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.ExteriorWindow, value.Handle as Construction);
}
}
/// <summary>
/// Gets or sets Skylights
/// </summary>
[DisplayName("Skylights")]
public ConstructionWrapper Skylight
{
get
{
return new ConstructionWrapper(m_mEPBuildingConstruction.GetBuildingConstruction(ConstructionType.Skylight));
}
set
{
m_mEPBuildingConstruction.SetBuildingConstruction(ConstructionType.Skylight, value.Handle as Construction);
}
}
#region IWrapper Members
/// <summary>
/// Gets the handle object.
/// </summary>
[Browsable(false)]
public object Handle
{
get
{
return m_mEPBuildingConstruction;
}
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
[Browsable(false)]
public string Name
{
get
{
return m_mEPBuildingConstruction.Name;
}
set
{
m_mEPBuildingConstruction.Name = value;
}
}
#endregion
#endregion
#region Methods
/// <summary>
/// Get constructions
/// </summary>
/// <param name="constructionType">ConstructionType</param>
/// <returns>Related Constructions specified by constructionTypes</returns>
public ICollection<Construction> GetConstructions(ConstructionType constructionType)
{
return m_mEPBuildingConstruction.GetConstructions(constructionType);
}
#endregion
}
}
@@ -0,0 +1,157 @@
using System;
using System.ComponentModel;
using Autodesk.Revit.ApplicationServices;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// Wrapper class for ProjectInfo
/// </summary>
public class ProjectInfoWrapper : IWrapper
{
#region Fields
/// <summary>
/// ProjectInfo
/// </summary>
private Autodesk.Revit.DB.ProjectInfo m_projectInfo;
#endregion
#region Constructors
/// <summary>
/// Initializes private variables.
/// </summary>
/// <param name="projectInfo">ProjectInfo</param>
public ProjectInfoWrapper(Autodesk.Revit.DB.ProjectInfo projectInfo)
{
m_projectInfo = projectInfo;
}
#endregion
#region Properties
/// <summary>
/// Gets gbXMLSettings
/// </summary>
[Category("Energy Analysis"), DisplayName("Energy Settings")]
[TypeConverter(typeof(WrapperConverter))]
[RevitVersion(ProductType.MEP, ProductType.Architecture)]
public ICustomTypeDescriptor EnergyDataSettings
{
get
{
return new WrapperCustomDescriptor(new EnergyDataSettingsWrapper(m_projectInfo.Document));
}
}
/// <summary>
/// Gets or sets Project Issue Data
/// </summary>
[Category("Other"), DisplayName("Project Issue Data")]
public String IssueDate
{
get
{
return m_projectInfo.IssueDate;
}
set
{
m_projectInfo.IssueDate = value;
}
}
/// <summary>
/// Gets or sets Project Status
/// </summary>
[Category("Other"), DisplayName("Project Status")]
public String Status
{
get
{
return m_projectInfo.Status;
}
set
{
m_projectInfo.Status = value;
}
}
/// <summary>
/// Gets or sets Client Name
/// </summary>
[Category("Other"), DisplayName("Client Name")]
public String ClientName
{
get
{
return m_projectInfo.ClientName;
}
set
{
m_projectInfo.ClientName = value;
}
}
/// <summary>
/// Gets or sets Project Address
/// </summary>
[Category("Other"), DisplayName("Project Address")]
public String Address
{
get
{
return m_projectInfo.Address;
}
set
{
m_projectInfo.Address = value;
}
}
/// <summary>
/// Gets or sets Project Number
/// </summary>
[Category("Other"), DisplayName("Project Number")]
public String Number
{
get
{
return m_projectInfo.Number;
}
set
{
m_projectInfo.Number = value;
}
}
#region IWrapper Members
/// <summary>
/// Gets the handle object.
/// </summary>
[Browsable(false)]
public object Handle
{
get
{
return m_projectInfo;
}
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
[Category("Other"), DisplayName("Project Name")]
public String Name
{
get
{
return m_projectInfo.Name;
}
set
{
m_projectInfo.Name = value;
}
}
#endregion
#endregion
}
}
@@ -0,0 +1,178 @@
using System;
using System.ComponentModel;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// Wrapper class for SiteLocation
/// </summary>
public class SiteLocationWrapper : IWrapper
{
#region Fields
/// <summary>
/// SiteLocation
/// </summary>
private SiteLocation m_siteLocation;
#endregion
#region Constructors
/// <summary>
/// Initializes private variables.
/// </summary>
/// <param name="siteLocation"></param>
public SiteLocationWrapper(SiteLocation siteLocation)
{
m_siteLocation = siteLocation;
//m_citys = RevitStartInfo.RevitApp.Cities;
}
#endregion
#region Properties
/// <summary>
/// Gets or sets TimeZone
/// </summary>
[DisplayName("Time Zone"), TypeConverter(typeof(TimeZoneConverter))]
public String TimeZone
{
get
{
return GetTimeZoneFromDouble(m_siteLocation.TimeZone);
}
//set
//{
// m_siteLocation.TimeZone = GetTimeZoneFromString(value);
//}
}
/// <summary>
/// Gets or sets Longitude
/// </summary>
[DisplayName("Longitude"), TypeConverter(typeof(AngleConverter))]
public double Longitude
{
get
{
return m_siteLocation.Longitude;
}
set
{
m_siteLocation.Longitude = value;
}
}
/// <summary>
/// Gets or sets Latitude
/// </summary>
[DisplayName("Latitude"), TypeConverter(typeof(AngleConverter))]
public double Latitude
{
get
{
return m_siteLocation.Latitude;
}
set
{
m_siteLocation.Latitude = value;
}
}
[DisplayName("City"), TypeConverter(typeof(CityConverter))]
public City City
{
get
{
return GetCityFromPosition(Latitude, Longitude);
}
set
{
m_siteLocation.Latitude = value.Latitude;
m_siteLocation.Longitude = value.Longitude;
m_siteLocation.TimeZone = value.TimeZone;
}
}
private City GetCityFromPosition(double latitude, double longitude)
{
foreach (City city in RevitStartInfo.RevitApp.Cities)
{
if (DoubleEquals(city.Latitude, latitude) && DoubleEquals(city.Longitude, longitude))
return city;
}
return null;
}
public static bool DoubleEquals(double x, double y)
{
return Math.Abs(x - y) < 1E-9;
}
#region IWrapper Members
/// <summary>
/// Gets the handle object.
/// </summary>
[Browsable(false)]
public object Handle
{
get { return m_siteLocation; }
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
[Browsable(false)]
public String Name
{
get
{
return m_siteLocation.Name;
}
set
{
m_siteLocation.Name = value;
}
}
#endregion
#endregion
#region Methods
/// <summary>
/// Get time zone double value from time zone string
/// </summary>
/// <param name="value">time zone string</param>
/// <returns>the value of time zone</returns>
private double GetTimeZoneFromString(string value)
{
//i.e. convert "(GMT-12:00) International Date Line West" to 12.0
//i.e. convert "(GMT-03:30) Newfoundland" to 3.30
string timeZoneDouble = value.Substring(4, value.IndexOf(')') - 4).Replace(':', '.').Trim();
if (string.IsNullOrEmpty(timeZoneDouble))
return 0d;
else
return Double.Parse(timeZoneDouble);
}
/// <summary>
/// Get time zone display string from time zone value
/// </summary>
/// <param name="timeZone">zone value</param>
/// <returns>display string</returns>
private string GetTimeZoneFromDouble(double timeZone)
{
// e.g. get "(GMT-04:00) Santiago" from double number 4.0
// should find the last one who matches the time zone
string lastTimeZone = null;
foreach (string tmpTimeZone in RevitStartInfo.TimeZones)
{
object tmpZone = this.GetTimeZoneFromString(tmpTimeZone);
if ((double)tmpZone == timeZone)
lastTimeZone = tmpTimeZone;
}
return lastTimeZone;
}
#endregion
}
}
@@ -0,0 +1,247 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Reflection;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
///
/// </summary>
public class WrapperCustomDescriptor : ICustomTypeDescriptor, IWrapper
{
#region Fields
/// <summary>
/// Handle object
/// </summary>
object m_handle = null;
#endregion
#region Constructors
/// <summary>
/// Initializes handle object
/// </summary>
/// <param name="handle">Handle object</param>
public WrapperCustomDescriptor(object handle)
{
m_handle = handle;
}
#endregion
#region Properties
/// <summary>
/// Gets handle object
/// </summary>
public object Handle
{
get { return m_handle; }
}
/// <summary>
/// Gets the name of the handle object if it has the Name property,
/// otherwise returns Handle.ToString().
/// </summary>
public string Name
{
get
{
MethodInfo mi = this.Handle.GetType().GetMethod("get_Name", new Type[0]);
if (mi != null)
{
object name = mi.Invoke(this.Handle, new object[0]);
if (name != null)
{
return name.ToString();
}
else
{
return string.Empty;
}
}
return Handle.ToString();
}
}
#endregion
#region Methods
#region ICustomTypeDescriptor Members
/// <summary>
/// Returns a collection of custom attributes for this instance of a component.
/// </summary>
/// <returns>Handle's attributes</returns>
public AttributeCollection GetAttributes()
{
return TypeDescriptor.GetAttributes(m_handle, false);
}
/// <summary>
/// Returns the class name of this instance of a component.
/// </summary>
/// <returns>Handle's class name</returns>
public string GetClassName()
{
return TypeDescriptor.GetClassName(m_handle, false);
}
/// <summary>
/// Returns the name of this instance of a component.
/// </summary>
/// <returns>The name of handle object</returns>
public string GetComponentName()
{
return TypeDescriptor.GetComponentName(m_handle, false);
}
/// <summary>
/// Returns a type converter for this instance of a component.
/// </summary>
/// <returns>The converter of the handle</returns>
public TypeConverter GetConverter()
{
return TypeDescriptor.GetConverter(m_handle, false);
}
/// <summary>
/// Returns the default event for this instance of a component.
/// </summary>
/// <returns>An EventDescriptor that represents the default event for this object,
/// or null if this object does not have events.</returns>
public EventDescriptor GetDefaultEvent()
{
return TypeDescriptor.GetDefaultEvent(m_handle, false);
}
/// <summary>
/// Returns the default property for this instance of a component.
/// </summary>
/// <returns>A PropertyDescriptor that represents the default property for this object,
/// or null if this object does not have properties.</returns>
public PropertyDescriptor GetDefaultProperty()
{
return TypeDescriptor.GetDefaultProperty(m_handle, false);
}
/// <summary>
/// Returns an editor of the specified type for this instance of a component.
/// </summary>
/// <param name="editorBaseType">A Type that represents the editor for this object. </param>
/// <returns>An Object of the specified type that is the editor for this object,
/// or null if the editor cannot be found.</returns>
public object GetEditor(Type editorBaseType)
{
return TypeDescriptor.GetEditor(m_handle, editorBaseType, false);
}
/// <summary>
/// Returns the events for this instance of a component using the specified attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type Attribute that is used as a filter. </param>
/// <returns>An EventDescriptorCollection that represents the filtered events for this component instance.</returns>
public EventDescriptorCollection GetEvents(Attribute[] attributes)
{
return TypeDescriptor.GetEvents(m_handle, attributes, false);
}
/// <summary>
/// Returns the events for this instance of a component.
/// </summary>
/// <returns>An EventDescriptorCollection that represents the events for this component instance.</returns>
public EventDescriptorCollection GetEvents()
{
return TypeDescriptor.GetEvents(m_handle, false);
}
/// <summary>
/// Returns the properties for this instance of a component using the attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type Attribute that is used as a filter.</param>
/// <returns>A PropertyDescriptorCollection that
/// represents the filtered properties for this component instance.</returns>
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
// get handle's properties
PropertyDescriptorCollection collection = TypeDescriptor.GetProperties(m_handle, attributes, false);
// create empty collection
PropertyDescriptorCollection collection2 = new PropertyDescriptorCollection(new PropertyDescriptor[0]);
// filter properties by RevitVersionAttribute.
// if there is RevitVersionAttribute specified and the designated names does not
// contain current Revit version, the property will not be exposed.
foreach (PropertyDescriptor pd in collection)
{
bool matchRevitVersion = true;
foreach (Attribute att in pd.Attributes)
{
RevitVersionAttribute pfa = att as RevitVersionAttribute;
if (pfa != null)
{
if (!pfa.Names.Contains(RevitStartInfo.RevitProduct))
matchRevitVersion = false;
break;
}
}
if (matchRevitVersion)
collection2.Add(pd);
}
return collection2;
}
/// <summary>
/// Returns the properties for this instance of a component.
/// </summary>
/// <returns>A PropertyDescriptorCollection that represents the properties
/// for this component instance.</returns>
public PropertyDescriptorCollection GetProperties()
{
return TypeDescriptor.GetProperties(m_handle, false);
}
/// <summary>
/// Returns an object that contains the property described by the specified property descriptor.
/// </summary>
/// <param name="pd">A PropertyDescriptor that represents the property whose owner is to be found. </param>
/// <returns>Handle object</returns>
public object GetPropertyOwner(PropertyDescriptor pd)
{
return m_handle;
}
#endregion
/// <summary>
/// overrides ToString method
/// </summary>
/// <returns>The name of the handle object</returns>
public override string ToString()
{
return this.Name;
}
#endregion
}
}
@@ -0,0 +1,52 @@
//
// (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.Text;
using Autodesk.Revit;
namespace Revit.SDK.Samples.ProjectInfo.CS
{
/// <summary>
/// wrapper interface
/// </summary>
public interface IWrapper
{
#region Properties
/// <summary>
/// Gets the handle object.
/// </summary>
object Handle
{
get;
}
/// <summary>
/// Gets the name of the handle.
/// </summary>
string Name
{
get;
}
#endregion
}
}