Skip to content

Commit

Permalink
Updates to Dynamo for Revit 2016 to align with core API. (#1387)
Browse files Browse the repository at this point in the history
* Shazam!

* Updates for core API change to remove PortData collections.

* Revert "Shazam!"

This reverts commit 80b6f9a.
  • Loading branch information
Ian Keough authored Nov 6, 2016
1 parent 8b45312 commit 69b6754
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
18 changes: 9 additions & 9 deletions src/Libraries/RevitNodesUI/Elements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public class ElementsOfFamilyType : ElementsQueryBase
{
public ElementsOfFamilyType()
{
InPortData.Add(new PortData("Family Type", Properties.Resources.PortDataFamilTypeToolTip));
OutPortData.Add(new PortData("Elements", Properties.Resources.PortDataElementsToolTip));
InPorts.Add(new PortModel(PortType.Input, this, new PortData("Family Type", Properties.Resources.PortDataFamilTypeToolTip)));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("Elements", Properties.Resources.PortDataElementsToolTip)));

RegisterAllPorts();
}
Expand All @@ -106,8 +106,8 @@ public class ElementsOfType : ElementsQueryBase
{
public ElementsOfType()
{
InPortData.Add(new PortData("element type", Properties.Resources.PortDataElementTypeToolTip));
OutPortData.Add(new PortData("elements", Properties.Resources.PortDataAllElementsInDocumentToolTip));
InPorts.Add(new PortModel(PortType.Input, this, new PortData("element type", Properties.Resources.PortDataElementTypeToolTip)));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllElementsInDocumentToolTip)));
RegisterAllPorts();
}

Expand All @@ -129,8 +129,8 @@ public class ElementsOfCategory : ElementsQueryBase
{
public ElementsOfCategory()
{
InPortData.Add(new PortData("Category", Properties.Resources.PortDataCategoryToolTip));
OutPortData.Add(new PortData("Elements", Properties.Resources.PortDataElementTypeToolTip));
InPorts.Add(new PortModel(PortType.Input, this, new PortData("Category", Properties.Resources.PortDataCategoryToolTip)));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("Elements", Properties.Resources.PortDataElementTypeToolTip)));

RegisterAllPorts();
}
Expand All @@ -153,8 +153,8 @@ public class ElementsAtLevel : ElementsQueryBase
{
public ElementsAtLevel()
{
InPortData.Add(new PortData("Level", Properties.Resources.PortDataALevelToolTip));
OutPortData.Add(new PortData("Elements", Properties.Resources.PortDataElementAtLevelToolTip));
InPorts.Add(new PortModel(PortType.Input, this, new PortData("Level", Properties.Resources.PortDataALevelToolTip)));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("Elements", Properties.Resources.PortDataElementAtLevelToolTip)));

RegisterAllPorts();
}
Expand All @@ -180,7 +180,7 @@ public class ElementsInView : RevitNodeModel

public ElementsInView()
{
OutPortData.Add(new PortData("elements", Properties.Resources.PortDataAllVisibleElementsToolTip));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllVisibleElementsToolTip)));
RegisterAllPorts();

DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged;
Expand Down
11 changes: 6 additions & 5 deletions src/Libraries/RevitNodesUI/RevitDropDown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public class FamilyInstanceParameters : RevitDropDownBase
public FamilyInstanceParameters()
: base("Parameter")
{
this.AddPort(PortType.Input, new PortData("f", Properties.Resources.PortDataFamilySymbolToolTip), 0);
this.PropertyChanged += OnPropertyChanged;
InPorts.Add(new PortModel(PortType.Input, this, new PortData("f", Properties.Resources.PortDataFamilySymbolToolTip)));
PropertyChanged += OnPropertyChanged;
}

void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
Expand Down Expand Up @@ -451,9 +451,10 @@ public class Categories : EnumBase<BuiltInCategory>
{
public Categories()
{
OutPortData[0].NickName = "Category";
OutPortData[0].ToolTipString = Properties.Resources.PortDataCategoriesToolTip;
OutPorts[0].SetPortData(OutPortData[0]);
var existing = OutPorts[0];
OutPorts[0] = new PortModel(PortType.Output, this,
new PortData("Category", Properties.Resources.PortDataCategoriesToolTip, existing.DefaultValue));
OutPorts[0].GUID = existing.GUID;
}

protected override SelectionState PopulateItemsCore(string currentSelection)
Expand Down
2 changes: 1 addition & 1 deletion src/Libraries/RevitNodesUI/SiteLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class SiteLocation : RevitNodeModel

public SiteLocation()
{
OutPortData.Add(new PortData("Location", Properties.Resources.PortDataLocationToolTip));
OutPorts.Add(new PortModel(PortType.Output, this, new PortData("Location", Properties.Resources.PortDataLocationToolTip)));
RegisterAllPorts();

Location = DynamoUnits.Location.ByLatitudeAndLongitude(0.0, 0.0);
Expand Down
9 changes: 2 additions & 7 deletions src/Libraries/RevitNodesUI/SunPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@
using Dynamo.Applications;
using Dynamo.Applications.Models;
using Dynamo.Graph.Nodes;
using Dynamo.Models;
using Dynamo.Nodes;

using ProtoCore.AST.AssociativeAST;

using Revit.Elements;
using RevitServices.Elements;
using RevitServices.Persistence;
using RevitServices.Transactions;
using BuiltinNodeCategories = Revit.Elements.BuiltinNodeCategories;

namespace DSRevitNodesUI
Expand All @@ -28,8 +23,8 @@ public class SunSettings : RevitNodeModel

public SunSettings()
{
OutPortData.Add(
new PortData("SunSettings", Properties.Resources.PortDataSunSettingToolTip));
OutPorts.Add(new PortModel(PortType.Output, this,
new PortData("SunSettings", Properties.Resources.PortDataSunSettingToolTip)));

RegisterAllPorts();

Expand Down
4 changes: 2 additions & 2 deletions test/Libraries/RevitIntegrationTests/BugTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,14 +1113,14 @@ public void UpdatedGraphIsNotRunAgain_MAGN_8367()
selectNode.UpdateSelection(new[] { ElementSelector.
ByUniqueId("2049bcda-4652-4dce-8114-728cd33b120b-00000f4f").InternalElement });
// Change the color to (0, 255, 255)
colorNode.InPorts[1].Disconnect(colorNode.InPorts[1].Connectors[0]);
colorNode.InPorts[1].Connectors.Remove(colorNode.InPorts[1].Connectors[0]);
RunCurrentModel();

// Change the selected element back to the first element
selectNode.UpdateSelection(new[] { ElementSelector.
ByUniqueId("350f68bb-624c-405f-b93f-f7e6ff82778b-00000910").InternalElement });
// Change the color again to (0, 0, 255)
colorNode.InPorts[2].Disconnect(colorNode.InPorts[2].Connectors[0]);
colorNode.InPorts[2].Connectors.Remove(colorNode.InPorts[2].Connectors[0]);
RunCurrentModel();

// Now check the overriden color of element with ID of 2320 to be (0, 0, 255)
Expand Down

0 comments on commit 69b6754

Please sign in to comment.