Martin Crawford Posted May 11, 2018 Share Posted May 11, 2018 Hi I am having a strange issue when I try to use Python to create sheet layers. The following code: layerName = 'Module Layout - ' + screenName vs.CreateLayer(layerName, 2) Creates the follwoing: How would I set the Sheet Number and set the Sheet Title of the text in the Sheet Number? Thanks Martin Quote Link to comment
twk Posted May 12, 2018 Share Posted May 12, 2018 screenName = "Screen 1" SheetNumber = "01" layerType = 2 layerName = "Module Layout - " + screenName newLayerHandle = vs.CreateLayer(SheetNumber, layerType) # <-- Sheet Number in the Sheet Layer context, confusing I know vs.SetObjectVariableString(newLayerHandle, 159,layerName) # <-- Found on the DevWiki Appendix page. Documentation states Layer Description, which is also misleading, as it is actually the Sheet Layer 'name' Quote Link to comment
Martin Crawford Posted May 14, 2018 Author Share Posted May 14, 2018 Nice, this is very helpful. Is there a way to change the Sheet Number after the layer has been created? I have tired a few different approaches and I can't seem to find a way. Martin Quote Link to comment
twk Posted May 18, 2018 Share Posted May 18, 2018 In the Sheet Layer context, the Sheet Number component, is basically the Layer name. so you'd use: """ Disclaimer: no warranties of any kind, expressed or inclined. Code provided for self-help use only. Save work, save often. Tui W K 2018 """ def list_layers(): # sub_function to retrieve list of layer names in document layer_names = [] hLayer = vs.FLayer() while hLayer != None: layer_names.append(vs.GetLName(hLayer)) hLayer = vs.NextLayer(hLayer) return layer_names # SAFE CHECK: # check if name is in the layer list, # then create new layer if it's not in the list. cur_layer_to_change_name = "SomeCurrentLayerName" #Replace Name of an existing Sheet Number cur_layer_handle = vs.GetLayerByName(cur_layer_to_change_name) newLayerName = "SomeNewName" if newLayerName not in list_layers(): vs.SetName(cur_layer_handle, newLayerName) HTH, Tui Quote Link to comment
Jayme McColgan Posted December 14, 2021 Share Posted December 14, 2021 very cool! how would you go about changing the Sheet layer settings like the Page setup and size Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.