Forum Replies Created

Page 8 of 9
  • Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    Late 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

    Member
    October 31, 2022 at 6:41 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    @isaac-harned

    Also 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

    Member
    October 31, 2022 at 6:03 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    @isaac-harned

    So 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.

  • Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    I’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.

  • Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    Short 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

    Member
    October 27, 2022 at 10:15 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    It would help if I actually attached the text files…. It’s late. I’m tired.

  • Liz Larsen

    Member
    October 27, 2022 at 10:00 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    YAAAASSSS! 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

    Member
    October 27, 2022 at 9:29 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    I 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

    Member
    October 27, 2022 at 8:02 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    My 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

    Member
    October 27, 2022 at 5:57 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    The 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

    Member
    October 27, 2022 at 9:40 am in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    I 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

    Member
    October 27, 2022 at 6:57 am in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    To 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.

    https://youtu.be/LoG4BnefDRo

  • Liz Larsen

    Member
    October 26, 2022 at 10:23 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    Additionally, 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

    Member
    October 26, 2022 at 10:21 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    Ok, 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:

    1. I don’t have to search a huge block of code for errors since I’m basically testing one thing at a time.
    2. 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

    Member
    October 10, 2022 at 4:44 pm in reply to: Isaac Harned – Here for forms with javascript
    Points: 4,855
    Rank: UC2 Brainery Orange Belt IIII UC2 Brainery Orange Belt IIII

    I 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!

Page 8 of 9