Liz Larsen
MemberForum Replies Created
-
Liz Larsen
MemberOctober 27, 2022 at 6:45 am in reply to: Sharing Profiles – How to Make Sure Everyone has the Latest Updates?Points: 4,855Rank: UC2 Brainery Orange Belt IIIILate to the party, sorry.
If it’s only toolsets you’re wanting to distribute, I’d just put them on a network drive and tell everywhere where’re they’re located and how to add them to their own profile.
Since you mentioned wanting to keep them updated, make sure your team knows the difference between “Import” and “Add”. Import makes a copy and saves it on the user’s computer (I believe), whereas Add actually maps to the network drive so your users will automatically see any toolset updates when they close and re-open Bluebeam.
-
Liz Larsen
MemberOctober 31, 2022 at 6:41 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIAlso the line:
let childMask = new RegExp(“^” + tap + “-[\\d]{1,2}$”);
when I plug this into regex101, I get some weird search parameters. Never worked with the RegEx constructor, so please bear with me here =)
So if the previous tap variable only stores the number at the end of the string (Let’s say NumberOfTaps1), then this would be constructed as such:
/^1-[\\d]{1,2}$/
The part that is tripping me up is the double slashes I think, what does this do to the digit search?
You can’t plug that particular regular expression into regex101. That website is meant for only regular expressions, not for any other code (ie JavaScript).
The new RegExp(“string”) is JavaScript, therefore regex101 doesn’t know what to do with it.
new RegExp(“string”) allows you to take a string and let JavaScript know to turn it into a regular expression. Just like any other string, we can add variables.
var name = "Liz";
console.println("Hello, my name is " + name + ".");The code above will print “Hello, my name is Liz.” to the console. This is basically what we’re doing, except with a regular expression as the end result.
To answer your original question, we use the double slashes because new RegExp is a string and the \ is an escape character in JavaScript. To escape an escape character, we have to add an additional \. The first \ is the escape character, letting JavaScript know that the second \ is to be interpreted as a string character.
To test that this code works, I went to codepen.io. You can see in the attached photo how heavily I have to edit the global code to test the functionality. But it was enough proof of concept for me to know that the tap variable in my childMask regular expression was working.
I hope that makes sense.
-
Liz Larsen
MemberOctober 31, 2022 at 6:03 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIISo in the local code, the line:
var tap = dropDownName.match(/\d{1,2}$/)
Does this only store what is matched? I.e. it looks at NumberOfTaps1, and only stores the “1” since it matches the search for 1 or 2 digits at the end of the string?
Yes, you got it. The tap variable stores the number of taps for that particular terminal. (I always hope that I’m using the correct terminology for your PDF)
var dropDownName = event.target.name stores the name of the dropdown box
var tap = dropDownName.match(/\d{1,2}$/) stores the digit on the end of the dropDownName, thereby effectively finding the layer it’s on.
That tap variable is then passed to the global code, which turns the appropriate layers on or off.
-
Liz Larsen
MemberOctober 28, 2022 at 7:25 am in reply to: Sharing Profiles – How to Make Sure Everyone has the Latest Updates?Points: 4,855Rank: UC2 Brainery Orange Belt IIIII’d like an option to export a profile with only things I specify. Like when you export a CSV summary of markups, you can pick and choose what you want exported.
I’d like an “Export Profile” button and a dialog box pops up with checkboxes. Same with an “Import Profile” button. It’ll say “This profile contains custom toolbars, X number of toolchests, and custom statuses” with an option to import whichever you need.
-
Liz Larsen
MemberOctober 28, 2022 at 7:20 am in reply to: Sharing Profiles – How to Make Sure Everyone has the Latest Updates?Points: 4,855Rank: UC2 Brainery Orange Belt IIIIShort answer: no.
Longer answer: The Toolchest root file itself does not care when the profile gets saved. The Toolchest file only gets updated when you click the lock, make a change, then click the lock again. This being said, if you’ve got users’ Toolchests pointed to a network drive, <i style=”font-weight: bold;”>make those Toolchest files read-only.
When the user saves their profile, the only thing about Toolchests that gets updated is which Toolchests are loaded and active, plus the path of those Toolchests.
And, if I got any of that wrong, someone please feel free to correct me.
-
Liz Larsen
MemberOctober 27, 2022 at 10:15 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIIt would help if I actually attached the text files…. It’s late. I’m tired.
-
Liz Larsen
MemberOctober 27, 2022 at 10:00 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIYAAAASSSS! I got it. Man, nothing like the adrenaline rush of successful code at almost 11pm on a school night.
Ok, I wrote some code so that all your NumberOfTaps__ dropdowns will have the same code verbatim. No need to specify what terminal it is or manually update this in any way. See the attached local code text file.
Then, that dropdown code calls a global function that does all the work. See the attached global code.
This means that if you add more terminals in the future, there’s no manually updating the code. Just copy the local code into the dropdown, label your layers and form fields correctly, and the code takes care of the rest.
-
Liz Larsen
MemberOctober 27, 2022 at 9:29 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIII actually started working on this and it’s more difficult than initially anticipated. However, I think I’m onto something and I’ll update you when I figure it out. Stay tuned!
-
Liz Larsen
MemberOctober 27, 2022 at 8:02 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIMy last little tiny piece of advice would be to move the primary code from the dropdown boxes (ie the NumberOfTaps_ form field local code) into one single function within the global JavaScript. Then in each dropdown box local code, you would set a variable like var numberOfTaps = this.getField(“NumberOfTaps2”); then call the global function using that variable.
This means if you need to update the primary code, you only have to update the global function rather than every single dropdown box.
I did not do this for my game that I made (and posted earlier in this thread) and I should have. At some point I’ll go update it to fix that. Cuz let me tell you, it was a PAIN to update the virtually identical code in every single square for some silly little mistake when I was in the process of creating it. Oof.
I hope that makes sense. If you need additional explanation or help, let me know.
-
Liz Larsen
MemberOctober 27, 2022 at 5:57 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIThe tapsMask will match either parent or child layers for all the terminal layers. So it’ll match standalone digits up to 99 and it’ll match any of those with child layers, ie 1-1, 1-2, etc… up to 99-99. I did this because I knew all parent or child layers greater than the number of terminals should be off and it was easy to just turn them all off.
Then the next else if looks for just parent terminal layers (ie 1 or 2 digits only) less than or equal to the number of terminals and turns those on.
Then the last else if looks for children terminal layers that are less than or equal to the number of taps for that particular parent layer and turns those on, if that fails, turn the rest for that tap off.
—————————————————————————————-
The double vertical lines || are indeed an OR test. That first if statement only cares if the first two digits are greater than the number of terminals, so the OR is looking for up to 2 digits only OR 2 digits that come before a “-” dash.
—————————————————————————————-
Thank you for commenting the code better than I did. I started to, and then kinda stopped… I make an attempt, but not a very good attempt when it comes to that.
-
Liz Larsen
MemberOctober 27, 2022 at 9:40 am in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIII recorded everything in one take, first try 😂 I didn’t like how the sound quality came out, so I contemplated re-recording but decided against it. I hope people give me some grace for my first ever video.
-
Liz Larsen
MemberOctober 27, 2022 at 6:57 am in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIITo help explain regular expressions and how they work with JavaScript in Bluebeam, I made a video.
Regular expressions lend themselves really well to writing code in JavaScript. It’ll vastly cut down on code bloat due to hard-coding form field or layer names, plus it’ll make your code more versatile in the future since the regular expression will take care of any new form fields that follow the naming convention you’ve already set.
Not sure if that makes sense, but the video will help with that.
-
Liz Larsen
MemberOctober 26, 2022 at 10:23 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIAdditionally, since I went through the process on my own and learned a lot, I’m going to look through your code tomorrow and see if I can figure out why it wasn’t working.
-
Liz Larsen
MemberOctober 26, 2022 at 10:21 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIIOk, so, I wasn’t sure why it wasn’t working.
I ended up writing the NumberOfTerminals dropdown box code from scratch to better learn how everything works. I like to do this piece by piece in the console first to make sure my code is doing what I expect. If it’s not, I troubleshoot until I get an expected result. Then I add that code to my overall code. Rinse and repeat until I have something that works.
This process has two benefits:
- I don’t have to search a huge block of code for errors since I’m basically testing one thing at a time.
- I learn more about how JavaScript itself works and how to get it to effectively “talk” to Bluebeam.
I did get something that works (attached) and even though it works, I still get some “false” and “undefined” stuff showing up in the console, not sure why that’s appearing or if it’ll be troublesome later.
I must go to bed now because it’s late, but take a look at what I wrote and let me know what you think.
-
Liz Larsen
MemberOctober 10, 2022 at 4:44 pm in reply to: Isaac Harned – Here for forms with javascriptPoints: 4,855Rank: UC2 Brainery Orange Belt IIIII used regex in this game I made within Bluebeam.
See the attached PDF and screenshot.
The screenshot was taken from the code attached to any of the Square buttons (Square1, Square2, etc…)
Basically, the code that uses the regex loops through all the gray/cyan buttons to see if any of them are cyan to test for a win/lose condition. Since there are a couple other buttons, I wanted this particular for loop to ignore those. That’s why all the buttons have a consistent naming scheme. The regex looks for form fields with the word “Square” followed by 1 or 2 digits, and ignores everything else.
If you’d like a free, interactive place to learn and practice some regular expressions, I recommend Free Code Camp. They have a course called JavaScript Algorithms and Data Structures (https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/). The Regular Expressions are the 3rd section when you scroll down.
I also just found this site 5 seconds ago that seems like it would be very helpful (and free): https://regexlearn.com/learn/regex101
Hopefully this gets your brain thinking about methods to condense some of your functions and how you can then combine some of your functions into a single function. Good luck and let me know if you need anymore help!