sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Few Quick Question for Tool

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 231 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kdasilva
      last edited by

      Hello, this is obviously my first post, I hope I am in the right forumn....because I hesitate to call myself a developer, but I am building a tool.

      Context: For my Honours thesis I am building a plugin for sketchup that walks community members through a urban design methodology. I would be happy to give more information if anyone is interested.

      my background comes from GeoWeb programming, so I'm no pro at Ruby, Although I did just read through all of "Automatic Sketchup, Creating 3-D Models in ruby" (huge props to Matthew Scarpino for writing it).

      I just had a few questions I to clear up right now, but I will not doubt be back with more:

      1. I am debating on how to best approach my GUI, as it is a key part of my tool. It will need to have a lot of descriptions/text as well as collect deal with a lot of input from the users. Is the UI class enough to handle this....should I move to the more robust Web Dialog? Currently I am leaning towards web dialogs.

      2. Sorry if this one is a stupid question but: How would you recommend saving the variables that keep track of the various inputs my users put in if they want to re-open Sketchup. I can store variable information with attributes for entities...but if i wanted to say have arrays that hold different community visions for the model, I don't think I can assign attributes to the model can I? perhaps some sort of empty entity I dump information into.

      3. is there a reason they added:

      Added in SketchUp 8.0+:
      addBuilding:
      getPhotoTexture:
      selectImageIglooTool:
      selectNorthTool:

      to the send_action method but didn't include the new "add_location" tool button? I was hoping to bring this up for the users so they wouldn't have to search down the button.

      Thanks all for now~

      Cheers

      Korbin

      1 Reply Last reply Reply Quote 0
      • K Offline
        kwalkerman
        last edited by

        1. I have found webdialogs far more useful than the standard UI options. Post questions here when you get into it. Passing information back and forth has its challenges.

        2. You can do Model.set_attribute, and you are allowed to save arrays of data. See this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=30066 for information about what types of data are allowed in set_attribute. I've found that set_attribute is by far the best way to save data between sessions. This way the data is saved even if the file name is changed, the file is moved, or the file is edited by a user that does not have your plugin.

        3. No Clue. I'm sure someone else will have an answer for this.

        Good luck!

        --
        Karen

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @kdasilva said:

          1. is there a reason they added:
            ... to the send_action method but didn't include the new "add_location" tool button? I was hoping to bring this up for the users so they wouldn't have to search down the button.

          Korbin, (welcome..) "add_location" is not actually new, the tooltip for the button changed to better describe the function as it interacts with the user in the 8+ edition.

          If you are only concerned with PC, see my topic on send_action:
          [Code] Sketchup.send_action() : Arguments to

          P.S.: click the "Ruby Resorces" link below in my signature line.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @kdasilva said:

            2) ... How would you recommend saving the variables that keep track of the various inputs my users put in if they want to re-open Sketchup.

            If the variables are specific to a certain model.. then attributes attached to the model.

            If they are general to a plugin and will be used with more than one model, then look at Sketchup.read_default and Sketchup.write_default methods. (It's best to convert all data to strings that will be written into the Windows Registry.)

            Or you can use a Settings Hash convert it to a string with .inspect() and write it out to a file. An easy way is to use Marshal.dump() and Marshal.load() (but there are versioning issues.) It's not that hard to open a File object and use it's write() or puts() method to send the string to the file. That way you won't have marshaling version isssues, and as you need to open the file IO object in both cases, it's not much difference, either way.

            @kdasilva said:

            I can store variable information with attributes for entities...but if i wanted to say have arrays that hold different community visions for the model, I don't think I can assign attributes to the model can I?

            Any Entity subclass inherits the attribute methods. And also they are defined for Sketchup::Model class.

            So for instance you can attach attributes to a Layer or a (Scene) Page because they are Entity subclasses (not just to the Drawingelement subclasses.)

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement