I try change de Layer ID , but for some reason the id dont change:
var layer = doc.Layers.FindName("ServiceLayer");
layer.Id = new Guid("7F7C7FE1-979E-432A-AB63-F64836EA66ED");
var idString = layer.Id;
MessageBox.Show(idString.ToString());
HI Matrix
You can check the layer.IdIsLocked Property. If the ID is locked. You can try to delete the original layer, Create a new layer with the new ID and place it at the original index position.
You are right and the layer id is lock, but I don’t understand why, I’m creating this layer at the same time, I just want to assign a fixed ID to this layer:
doc.Layers.Add("ServiceLayer",Color.Transparent);
var layer = doc.Layers.FindName("ServiceLayer");
layer.Id = new Guid("7F7C7FE1-979E-432A-AB63-F64836EA66ED");
var idString = layer.Id;
MessageBox.Show(idString.ToString());
I can’t find any way to assign the id at the same time as the layer creation.
Basically, I want to create some layers to use with my plugin, to make it easier I was thinking of creating them with fixed ids, whenever rhino is opened it checks if these layers exist, if don’t, they create them with fixed ids.
Anyway, I also wish these layers were not exposed to user, or at least editable by the user, and i’m not getting that.
With the layer.table event I got the user to not be able to edit almost everything, but I can’t stop the user from selecting the layer, in which case he can delete the layer and that won’t be good for my plugin.
Hi @MatrixRatrix You can force lock layers to make them completely uneditable by a user if you play around with the RhinoEvents, would that suit your needs?
I’ve also tried, the problem is that I can’t avoid the selection by the user with the events, and the user can select and delete, I’m debating this in another topic.