Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 736711efaa | |||
| e8cf2e3de0 | |||
| 85ba291af8 | |||
| 007f7c896f |
@@ -17,8 +17,19 @@ public class RhinoGroupUnpacker
|
||||
|
||||
public Dictionary<string, GroupProxy> GroupProxies { get; } = new();
|
||||
|
||||
public void UnpackGroups(IEnumerable<RhinoObject> rhinoObjects)
|
||||
public void UnpackGroups(IReadOnlyList<RhinoObject> rhinoObjects)
|
||||
{
|
||||
if (RhinoDoc.ActiveDoc.Groups.Count == 0)
|
||||
{
|
||||
// Documents with lots of instances (e.g. skp imports) perform poorly with this function
|
||||
// Because its implementation is not very efficient, requiring it to deeply traverse all instances
|
||||
// This causes a LOT of memory allocations, which was causing SKP file imports to fail (OOM)
|
||||
// This is a very dumb work around. The ideal fix would be for us to optimise this function,
|
||||
// and if possible, avoid needing to traverse instances (maybe we could loop over the groups and use `GroupTable.GetMembers(index)` instead)
|
||||
// SEE https://linear.app/speckle/issue/CNX-3184/skp-file-upload-fails-rhino-importer
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (RhinoObject rhinoObject in rhinoObjects)
|
||||
{
|
||||
try
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder<RhinoObject>
|
||||
rootObjectCollection[ProxyKeys.INSTANCE_DEFINITION] = instanceDefinitionProxies; // this won't work re traversal on receive
|
||||
|
||||
// 2 - Unpack the groups
|
||||
_groupUnpacker.UnpackGroups(rhinoObjects);
|
||||
// _groupUnpacker.UnpackGroups(rhinoObjects);
|
||||
rootObjectCollection[ProxyKeys.GROUP] = _groupUnpacker.GroupProxies.Values;
|
||||
|
||||
// 3 - Convert atomic objects
|
||||
|
||||
@@ -12,10 +12,10 @@ internal sealed class SketchupConfig : IFileTypeConfig
|
||||
JoinEdges = true,
|
||||
JoinFaces = true,
|
||||
Weld = false,
|
||||
AddObjectsToGroups = true,
|
||||
ImportCurves = true,
|
||||
ImportFacesAsMeshes = true,
|
||||
UseGroupLayers = true,
|
||||
AddObjectsToGroups = false,
|
||||
UseGroupLayers = false,
|
||||
};
|
||||
|
||||
public RhinoDoc OpenInHeadlessDocument(string filePath)
|
||||
@@ -25,6 +25,11 @@ internal sealed class SketchupConfig : IFileTypeConfig
|
||||
{
|
||||
throw new SpeckleException("Rhino could not import this file");
|
||||
}
|
||||
|
||||
// Our GroupUnpacker is very unoptimised for files that contain a lot of instances (like skp imports).
|
||||
// This enables a dumb work-around to skip the GroupUnpacker and avoid OOM.
|
||||
// SEE https://linear.app/speckle/issue/CNX-3184/skp-file-upload-fails-rhino-importer
|
||||
// doc.Groups.Clear();
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public static class Program
|
||||
{
|
||||
ILogger? logger = null;
|
||||
ImporterInstance? importer = null;
|
||||
|
||||
// Thread.Sleep(10000);
|
||||
try
|
||||
{
|
||||
var importerArgs = JsonSerializer.Deserialize<ImporterArgs>(args[0], s_serializerOptions);
|
||||
|
||||
Reference in New Issue
Block a user