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

    joshb

    @joshb

    10
    Reputation
    1
    Profile views
    24
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    joshb Unfollow Follow
    registered-users

    Latest posts made by joshb

    • RE: Model attributes and importing

      Thanks thomthom! That is exactly what I needed to know!

      Right now users are just going through the SketchUp GUI File, Import to do their work. I'm going to look at the observers, perhaps DefinitionsObserver.onComponentAdded to see if I can do my merging there.

      Thanks again!
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Model attributes and importing

      Sorry if I wasn't clear.

      So, I'm first creating model A and setting attributes on it, using Sketchup.active_model.set_attribute. Then I'll save this out.

      Then I'll create a new model, model B, and import model A's .skp file into it. Sketchup.active_model therefore returns B after the import.

      I've got entities in the new model that reference data in the model A's attribute_dictionary.

      What I'd like to do is somehow, during the import process, merge model A's attribute_dictionary into model B's.

      To add a little background, the XML chunks are used to define metadata for individual entities. Many entities share common metadata so what I've done is create a model level database to store the actual XML and then just have the individual entities store an index. This dramatically cut down the .skp file size.

      The only issue that I'm having now is with the import. One thing that I thought about doing was instead of storing the database at the model level, just create another dedicated entity to store it, that way it would always be available after import.

      Hope that made sense... Thanks for your help!
      Josh

      posted in Developers' Forum
      J
      joshb
    • Model attributes and importing

      I'm using the model's attribute dictionary to store some large xml data which is then referenced throughout the rest of the model's entities.

      I'm wondering if there's a right way to access the model's attribute dictionary during the import process? I'd like to be able to save out a .skp file that fully attributed, and then import that into a new file, and be able to merge the attribute dictionary for the saved out .skp file into the model for new file.

      Is there a way to do this?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • Problem exploding images

      I'm doing some testing with the image exploding feature and cant seem to make sense of how its working.

      I'm creating a simple cube, and applying an image to the face. The problem I'm seeing is that, most of the time, when I explode the image, the resulting face that is formed does not have any texture applied to it. It seems that if the image touches one of the edges of the face, as opposed to being entirely contained in the face, that when exploded the texture will come through to the face. If the image is smack in the middle of the face, no texture after exploding.

      My ultimate goal here is to be able to manipulate some models in my plugin that have images in them, but I'm getting stuck on just trying to understand how/why textures arent coming through in my simple test case.

      Any insight would be very helpful.

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • Accessing System Preferences from Ruby

      I'm trying to access the default file paths in Ruby, that are set from the Files section of the Windows, Preferences dialog. I can't seem to find any way in the Ruby API to do this.

      I poked around the registry and noticed that these settings are stored in the HKCU\Software\Google\Sketchup6\FileLocations key. I though I'd be able to use the Sketchup.read_defaults methods to access these settings but the method seems to have trouble reading strings from the registry. If I call

      Sketchup.read_default "File Locations", "Models", "default"

      I get back nil. However, if I change one of the parameters to something that doesn't exist, such as

      Sketchup.read_default "File Locations X", "Models", "default"

      I get back "default". So the method is finding the entry in the registry, but I suppose it just doesn't know how to return REG_SZ values. This is probably fixed in a newer version but unfortunately I'm stuck with 6 for a while.

      Any suggestions on how to access the file path preference?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • Show Summary & Collada Export

      I'm using the Model.export method to export a collada file. The docs state that the second parameter can either be a boolean to tell SU not to show the export summary, or when exporting collada files the second param can be a set of export options.

      In my case I want to do both. I need to set the options so I can override one of the defaults, but now I'm getting the summary popup.

      Is there any way to do both?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Undo stack question

      I saw that class, but it doesn't seem to have an event for letting you know when layer visibility has changed. It can tell you when layer(s) are deleted, or when a the active layer is changed... Is there another event that I'm not seeing that might tell me when visibility changes?

      posted in Developers' Forum
      J
      joshb
    • RE: Undo stack question

      Thanks Dan. Switching over to a tool from a plugin solved just about all of my issues. The only Undo/Redo stack modifier that I seem to be left with is the Layers window. When I've got my tool up, doing anything in the layers dialog causes the stack to be modified so my tool might not close out right. I've started looking at the transaction idea again to see if I can make sense of the stack state that way. Any ideas on this one?

      Thanks again for all of your help,
      Josh

      posted in Developers' Forum
      J
      joshb
    • Undo stack question

      I've implemented a plugin that does custom coloring of the model based on user defined attributes. When my plugin is active, I want to let the user explore the model but not change anything. Right now I'm launching my web dialog using show and not show_modal to keep the navigation tools available. To undo my custom coloring, I'm using transactions. I do a start_operation when my plugin loads and an abort_operations when it closes.

      Now the problem that has come up, is that if I do anything that modifies the undo stack while my plugin is active, then when I call abort_operation, the model doesn't properly reset since one of the intermediate operations has probably already commited the transaction.

      I'm trying to solve this right now by implementing a model observer and watching the onTransactionStart, Abort, Commit, Empty methods to see if I can make any sense of that. Right now I've just implemented counters to see how many times the various events are firing and there doesnt seem to be a 1-1 correlation with the undo stack... I'm seeing way more start/commit events than things on the Undo stack.

      Does anyone have any tips on how to solve this the right way?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Ruby slowdown

      I am using the ruby console, maybe thats it.

      Regarding undo/redo, is there any way to disable that using the API? I'm using the start/commit methods to store a single entry on the stack but that single entry still seems to consume as much memory as all of the individual actions would. It would be really nice to either be able to turn that off or to clear the stack manually without forcing a save.

      thanks,
      josh

      posted in Developers' Forum
      J
      joshb