setdesigner Posted April 4, 2022 Share Posted April 4, 2022 Hello, I am trying to write a script so I can right click on an object and hide that object's layer. Any help would be apprciated since I am very new to scripting and this doesn't work. PROCEDURE DesactivateLayer; VAR h : HANDLE; Selected() : TRUE : BEGIN IF h<>NIL THEN BEGIN Layer (GetLName (GetLayer(h))); HideLayer; END; END; RUN(DesactivateLayer); Quote Link to comment
Pat Stanford Posted April 4, 2022 Share Posted April 4, 2022 Try this script. There are other ways, but they are not currently updating the visibility columns in the Navigation Palette. I have submitted a bug. PROCEDURE DesactivateLayer; VAR h1, h2, h3, h4 :HANDLE; X1, Y1 :Real; B1 :Boolean; N1 :Integer; BEGIN h1:=Nil; h4:=ActLayer; {save the active layer} B1:=FALSE; While Not B1 DO BEGIN {This lets you click multiple times to pick an object} GetPt(X1,Y1); B1:=GetPickObjectInfo(X1, Y1, h1, h2, N1); {ignore h2, N1 not needed} End; h3:=GetLayer(h1); {Get the layer the picked object is on} Layer(GetLName(h3)); {make the layer of the object active} HideLayer; {Hide the layer} Layer(GetLName(h4)); {respore the original layer to active} Redrawall; {redraw to make sure changes display} END; RUN(DesactivateLayer); Quote Link to comment
michaelk Posted April 4, 2022 Share Posted April 4, 2022 2 hours ago, setdesigner said: Hello, I am trying to write a script so I can right click on an object and hide that object's layer. Any help would be apprciated since I am very new to scripting and this doesn't work. Doesn't the Visibility Tool in Layer Mode | Invisible Mode do this? Quote Link to comment
setdesigner Posted April 4, 2022 Author Share Posted April 4, 2022 Thanks Pat, this works ! Select object right-click and choose the script ( I have put it in object context menu ) Click again to apply. @michaelk you are correct, but I wanted to avoid using a tool, and keep it in a context menu, just like using Lock Quote Link to comment
michaelk Posted April 5, 2022 Share Posted April 5, 2022 Believe me, I understand. …and any excuse to write a script 🙂 1 Quote Link to comment
The Hamma Posted April 5, 2022 Share Posted April 5, 2022 I too was using a script similar to this to hide classes. I’ve added so many Scripts that I’ve actually hit the limit of Scripts that a workspace can handle and I’ve had to pair down and delete Scripts from my workspace so they would all work. It would be nice if there wasn’t a limit to the workspace because I did like having the script rather than using the visibility tool. 1 Quote Link to comment
MullinRJ Posted April 6, 2022 Share Posted April 6, 2022 @The Hamma, Out of curiosity, how many scripts is too many? Ball park. I assume the limit depends on how many total items are in a workspace, but knowing how many scripts you added would be interesting to know. Also, were your scripts Menu Items, or Palette Scripts? Thanks, Raymond Quote Link to comment
The Hamma Posted April 6, 2022 Share Posted April 6, 2022 14 minutes ago, MullinRJ said: how many scripts is too many? When I export the standard architect workspace there are 911 lines of menu commands. I added 128 additional lines and the last command I added does not work. I did delete some of the default commands. Quote Link to comment
MullinRJ Posted April 6, 2022 Share Posted April 6, 2022 Thank you. Good to know. Quote Link to comment
michaelk Posted April 6, 2022 Share Posted April 6, 2022 I think the menu command limit is an OS limit, not a VW limit. I also have some experience with this limit. 🙂 Quote Link to comment
SamIWas Posted May 11, 2022 Share Posted May 11, 2022 On 4/5/2022 at 8:30 PM, MullinRJ said: @The Hamma, Out of curiosity, how many scripts is too many? Ball park. I assume the limit depends on how many total items are in a workspace, but knowing how many scripts you added would be interesting to know. Also, were your scripts Menu Items, or Palette Scripts? Thanks, Raymond I think the number depends on the alignment of the planets, and it will change over time. I used to have a massive workspace full of custom scripts which made my workflow exceptionally fast. Then somewhere around 2015, workspaces started to break apart if there were too many scripts. Many just wouldn't run. This lasted for years. 2021 seemed to fix it, and I loaded up my workspace again, and it worked well. Then, over time, commands started to break, not work at all, or call up completely random other commands. I've never figured out an actual number. Hopefully, 2022 fixes it, but I'm not holding my breath. Quote Link to comment
MullinRJ Posted May 11, 2022 Share Posted May 11, 2022 Hi SamIWas, You might want to check again after the Lunar Eclipse next Monday. If you see an improvement, you might be onto something ;-) Raymond 2 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.