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

    Topics

    • J

      Model attributes and importing

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      196 Views
      thomthomT
      @joshb said: 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 Beware! UI import is not the only thing that might import a model. If you react to an observer event you can crash SketchUp. You may also interfere with some other operation. Setting attributes is something that can be undone. And starting an operation in the middle of another one will interfer and break the first one. So if you react to an observer event and modify anything - you might break the undo-stack, you might break an operation of another plugin or native function - or you might even crash SketchUp. My recommendation for observers is to only read data. If you need to react with model changes, cache it for a later time when you know it's safe to modify your model. For instance, you detect a model import, you cache what definition that was and wait with the merge until your plugin need to access any of your data. Another thing: be very careful what your observers do. Make them do as little as possible. Events can trigger in the thousands in some scenarios and then it doesn't take much to bog down a model. Refer to this list of observer issues which I've been trying to chart: http://www.thomthom.net/software/sketchup/observers/
    • J

      Problem exploding images

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      67 Views
      No one has replied
    • J

      Accessing System Preferences from Ruby

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      269 Views
      TIGT
      This PC only code returns the keys and values for any valid Registry entry. See the notes at the end for usage require 'sketchup.rb' module TIG ### for PC use only ! def self.getregentries(key="") key.tr!("/","\\") cfile=File.join(ENV["TEMP"], "regentries.cmd") tfile=File.join(ENV["TEMP"], "regentries.tmp") f=File.open(cfile, "w") f.puts("reg query \""+key+"\" /f \"*\" /s > \""+tfile+"\"") f.close UI.openURL("file;///"+cfile) sleep(0.1) until File.exist?(tfile) sleep(0.1) lines=IO.readlines(tfile) hents={} lines.each{|line| line.chomp! next if line.empty? or line=~/#{key}/ or line=~/^End/ ent=line.split(" ") hents[ent[1]]=ent[3] } File.delete(tfile)if File.exist?(tfile) File.delete(cfile)if File.exist?(cfile) return hents end end ### Example;- ### ents=TIG.getregentries "HKEY_CURRENT_USER\\Software\\Google\\SketchUp8\\File Locations" ### Find the ents entry 'by name' thus; ### ents["Components"] >>> 'C;\Program Files\Google\Google SketchUp 8\Components\' ### Returns 'nil' if there is no key. ### Read the notes at the end on how to get a key/value. Copy/paste code into a file called say TIG-getregentries.rb in the Plugins folder, to use type the example in the Ruby Console OR inside a script...
    • J

      Show Summary & Collada Export

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      114 Views
      No one has replied
    • J

      Undo stack question

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      287 Views
      Dan RathbunD
      You are correct ... ... a Layer is a subclass of Entity, so perhaps the EntityObserver might fire the onChangeEntity() callback. You'd have to try it. I do not know if it will work.
    • J

      Ruby slowdown

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      424 Views
      thomthomT
      @tig said: Printing to the console will slow things greatly... That's a good pointer - if you use the Ruby Console to debug then the more you output the more it slows down. I use a small snippet that uses the Win32 API to clear the content of the console in order to keep it responsive. I also use Win32 to output data to DebugView.
    • J

      Disable_ui

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      239 Views
      thomthomT
      In SU6 you will not find any way to disable the UI from updating that gives any performance boost that is worth the optimisation effort. If you want to cut down the time, look at the Ruby code itself - find ways to make it faster. (See if there are places where a Hash can be used instead of an Array if you are doing lots of lookups, when manipulation selection and entities - use bulk methods that modifies many instead of single elements.)
    • J

      Transparency in Sketchup 6

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      13
      0 Votes
      13 Posts
      958 Views
      Dan RathbunD
      @john_q said: I'm new to sketchUp, using V8 and also new to the OOP-structure business... See: Ruby Newbie's Guide to Getting Started
    • J

      Error installing SketchUp 6

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Bug Reporting sketchup
      4
      0 Votes
      4 Posts
      455 Views
      Dave RD
      No. they don't sell licenses for older versions but it will just revert to the free version of SU6 when your 8 hours of eval time are consumed. No big deal since you've got V8.
    • J

      Temporarility Changing Materials

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      315 Views
      Dan RathbunD
      @joshb said: Thanks again Dan! Storing the material name works great. Your welky! However writing attributes into the model DOM.. is going to slow things down (and add extra items onto the undo stack.) Since this is temporary... why not just keep the references in memory? A Hash object will do fine: # a new Hash to hold the material refs for each entity prev_matls = {} # keep the entity refs held in an Array, like; ents = model.entities.to_a # use Ruby's built-in Array iterator to save material refs ents.each {|e| prev_matls[e]= e.material } # now the hash has unique keys because each entity ref is unique # # your view wizard.. whatever # # restore them; ents.each {|e| (e.material= prev_matls[e]) if prev_matls[e].valid? }
    • J

      Help with WebDialogs

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      188 Views
      Dan RathbunD
      @joshb said: I'm obviously new to ruby and appreciate all the pointers. Pay attention to the "Sticky" threads at the top of the forum. (They have the "S" in them.) This will get you going: Ruby Newbie's Guide to Getting Started
    • 1 / 1