You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
match name.Split([|"::"|], StringSplitOptions.None)with// TODO or use StringSplitOptions.RemoveEmptyEntries ??
110
111
|[||]-> RhinoScriptingException.Raise "RhinoScriptSyntax.UtilLayer.getOrCreateLayer: Cannot get or create layer for name: '%s'" name
111
112
| ns ->
112
-
let reccreateLayer(nameList,prevId,prevIdx,root):int =
113
-
match nameList with
114
-
|[]-> prevIdx // exit recursion
115
-
| branch :: rest ->
116
-
if String.IsNullOrWhiteSpace branch then// to cover for StringSplitOptions.None
117
-
RhinoScriptingException.Raise "RhinoScriptSyntax.UtilLayer.getOrCreateLayer: A segment falls into String.IsNullOrWhiteSpace. Cannot get or create layer for name: '%s'" name
layer.Color <- colorForNewLayers()// delay creation of (random) color till actually needed ( so random colors are not created, in most cases layer exists)
140
-
leti= State.Doc.Layers.Add(layer)
141
-
letid= State.Doc.Layers.[i].Id // just using layer.Id would be empty guid
142
-
createLayer(rest , id , i, fullPath)
143
-
144
-
| i ->
145
-
createLayer(rest , State.Doc.Layers.[i].Id , i ,fullPath)
RhinoSync.DoSync(fun()->// if not done sync the layer ui becomes unresponsive and might crash
114
+
let reccreateLayer(nameList,prevId,prevIdx,root):int =
115
+
match nameList with
116
+
|[]-> prevIdx // exit recursion
117
+
| branch :: rest ->
118
+
if String.IsNullOrWhiteSpace branch then// to cover for StringSplitOptions.None
119
+
RhinoScriptingException.Raise "RhinoScriptSyntax.UtilLayer.getOrCreateLayer: A segment falls into String.IsNullOrWhiteSpace. Cannot get or create layer for name: '%s'" name
layer.Color <- colorForNewLayers()// delay creation of (random) color till actually needed ( so random colors are not created, in most cases layer exists)
142
+
leti= State.Doc.Layers.Add(layer)
143
+
letid= State.Doc.Layers.[i].Id // just using layer.Id would be empty guid
144
+
createLayer(rest , id , i, fullPath)
145
+
146
+
| i ->
147
+
createLayer(rest , State.Doc.Layers.[i].Id , i ,fullPath)
layer.Color <- color()// delay creation of (random) color till actually needed ( so random colors are not created, in most cases layer exists)
155
-
if layer.ParentLayerId <> Guid.Empty then RhinoScriptingException.Raise "RhinoScriptSyntax.createDefaultLayer how can a new default layer have a parent ? %A" layer
layer.Color <- color()// delay creation of (random) color till actually needed ( so random colors are not created, in most cases layer exists)
159
+
if layer.ParentLayerId <> Guid.Empty then RhinoScriptingException.Raise "RhinoScriptSyntax.createDefaultLayer how can a new default layer have a parent ? %A" layer
0 commit comments