ge25yak Posted June 11, 2024 Share Posted June 11, 2024 Hi, is it possible to use api to duplicate/delete layers? I've tried with vs.CreateDuplicateObject, vs.HDuplicate, vs.DelObject by passing the layer handle, but they didn't work. Quote Link to comment
MullinRJ Posted June 11, 2024 Share Posted June 11, 2024 To duplicate a design layer: create the new layer, then go back to the old layer, SelectAll, and copy everything, then go to the new layer and paste in place. Use: vs.Layer('New Layer Name') vs.Layer('Old Layer Name') vs.SelectAll() vs.DoMenuTextByName('Copy', 0) vs.Layer('New Layer Name') vs.DoMenuTextByName('Paste In Place', 0) You may need to check my syntax. I didn't. Raymond 1 Quote Link to comment
Pat Stanford Posted June 11, 2024 Share Posted June 11, 2024 Yes you can delete layers. Sorry this is VS instead of Python. Procedure Test; VAR H1: Handle; BEGIN H1:=ActLayer; Layer(GetLName(FLayer)); DelObject(H1); End; Run(Test); You probably want to get fancier and do error checking. Make sure you are not trying to delete the last layer. Make sure that the layer you are trying to delete is not the First Layer. You may also want to consider if you are using the active layer if you really want to change the active layer to the first layer or if you want to do the work to set the next or previous layer to be active instead. 1 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.