tbexon Posted November 24, 2023 Share Posted November 24, 2023 HI All Apologies if this has been answered somewhere already I'm struggling to find any answers. I am using vs.NameClass() to create a new class within a PIO. Is there a way to make that Class automatically visible in Viewports AND saved views similar to functionality within the new class dialog (SS below for reference) I'm basically looking for a way to force that class to be visible within all Viewports & Saved views to stop the user having to go through and edit them afterwards. I'm guessing I could iterate through every single viewport once the class is created and edit the visibility there. But that seems massively time consuming and inefficient. Especially for a large document. If this is the only option available to me, does anyone know if this approach would also work with Saved Views? I can see a function for creating a new Saved View (vs.SaveSheet()) but nothing to get a list of saved views or edit one. Thanks in Advance! Quote Link to comment
Pat Stanford Posted November 24, 2023 Share Posted November 24, 2023 It looks like ObjectVariableInt with a handle to a class and a selector of 1018 will do what you want. Procedure Test; VAR H1:Handle; S1:String; BEGIN S1:=Date(2,2); NameClass(S1); H1:=GetObject(S1); SetObjectVariableInt(H1,1018, 2 ); End; Run(Test); Actually it will do far more than you want. SetObjectVariableInt(GetObject('Class Name 3'),1018,2); The one line above will set Class Name 3 to Grey in all Viewports. Use with Caution. -1 = Invisible 0 = Normal 2 = Grey There is a similar ObjectVariable 455 that sounds like it will do the same for Saved Views. And 1017 is for Layers in Viewports And 454 is for Layers in Saved Views. Please note that even though 1017 and 1018 are in the Viewports section of the Appendix, they need a handle to the Class Definition, not to the Viewport. HTH Quote Link to comment
tbexon Posted November 25, 2023 Author Share Posted November 25, 2023 Thanks Pat! That was exactly what I was looking for! Absolute hero! 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.