sketchucation logo sketchucation
    • Login
    1. Home
    2. herr_inspektor
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    H
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Auto-naming plugin ?

      Thanks TIG ! That's perfect !
      I don't know why but I thought Ruby would handle it automatically !

      posted in Newbie Forum
      H
      herr_inspektor
    • RE: Auto-naming plugin ?

      Sorry again for double post, but there's something strange going on with my script.

      It works fine ... once πŸ˜•
      I created the dictionnary as you suggested, and it's fine, I can read from it, name my group according to it and then increment but only one time.

      It seems like the incrementation is not even executed the second time. Here's what I have :

      ` # Read data from the dict
      data1 = Sketchup.active_model.get_attribute "NAME", "data1"
      data2 = Sketchup.active_model.get_attribute "NAME", "data2"
      data3 = Sketchup.active_model.get_attribute "NAME", "data3"
      data4 = Sketchup.active_model.get_attribute "NAME", "data4"

      Name the selected group according to the dict

      as.each {|g|
      Sketchup.active_model.selection.clear
      Sketchup.active_model.selection.add(g)
      g.name = "#{data1} #{data2} #{data2} #{data3}"
      Sketchup.active_model.selection.clear
      }

      Write in the dict with an incremented variable

      Sketchup.active_model.set_attribute "NAME", "data4", "#{data4 + 1}"`

      I also tried creating a variable newdata4, increment it with data4 += 1 and then update the dict with this variable, but it doesn't work either πŸ˜•

      How could this work once but not twice ?

      Thanks in advance !

      posted in Newbie Forum
      H
      herr_inspektor
    • RE: Auto-naming plugin ?

      Wow, thanks for this very clear answer TIG, didn't know it was possible to add a dictionary to the SKP itself !

      I'll try this when I get back home, thank you again !

      EDIT : That's perfect, it works as expected ! Thanks !

      posted in Newbie Forum
      H
      herr_inspektor
    • RE: Auto-naming plugin ?

      Hi all,

      Sorry for updating this topic after such a long time, but I've just started again working on my project. Thanks for your help Jim, those plugins helped me understand about Sketchup scripts !

      The only thing here is that I'd like to keep track of my variables between each time I launch the script. So here's what I did :

      I created a first script that generates a text file with values in it, and then a second script that :

      1. Parses this text file
      2. Puts variables inside a "naming convention"
      3. Names the group I've selected according to this naming convention
      4. Increments the variable
      5. Updates the textfile

      Thing is, I'd like to avoid using a text file : if the person using my script gives his sketchup file without this textfile, then all previous work would be lost. Is there a way I could store values somewhere in the program and use them as I want ?

      I thought about creating "invisible groups" and use their names as data storage, but I don't know if it's a good practice !

      If you have any idea please let me know ! πŸ˜„

      Thanks !

      posted in Newbie Forum
      H
      herr_inspektor
    • RE: Auto-naming plugin ?

      Thanks to both of you for your answers!

      @jim : i'll check your links soon as I get my computer back!

      @driven : i create these groups myself, why ?

      posted in Newbie Forum
      H
      herr_inspektor
    • Auto-naming plugin ?

      Hi everyone,

      I'm totally new to Sketchup plugin development, and I'd like to create a plugin that automatically names groups according to a naming convention. I've already developped a first version that works fine, but there's one last feature that I don't realy know how to implement.

      What I have now :

      When I create a group, I right-clic on it and I select my plugin. A pannel with a textfield appears, I enter a number, press OK and the script concatenates this number with my naming convention and names the group.

      What I'd like to do :

      I'd like to save as much time as possible because there are possibly gonna be a looooot of groups to name. My naming convention would be something like "line1 group1, line1 group2, etc."
      So, would it be possible to "autoincrement" the group number ? Maybe with something like a variable that increments each time I launch the script ? And with a possibility to set it back to 1 if I start a new "line" ? Maybe with a global variable that would be declared with SU startup or something, but then how could I set it back to zero ? With a UI button ?

      Sorry, lots of questions here, just to be clear I'm not asking for someone to do the job for me, just if someone could give me some leads, tips, tricks or whatever, that's great 😎

      Thanks in advance πŸ˜„

      posted in Newbie Forum sketchup
      H
      herr_inspektor
    • 1 / 1