-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PlanViewRange - Add functionality (#84)
* Get SectionDatas from TableData * If get element fails, try get category, since the method SupportedColorFillCategoryIds returns category ids * PlanViewRange - Add functionality to retrieve levels and offsets Co-authored-by: michaelcoffey <[email protected]>
- Loading branch information
1 parent
c812f73
commit 4b7b03a
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Autodesk.Revit.DB; | ||
|
||
namespace RevitLookup.Snoop.Data | ||
{ | ||
public class PlanViewRangeGetLevelId : Data | ||
{ | ||
private readonly PlanViewRange _planViewRange; | ||
private readonly Document _document; | ||
|
||
public PlanViewRangeGetLevelId(string label, PlanViewRange planViewRange, Document doc) : base(label) | ||
{ | ||
_planViewRange = planViewRange; | ||
_document = doc; | ||
} | ||
|
||
public override string StrValue() | ||
{ | ||
return "< Get Level Ids >"; | ||
} | ||
|
||
public override bool HasDrillDown => _planViewRange != null; | ||
|
||
public override void DrillDown() | ||
{ | ||
if (!HasDrillDown) return; | ||
|
||
var sectionDataObjects = new List<SnoopableObjectWrapper>(); | ||
|
||
foreach (PlanViewPlane type in Enum.GetValues(typeof(PlanViewPlane))) | ||
{ | ||
var levelId = _planViewRange.GetLevelId(type); | ||
if (levelId != null && levelId != Autodesk.Revit.DB.ElementId.InvalidElementId) | ||
{ | ||
var level = _document.GetElement(levelId) as Level; | ||
sectionDataObjects.Add(new SnoopableObjectWrapper(type.ToString(), level)); | ||
} | ||
else | ||
sectionDataObjects.Add(new SnoopableObjectWrapper(type.ToString(), levelId)); | ||
} | ||
|
||
if (!sectionDataObjects.Any()) return; | ||
|
||
var form = new Forms.Objects(sectionDataObjects); | ||
form.ShowDialog(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Autodesk.Revit.DB; | ||
|
||
namespace RevitLookup.Snoop.Data | ||
{ | ||
public class PlanViewRangeGetOffset : Data | ||
{ | ||
private readonly PlanViewRange _planViewRange; | ||
|
||
public PlanViewRangeGetOffset(string label, PlanViewRange planViewRange) : base(label) | ||
{ | ||
_planViewRange = planViewRange; | ||
} | ||
|
||
public override string StrValue() | ||
{ | ||
return "< Get Offsets >"; | ||
} | ||
|
||
public override bool HasDrillDown => _planViewRange != null; | ||
|
||
public override void DrillDown() | ||
{ | ||
if (!HasDrillDown) return; | ||
|
||
var sectionDataObjects = new List<SnoopableObjectWrapper>(); | ||
|
||
foreach (PlanViewPlane type in Enum.GetValues(typeof(PlanViewPlane))) | ||
{ | ||
var offset = _planViewRange.GetOffset(type); | ||
sectionDataObjects.Add(new SnoopableObjectWrapper(type.ToString(), offset)); | ||
} | ||
|
||
if (!sectionDataObjects.Any()) return; | ||
|
||
var form = new Forms.Objects(sectionDataObjects); | ||
form.ShowDialog(); | ||
} | ||
} | ||
} |