Skip to content

Commit

Permalink
feat(dui2/rhino/revit): better reporting and previews (#1450)
Browse files Browse the repository at this point in the history
* added sending preview

* added preview receive

* refactored bake operation

* conduit added

* flattencommit logic fixed

* adds preview button to dui

* fixed direct receive

* preview send finished

* Updated Reporting

* conversion error updates

* updating converter methods

* Consolidated Preview and Report object into ApplicationObject

* updated desktopui

* updated converter

* clears stored connector application objects

* added dui2 report page

* Added report page

* report updates

* restyled report

* formatting update

* Improved preview button

* Fixed block reporting

* Added selectable preview objects

* added report search

* changed expanders to colorzone

* Updated autocad converter

* fixed flatten commit logic for reporting

* all connectors updated with new bindings and application object

* missed some applicationplaceholderobjects

* removed all return values of List<ApplicationObject> in revit converter

* improved reporting backwards compatibility

* report page scroll added

also includes revit connector bindings selection

* Update ConversionUtils.cs

* Fix for Tekla Structures for Report preview

* fix(dui): ld report not scrollable because hidden behind the new report component

* chore(dui): fiddles and formatting

* added new revit send report

* fixed new connector binding exception

removed not implemented exceptions to prevent crash across sharp connectors

* revit hosted elements send report fix

* skipping blocks and views in rhino preview receive

* added report copy to clipboard

* preview button implements IsReady check

* feat(dui): disables preview button when InProgress

Co-authored-by: Reynold Chan <[email protected]>
Co-authored-by: Matteo Cominetti <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2022
1 parent 25319b4 commit b3cccd5
Show file tree
Hide file tree
Showing 110 changed files with 2,653 additions and 2,388 deletions.
24 changes: 19 additions & 5 deletions ConnectorArchicad/ConnectorArchicad/ConnectorBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,46 @@ public override List<StreamState> GetStreamsInFile()
return new List<StreamState>();
}

public override void ResetDocument()
{
// TODO!
}

public override List<ReceiveMode> GetReceiveModes()
{
return new List<ReceiveMode> { ReceiveMode.Create };
}

public override Task<StreamState> PreviewReceive(StreamState state, ProgressViewModel progress)
{
return null;
// TODO!
}

public override async Task<StreamState> ReceiveStream(StreamState state, ProgressViewModel progress)
{
Base commitObject = await Helpers.Receive(IdentifyStream(state));
if (commitObject is null)
{
return null;
}

state.SelectedObjectIds = await ElementConverterManager.Instance.ConvertToNative(commitObject, progress.CancellationTokenSource.Token);

return state;
}

public override void SelectClientObjects(string args) { }
public override void SelectClientObjects(List<string> args, bool deselect = false)
{
// TODO!
}

public override void PreviewSend(StreamState state, ProgressViewModel progress)
{
// TODO!
}
public override async Task<string> SendStream(StreamState state, ProgressViewModel progress)
{
if (state.Filter is null)
{
return null;
}

state.SelectedObjectIds = state.Filter.Selection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,24 @@ public override List<MenuItem> GetCustomStreamMenuItems()
return new List<MenuItem>();
}

public override void SelectClientObjects(string args)
public override void SelectClientObjects(List<string> args, bool deselect = false)
{
throw new NotImplementedException();
// TODO!
}

public override void ResetDocument()
{
// TODO!
}

#endregion

