From 1123054216a66074ae726343f037754d84fc99b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Tue, 16 Jul 2024 18:06:36 +0300 Subject: [PATCH] Better naming for definitions (#30) --- .../HostApp/AutocadInstanceObjectManager.cs | 13 +++---------- .../HostApp/RhinoInstanceObjectsManager.cs | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 56c15e709..fc3841beb 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -110,7 +110,7 @@ out List instanceProxiesWithSameDefinition applicationId = definitionId.ToString(), Objects = new(), MaxDepth = depth, - ["name"] = definition.Name, + Name = definition.Name, ["comments"] = definition.Comments, ["units"] = definition.Units // ? not sure needed? }; @@ -168,15 +168,8 @@ public BakeResult BakeInstances( var record = new BlockTableRecord(); var objectIds = new ObjectIdCollection(); - record.Name = baseLayerName; - if (definitionProxy["name"] is string name) - { - record.Name += name; - } - else - { - record.Name += definitionProxy.applicationId; - } + // We're expecting to have Name prop always for definitions. If there is an edge case, ask to Dim or Ogu + record.Name = $"{definitionProxy.Name}-({definitionProxy.applicationId})-{baseLayerName}"; foreach (var entity in constituentEntities) { diff --git a/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs b/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs index e0927620c..99d31f9a5 100644 --- a/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs +++ b/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs @@ -101,7 +101,7 @@ out List instanceProxiesWithSameDefinition applicationId = instanceDefinitionId, Objects = new List(), MaxDepth = depth, - ["name"] = instance.InstanceDefinition.Name, + Name = instance.InstanceDefinition.Name, ["description"] = instance.InstanceDefinition.Description }; @@ -168,7 +168,7 @@ public BakeResult BakeInstances( } // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? - var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; + var defName = $"{definitionProxy.Name}-({definitionProxy.applicationId})-{baseLayerName}"; var defIndex = doc.InstanceDefinitions.Add( defName, "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first