sketchucation logo sketchucation
    • Login
    1. Home
    2. joshb
    3. Posts
    ⚠️ Attention | Having issues with Sketchucation Tools 5? Report Here
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 24
    • Groups 1

    Posts

    Recent Best Controversial
    • 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
    • Ruby slowdown

      I've noticed that the performance of my plugin degrades the longer I keep Sketchup open. All I'm doing in my plugin is modifying attribute dictionaries on various entities and coloring and/or showing/hiding based on their attributes. I can close/reopen Sketchup and run the exact same test case and see things perform noticeably faster.

      I realize that my question here is sufficiently vague, but was wondering if anyone had encountered anything like this and/or had any pointers on how to proceed in debugging.

      Some things that I've considered could be going wrong are

      • garbage collection - not quite sure how to debug this
      • undo/redo stack memory consumption - memory seems to be staying constant, and I'm using the start/commit operations on the model to limit undo/redo activity

      Any pointers here would be greatly appreciated.

      Thanks again,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Disable_ui

      Do you think I could use the View.dynamic method for speeding things up when updating many elements in a large model?

      posted in Developers' Forum
      J
      joshb
    • RE: Disable_ui

      Thanks for the quick replies.

      I saw that the View class has an invalidate method that's available in 6, so I was hoping that there was some corresponding way to disable updates too... Now I'm curious, what's the purpose of having a way to force an update in 6 if there's no way to disable screen updates?

      posted in Developers' Forum
      J
      joshb
    • Disable_ui

      The documentation for Model.start_operation mentions a disable_ui parameter that disables screen updates to speed up your code while youre making lots of updates to the model. Unfortunately its only available in 7.0+. Does anyone know of a way to accomplish this in 6?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Transparency in Sketchup 6

      Thanks!

      posted in Developers' Forum
      J
      joshb
    • RE: Transparency in Sketchup 6

      Thanks TIG... Seems like the Style is the issue. In this particular model the "enable transparency" option on the style is not checked. When I programmatically add a material with transparency, its still not checked... only upon adjusting the alpha in the materials editor does it become checked. If I manually enable the transparency in the style, my tool then works as expected.

      Looking at the documentation for the style object, it seems pretty sparse. Is there there any way to programmatically set the style to turn on transparency? Or is there a way to switch to use one of the default styles?

      Thanks again,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Transparency in Sketchup 6

      Thanks for the help guys. I switched up my code to apply the alpha to the material vs the color but am still having problems. Here what I'm experiencing now.

      If I use my tool to apply the new color (white with alpha=.1), the entity just turns white with no alpha. If I then bring up the materials editor and edit my newly created material, it properly shows up in the dialog as having an alpha of .1. If I then use the editor to modify the alpha, say from 10 to 11, the alpha is then visible in the 3D view.

      So it looks like my code is setting all of the data up properly, but just not triggering the view to refresh. I see that the view class has a refresh method but that its not available in 6. Is there an equivalent way to do that in 6 that might explain this behavior?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • Transparency in Sketchup 6

      I'm trying to programatically create a new transparent material and I'm having trouble getting this to work in Sketchup 6. Worked fine in 8 but backporting to 6 and its not.

      All I'm doing is the following

      $transparent_matl = Sketchup::Color.new
      $transparent_matl.red = 255
      $transparent_matl.green = 255
      $transparent_matl.blue = 255
      $transparent_matl.alpha = 0

      When I do this in 6, the entity gets colored white but completely opaque. My new material does get added to the materials list. And from there I can assign it to the entity and see the transparency.... This worked fine in 8 and I'd like to get it to work in 6 if possible.

      Any ideas?

      Thanks,
      Josh

      posted in Developers' Forum
      J
      joshb
    • RE: Error installing SketchUp 6

      I was able to find a version of the 6 installer that worked (http://sketchup.google.com/gsu8/download.html). This was for 6.4.265.

      The installer that I was having problems with was here: http://sketchup.google.com/support/bin/answer.py?hl=en&answer=60107. This said it was for 6.4 Maintenance Release 6.

      Now that I've got the eval version, I'm finding out that Google doesnt sell licenses for older versions any more. Joy.

      Josh

      posted in SketchUp Bug Reporting
      J
      joshb
    • Error installing SketchUp 6

      My customer is using SketchUp 6, so I'm attempting to install 6 to do some testing with my plug in. I've downloaded the version available online, 6.4 Maintenance Release 6.

      When I run the installer (as admin), I get a "feature transfer error". The dialog lists Feature: DefaultFeature and Error: Catastrophic failure. This is a popup modal dialog. The main installshield dialog says that its currently installing LayoutInstaller.exe.

      I did a few searches and found other folks reporting similar errors but no resolutions.

      I'm running SketchUp 8 on this XP machine, if that matters. Any help in getting a version of 6.0 pro working would be greatly appreciated.

      Thanks,
      Josh

      posted in SketchUp Bug Reporting sketchup
      J
      joshb
    • 1 / 1