Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
ui and units fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Feb 14, 2020
1 parent 1d5c211 commit 47bfe62
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
3 changes: 3 additions & 0 deletions SpeckleRevitReboot/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public Result Execute( ExternalCommandData commandData, ref string message, Elem
#else
SpeckleWindow = new SpeckleUiWindow( bindings, @"https://matteo-dev.appui.speckle.systems/#/" ); // On release, default to the latest ci-ed version from https://appui.speckle.systems
#endif

SpeckleWindow.Height = 1000;

SpeckleUiBindingsRevit.SpeckleWindow = SpeckleWindow;
var helper = new System.Windows.Interop.WindowInteropHelper( SpeckleWindow );
helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
Expand Down
4 changes: 2 additions & 2 deletions SpeckleRevitReboot/SpeckleRevit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
<Reference Include="SpecklePopup, Version=1.6.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SpecklePopup.1.6.13\lib\net45\SpecklePopup.dll</HintPath>
</Reference>
<Reference Include="SpeckleUiBase, Version=1.1.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\SpeckleUiBase.1.1.4-wip\lib\net452\SpeckleUiBase.dll</HintPath>
<Reference Include="SpeckleUiBase, Version=1.1.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\SpeckleUiBase.1.1.5\lib\net452\SpeckleUiBase.dll</HintPath>
</Reference>
<Reference Include="SQLite-net, Version=1.5.231.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll</HintPath>
Expand Down
25 changes: 24 additions & 1 deletion SpeckleRevitReboot/UI/Receiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace SpeckleRevit.UI
{
public partial class SpeckleUiBindingsRevit
{
#region overries
/// <summary>
/// This function will bake the objects in the given receiver. Behaviour:
/// 1) Fresh bake: objects are created
Expand Down Expand Up @@ -300,6 +301,25 @@ public override void BakeReceiver(string args)
Executor.Raise();
}

/// <summary>
/// Shows/hides the zoom on selected objects button
/// </summary>
/// <returns></returns>
public override bool CanSelectObjects()
{
return true;
}

/// <summary>
/// Shows/hides the toggle preview icon
/// </summary>
/// <returns></returns>
public override bool CanTogglePreview()
{
return false;
}

#endregion
/// <summary>
/// Diffs stream objects based on appId + _id non-matching.
/// </summary>
Expand Down Expand Up @@ -328,7 +348,7 @@ private double GetScale(string units)
{
//var units = ( ( string ) stream.BaseProperties.units ).ToLower();
// TODO: Check unit scales properly
switch (units)
switch (units.ToLowerInvariant())
{
case "kilometers":
return 3.2808399 * 1000;
Expand All @@ -355,6 +375,9 @@ private double GetScale(string units)
return 3.2808399;
};
}



}

}
2 changes: 1 addition & 1 deletion SpeckleRevitReboot/UI/Sender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override void PushSender(string args)
var convertedObjects = new List<SpeckleObject>();
var placeholders = new List<SpeckleObject>();

var units = CurrentDoc.Document.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits.ToString().ToLower().Replace("dut_", "");
var units = CurrentDoc.Document.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits.ToString().ToLowerInvariant().Replace("dut_", "");
InjectScaleInKits(GetScale(units)); // this is used for feet to sane units conversion.

int i = 0;
Expand Down
2 changes: 1 addition & 1 deletion SpeckleRevitReboot/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<package id="Revit.RevitApiUI.x64" version="2019.0.0" targetFramework="net471" />
<package id="SpeckleCore" version="1.6.17-wip" targetFramework="net471" />
<package id="SpecklePopup" version="1.6.13" targetFramework="net471" />
<package id="SpeckleUiBase" version="1.1.4-wip" targetFramework="net471" />
<package id="SpeckleUiBase" version="1.1.5" targetFramework="net471" />
<package id="sqlite-net-pcl" version="1.5.231" targetFramework="net471" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.11" targetFramework="net471" />
<package id="SQLitePCLRaw.core" version="1.1.11" targetFramework="net471" />
Expand Down

0 comments on commit 47bfe62

Please sign in to comment.