Skip to content

Commit 3b11b5b

Browse files
authored
Revert "Element type (#25) (#2468)"
This reverts commit 391e46f.
1 parent 391e46f commit 3b11b5b

42 files changed

Lines changed: 375 additions & 5796 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/DynamoRevit/Resources/LayoutSpecs.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@
118118
{
119119
"path": "RevitNodes.Revit.Elements.Element"
120120
},
121-
{
122-
"path": "RevitNodes.Revit.Elements.ElementType"
123-
},
124121
{
125122
"path": "RevitNodes.Revit.Elements.FailureMessage"
126123
},

src/DynamoRevitIcons/RevitNodesImages.resx

Lines changed: 0 additions & 697 deletions
Large diffs are not rendered by default.

src/Libraries/RevitNodes/Elements/CurtainSystemType.cs

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,26 @@ namespace Revit.Elements
88
/// <summary>
99
/// A Revit CurtainSystemType
1010
/// </summary>
11-
public class CurtainSystemType : ElementType
11+
public class CurtainSystemType : Element
1212
{
1313
#region Internal properties
1414

1515
/// <summary>
1616
/// An internal reference to the CurtainSystemType
1717
/// </summary>
18-
internal Autodesk.Revit.DB.CurtainSystemType InternalCurtainSystemType => InternalElementType as Autodesk.Revit.DB.CurtainSystemType;
18+
internal Autodesk.Revit.DB.CurtainSystemType InternalCurtainSystemType
19+
{
20+
get; private set;
21+
}
22+
23+
/// <summary>
24+
/// Reference to the Element
25+
/// </summary>
26+
[SupressImportIntoVM]
27+
public override Autodesk.Revit.DB.Element InternalElement
28+
{
29+
get { return InternalCurtainSystemType; }
30+
}
1931

2032
#endregion
2133

@@ -24,9 +36,38 @@ public class CurtainSystemType : ElementType
2436
/// <summary>
2537
/// Private constructor for the Element
2638
/// </summary>
39+
/// <param name="CurtainSystemType"></param>
40+
private CurtainSystemType(Autodesk.Revit.DB.CurtainSystemType curtainSystemType)
41+
{
42+
SafeInit(() => InitCurtainSystemType(curtainSystemType));
43+
}
44+
45+
#endregion
46+
47+
#region Private constructors
48+
49+
/// <summary>
50+
/// Initialize a CurtainSystemType element
51+
/// </summary>
52+
/// <param name="CurtainSystemType"></param>
53+
private void InitCurtainSystemType(Autodesk.Revit.DB.CurtainSystemType curtainSystemType)
54+
{
55+
InternalSetCurtainSystemType(curtainSystemType);
56+
}
57+
58+
#endregion
59+
60+
#region Private mutators
61+
62+
/// <summary>
63+
/// Set the CurtainSystemType property, element id, and unique id
64+
/// </summary>
2765
/// <param name="curtainSystemType"></param>
28-
private CurtainSystemType(Autodesk.Revit.DB.CurtainSystemType curtainSystemType):base(curtainSystemType)
66+
private void InternalSetCurtainSystemType( Autodesk.Revit.DB.CurtainSystemType curtainSystemType )
2967
{
68+
this.InternalCurtainSystemType = curtainSystemType;
69+
this.InternalElementId = curtainSystemType.Id;
70+
this.InternalUniqueId = curtainSystemType.UniqueId;
3071
}
3172

3273
#endregion
@@ -50,7 +91,7 @@ private CurtainSystemType(Autodesk.Revit.DB.CurtainSystemType curtainSystemType)
5091
/// </summary>
5192
/// <param name="name"></param>
5293
/// <returns></returns>
53-
public static new CurtainSystemType ByName(string name)
94+
public static CurtainSystemType ByName(string name)
5495
{
5596
if (name == null)
5697
{
@@ -82,7 +123,7 @@ private CurtainSystemType(Autodesk.Revit.DB.CurtainSystemType curtainSystemType)
82123
/// <summary>
83124
/// Create a CurtainSystemType from a user selected Element.
84125
/// </summary>
85-
/// <param name="curtainSystemType"></param>
126+
/// <param name="CurtainSystemType"></param>
86127
/// <param name="isRevitOwned"></param>
87128
/// <returns></returns>
88129
internal static CurtainSystemType FromExisting(Autodesk.Revit.DB.CurtainSystemType curtainSystemType, bool isRevitOwned)

src/Libraries/RevitNodes/Elements/Element.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,23 @@ public Category GetCategory
197197
}
198198

199199
/// <summary>
200-
/// Returns the ElementType for this Element. Returns null if the Element cannot have an ElementType assigned.
200+
/// Returns the FamilyType for this Element. Returns null if the Element cannot have a FamilyType assigned.
201201
/// </summary>
202202
/// <returns name="ElementType">Element Type or Null.</returns>
203-
public ElementType ElementType
203+
public Element ElementType
204204
{
205205
get
206206
{
207207
var typeId = this.InternalElement.GetTypeId();
208208
if (typeId == ElementId.InvalidElementId)
209+
{
209210
return null;
210-
211-
var doc = DocumentManager.Instance.CurrentDBDocument;
212-
return doc.GetElement(typeId).ToDSType(true) as ElementType;
211+
}
212+
else
213+
{
214+
var doc = DocumentManager.Instance.CurrentDBDocument;
215+
return doc.GetElement(typeId).ToDSType(true);
216+
}
213217
}
214218
}
215219

src/Libraries/RevitNodes/Elements/ElementType.cs

Lines changed: 0 additions & 188 deletions
This file was deleted.

src/Libraries/RevitNodes/Elements/FamilyType.cs

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,27 @@ namespace Revit.Elements
1111
/// A Revit FamilyType, the Revit API refers to this as a FamilySymbol
1212
/// </summary>
1313
[RegisterForTrace]
14-
public class FamilyType: ElementType
14+
public class FamilyType: Element
1515
{
1616

1717
#region Internal Properties
1818

1919
/// <summary>
2020
/// Internal wrapper property
2121
/// </summary>
22-
internal Autodesk.Revit.DB.FamilySymbol InternalFamilySymbol => InternalElementType as Autodesk.Revit.DB.FamilySymbol;
22+
internal Autodesk.Revit.DB.FamilySymbol InternalFamilySymbol
23+
{
24+
get;
25+
private set;
26+
}
27+
28+
/// <summary>
29+
/// Reference to the Element
30+
/// </summary>
31+
public override Autodesk.Revit.DB.Element InternalElement
32+
{
33+
get { return InternalFamilySymbol; }
34+
}
2335

2436
#endregion
2537

@@ -29,8 +41,37 @@ public class FamilyType: ElementType
2941
/// Private constructor for building a DSFamilySymbol
3042
/// </summary>
3143
/// <param name="symbol"></param>
32-
private FamilyType(Autodesk.Revit.DB.FamilySymbol symbol):base(symbol)
44+
private FamilyType(Autodesk.Revit.DB.FamilySymbol symbol)
45+
{
46+
SafeInit(() => InitFamilySymbol(symbol));
47+
}
48+
49+
#endregion
50+
51+
#region Helper for private constructors
52+
53+
/// <summary>
54+
/// Initialize a FamilySymbol element
55+
/// </summary>
56+
/// <param name="symbol"></param>
57+
private void InitFamilySymbol(Autodesk.Revit.DB.FamilySymbol symbol)
58+
{
59+
InternalSetFamilySymbol(symbol);
60+
}
61+
62+
#endregion
63+
64+
#region Private mutators
65+
66+
/// <summary>
67+
/// Set the internal model of the family symbol along with its ElementId and UniqueId
68+
/// </summary>
69+
/// <param name="symbol"></param>
70+
private void InternalSetFamilySymbol(Autodesk.Revit.DB.FamilySymbol symbol)
3371
{
72+
this.InternalFamilySymbol = symbol;
73+
this.InternalElementId = symbol.Id;
74+
this.InternalUniqueId = symbol.UniqueId;
3475
}
3576

3677
#endregion
@@ -156,7 +197,7 @@ public static FamilyType ByFamilyNameAndTypeName(string familyName, string typeN
156197
/// <search>
157198
/// symbol
158199
/// </search>
159-
public static new FamilyType ByName(string name)
200+
public static FamilyType ByName(string name)
160201
{
161202
if (name == null)
162203
{

0 commit comments

Comments
 (0)