Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exculde template view during View3d wrapping #1239

Merged
merged 2 commits into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ public static WallType Wrap(Autodesk.Revit.DB.WallType ele, bool isRevitOwned)

public static View3D Wrap(Autodesk.Revit.DB.View3D view, bool isRevitOwned)
{
if (view.IsPerspective)
if (!view.IsTemplate)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exclude template views for now, waiting for API guild's response whether we should totally ignore them or there are other work around.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is OK to ignore them. I think our users only cares about normal views (that may have a view template applied).

{
return PerspectiveView.FromExisting(view, isRevitOwned);
}
else
{
return AxonometricView.FromExisting(view, isRevitOwned);
if (view.IsPerspective)
return PerspectiveView.FromExisting(view, isRevitOwned);
else
return AxonometricView.FromExisting(view, isRevitOwned);
}
return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hesitate to wrap template 3dViews to whatever since that wrapping seems to always success that we might wrapped them to wrong dynamo types without the right query from IsPerspective(). I am returning null, as a result, they will appear "null" in the list of watch node. let me know if this is a bad idea.

}

public static Element Wrap(Autodesk.Revit.DB.ViewPlan view, bool isRevitOwned)
Expand Down
11 changes: 8 additions & 3 deletions test/Libraries/RevitIntegrationTests/SelectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ public void DynamoAllSelectionNodeTests_WithPreSelectedEntities()
ViewModel.OpenCommand.Execute(testPath);

// check all the nodes and connectors are loaded
Assert.AreEqual(35, model.CurrentWorkspace.Nodes.Count());
Assert.AreEqual(18, model.CurrentWorkspace.Connectors.Count());
Assert.AreEqual(38, model.CurrentWorkspace.Nodes.Count());
Assert.AreEqual(20, model.CurrentWorkspace.Connectors.Count());

AssertNoDummyNodes();

Expand All @@ -446,7 +446,7 @@ public void DynamoAllSelectionNodeTests_WithPreSelectedEntities()
var floor = GetPreviewValueAtIndex(allElementAtLevelNodeID, 2) as Revit.Elements.Floor;
Assert.IsNotNull(floor);

// ElementsOfCategory & Categories, as output of Categories
// ElementsOfCategories & Adaptive Points, as output of Categories
// passed to ElementsOFCategory
var elementsOfCategoryNodeID = "24f225e1-8883-48c3-a8ba-773b2734336c";
AssertPreviewCount(elementsOfCategoryNodeID, 22);
Expand All @@ -456,6 +456,11 @@ public void DynamoAllSelectionNodeTests_WithPreSelectedEntities()
Assert.IsNotNull(refPt);
}

// ElementsOfCategories & Views, as output of Categories
// passed to ElementsOFCategory
var elementsOfViewNodeID = "2569434a-b34f-4512-a4fe-f065c7a10175";
AssertPreviewCount(elementsOfViewNodeID, 33);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new case filtering out all views in the sample.rvt, since template views will appear null, by pass the null check.


// ElementsOfFamilyType & Family Type, as FamilyType output passed to
// ElementsOfFamilyTypes node.
var elementsOfFamilyTypeNodeID = "657017f1-4775-4daa-b00e-8d85392be6b5";
Expand Down
Loading