Andy Broomell Posted May 3, 2019 Share Posted May 3, 2019 I have a couple custom scripts that I've collected over the years, many created by the fine folks on this forum. A number of these scripts operate on "selected objects", but I've noticed that they also operate on selected objects on layers that are set to invisible (an odd concept, but that's what VW does). This sometimes produces unexpected results, so I'm wondering if there's a way to make the scripts operate on selected objects on visible, editable layers only? For example, the script I currently have to hide selected objects looks like this: Hide(SEL=TRUE); What would I add to change the criteria? I should note that some of the scripts I'd like to modify are more complex, but this is a good starting point. Since I don't know Vectorscript at all, any help would be appreciated. Thanks! Quote Link to comment
Pat Stanford Posted May 3, 2019 Share Posted May 3, 2019 There was a new call added a few years ago. VSEL for Visible Selection State. This only handles objects that are both visible (not in a hidden layer or class) AND selected. Change your SEL above to VSEL and you should be good to go. Other steps may be required for other scripts. Especially ones that use something like BLAH:=FSActLayer; 1 Quote Link to comment
Andy Broomell Posted September 13, 2019 Author Share Posted September 13, 2019 Thanks Pat! Didn't see this till now somehow. Does there happen to be a call for selected objects that are on layers that are both visible and currently editable? (Or if not, perhaps on the Active Layer only?) I run into issues when I have Layer Options set to "Show/Snap" others: I can technically have objects on the non-active layer selected, but the OIP only tells me what I have selected on the active layer. What happens is I don't realize that a script might be acting on objects that are on a visible (but not active or editable) layer since the OIP is not telling me I have them selected. As an example... the lovely "Rotate Randomly" script that you wrote for me a while back (and that I use all the time) has occasionally left me parts of the entire venue rotated since there were objects selected on the non-active layer. Just trying to fool-proof against myself 🙂 Quote Link to comment
Pat Stanford Posted September 13, 2019 Share Posted September 13, 2019 Not really a criteria for what you want. Easiest way I know of to see the available criteria is to go to a worksheet and Insert:Criteria and look at the options in the first pull down menu. In a script, you could use something like: DSelectObj(L<>GetLayerName(ActLayer); This should DeSelect everything not on the active layer. For Manual use, make a script with a single line of: DSelectAll; Then run that script before you start a big selection process to run a script. Quote Link to comment
herbieherb Posted October 23, 2019 Share Posted October 23, 2019 The ForEachObjectInLayer() runs a function on each object. You can choose to perform the action only on selected objects, active layer, visible layer, snappable layer etc. See the function appendix. 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.