#region receiving
public override async Task<StreamState> PreviewReceive(StreamState state, ProgressViewModel progress)
{
return null;
// TODO!
}
public override async Task<StreamState> ReceiveStream(StreamState state, ProgressViewModel progress)
{
var kit = KitManager.GetDefaultKit();
Expand Down Expand Up @@ -485,6 +495,10 @@ private bool GetOrMakeLayer(string layerName, Transaction tr, out string cleanNa
#endregion

#region sending
public override async void PreviewSend(StreamState state, ProgressViewModel progress)
{
// TODO!
}
public override async Task<string> SendStream(StreamState state, ProgressViewModel progress)
{
var kit = KitManager.GetDefaultKit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public override void WriteStreamsToFile(List<StreamState> streams)
DocumentStreams.Add(s);
WriteStateToFile();
}
//throw new NotImplementedException();
}

//public override void AddNewStream(StreamState state)
Expand Down
33 changes: 6 additions & 27 deletions ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Recieve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
namespace Speckle.ConnectorCSI.UI
{
public partial class ConnectorBindingsCSI : ConnectorBindings

{
#region receiving
public override Task<StreamState> PreviewReceive(StreamState state, ProgressViewModel progress)
{
return null;
// TODO!
}

public override async Task<StreamState> ReceiveStream(StreamState state, ProgressViewModel progress)
{
Exceptions.Clear();
Expand All @@ -41,9 +45,7 @@ public override async Task<StreamState> ReceiveStream(StreamState state, Progres
var stream = await state.Client.StreamGet(state.StreamId);

if (progress.CancellationTokenSource.Token.IsCancellationRequested)
{
return null;
}

var transport = new ServerTransport(state.Client.Account, state.StreamId);

Expand Down Expand Up @@ -76,9 +78,7 @@ public override async Task<StreamState> ReceiveStream(StreamState state, Progres
);

if (progress.Report.OperationErrorsCount != 0)
{
return state;
}

try
{
Expand All @@ -97,14 +97,10 @@ await state.Client.CommitReceived(new CommitReceivedInput


if (progress.Report.OperationErrorsCount != 0)
{
return state;
}

if (progress.CancellationTokenSource.Token.IsCancellationRequested)
{
return null;
}

var conversionProgressDict = new ConcurrentDictionary<string, int>();
conversionProgressDict["Conversion"] = 0;
Expand All @@ -116,16 +112,13 @@ await state.Client.CommitReceived(new CommitReceivedInput
progress.Update(conversionProgressDict);
};


var commitObjs = FlattenCommitObject(commitObject, converter);
foreach (var commitObj in commitObjs)
{
BakeObject(commitObj, state, converter);
updateProgressAction?.Invoke();
}



try
{
//await state.RefreshStream();
Expand All @@ -142,11 +135,6 @@ await state.Client.CommitReceived(new CommitReceivedInput
return state;
}






/// <summary>
/// conversion to native
/// </summary>
Expand All @@ -157,7 +145,6 @@ private void BakeObject(Base obj, StreamState state, ISpeckleConverter converter
{
try
{

converter.ConvertToNative(obj);
}
catch (Exception e)
Expand All @@ -183,40 +170,32 @@ private List<Base> FlattenCommitObject(object obj, ISpeckleConverter converter)
if (converter.CanConvertToNative(@base))
{
objects.Add(@base);

return objects;
}
else
{
foreach (var prop in @base.GetDynamicMembers())
{
objects.AddRange(FlattenCommitObject(@base[prop], converter));
}
return objects;
}
}

if (obj is List<object> list)
{
foreach (var listObj in list)
{
objects.AddRange(FlattenCommitObject(listObj, converter));
}
return objects;
}

if (obj is IDictionary dict)
{
foreach (DictionaryEntry kvp in dict)
{
objects.AddRange(FlattenCommitObject(kvp.Value, converter));
}
return objects;
}

return objects;
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace Speckle.ConnectorCSI.UI
{
public partial class ConnectorBindingsCSI : ConnectorBindings

{
public override List<string> GetSelectedObjects()
{
Expand All @@ -20,14 +19,11 @@ public override List<string> GetSelectedObjects()
{
(string typeName, string name) = item;
if (ConnectorCSIUtils.IsTypeCSIAPIUsable(typeName))
{
names.Add(string.Concat(typeName, ": ", name));
}
}
if (names.Count == 0)
{
return new List<string>() { };
}

return names;
}

Expand All @@ -49,32 +45,31 @@ public override List<ISelectionFilter> GetSelectionFilters()
}

return new List<ISelectionFilter>()
{
new AllSelectionFilter {Slug="all", Name = "Everything",
Icon = "CubeScan", Description = "Selects all document objects." },
new ListSelectionFilter {Slug="type", Name = "Categories",
Icon = "Category", Values = objectTypes,
Description="Adds all objects belonging to the selected types"},
//new PropertySelectionFilter{
// Slug="param",
// Name = "Param",
// Description="Adds all objects satisfying the selected parameter",
// Icon = "FilterList",
// HasCustomProperty = false,
// Values = objectNames,
// Operators = new List<string> {"equals", "contains", "is greater than", "is less than"}
//},

new ManualSelectionFilter(),
new ListSelectionFilter { Slug = "group", Name = "Group",
Icon = "SelectGroup", Values = groups, Description = "Add all objects belonging to CSI Group" }
};
{
new AllSelectionFilter {Slug="all", Name = "Everything",
Icon = "CubeScan", Description = "Selects all document objects." },
new ListSelectionFilter {Slug="type", Name = "Categories",
Icon = "Category", Values = objectTypes,
Description="Adds all objects belonging to the selected types"},
//new PropertySelectionFilter{
// Slug="param",
// Name = "Param",
// Description="Adds all objects satisfying the selected parameter",
// Icon = "FilterList",
// HasCustomProperty = false,
// Values = objectNames,
// Operators = new List<string> {"equals", "contains", "is greater than", "is less than"}
//},

new ManualSelectionFilter(),
new ListSelectionFilter { Slug = "group", Name = "Group",
Icon = "SelectGroup", Values = groups, Description = "Add all objects belonging to CSI Group" }
};
}

public override void SelectClientObjects(string args)
public override void SelectClientObjects(List<string> args, bool deselect = false)
{
throw new NotImplementedException();
// TODO!
}

private List<string> GetSelectionFilterObjects(ISelectionFilter filter)
Expand All @@ -89,20 +84,17 @@ private List<string> GetSelectionFilterObjects(ISelectionFilter filter)
return GetSelectedObjects();
case "all":
if (ConnectorCSIUtils.ObjectIDsTypesAndNames == null)
{
ConnectorCSIUtils.GetObjectIDsTypesAndNames(Model);
}

selection.AddRange(ConnectorCSIUtils.ObjectIDsTypesAndNames
.Select(pair => pair.Key).ToList());
return selection;


case "type":
var typeFilter = filter as ListSelectionFilter;
if (ConnectorCSIUtils.ObjectIDsTypesAndNames == null)
{
ConnectorCSIUtils.GetObjectIDsTypesAndNames(Model);
}

foreach (var type in typeFilter.Selection)
{
selection.AddRange(ConnectorCSIUtils.ObjectIDsTypesAndNames
Expand All @@ -111,17 +103,15 @@ private List<string> GetSelectionFilterObjects(ISelectionFilter filter)
.ToList());
}
return selection;

case "group":
//Clear objects first
Model.SelectObj.ClearSelection();
var groupFilter = filter as ListSelectionFilter;
foreach (var group in groupFilter.Selection)
{
Model.SelectObj.Group(group);
}
return GetSelectedObjects();


return GetSelectedObjects();

/// CSI doesn't list fields of different objects.
/// For "param" search, maybe search over the name of
Expand Down
Loading

0 comments on commit b3cccd5

Please sign in to comment.