sketchucation logo sketchucation
    • Login
    1. Home
    2. brewsky
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 163
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: SketchUp and Rubies on Linux (yes, it works)

      @lunkwill said:

      I found a workaround to the refresh bug

      All available workarounds for the refresh problem under wine seem to fail for me.

      After a lot of frustration I have made this little ruby-script that seems to work for me πŸ˜„

      #       wine-refresh.rb
      #       
      #       Copyright (C) 2012 Jan Brouwer <jan@brewsky.nl>
      #       
      #       This program is free software; you can redistribute it and/or modify
      #       it under the terms of the GNU General Public License as published by
      #       the Free Software Foundation, either version 3 of the License, or
      #       (at your option) any later version.
      #       
      #       This program is distributed in the hope that it will be useful,
      #       but WITHOUT ANY WARRANTY; without even the implied warranty of
      #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      #       GNU General Public License for more details.
      #       
      #       You should have received a copy of the GNU General Public License
      #       along with this program.  If not, see <http://www.gnu.org/licenses/>.
      
      module Brewsky
        module WineRefresh
        
          # This observer refreshes the view every time the selection is changed
          class WrSelectionObserver < Sketchup;;SelectionObserver
            def initialize
              @view = Sketchup.active_model.active_view
            end
            def onSelectionBulkChange(selection)
              @view.refresh
            end
            def onSelectionCleared(selection)
              @view.refresh
            end
          end
      
          # Attach the observer.
          Sketchup.active_model.selection.add_observer(WrSelectionObserver.new)
        end
      end
      
      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      @thomthom said:

      I talked to Scott about what he did to solve the matter. He said he used various observers to find safe points to react to.

      Thanks! Won't be easy to get it entirely stable I guess...

      The "disable observers" button is probably a good starting point.
      But I think it will need a lot of re-structuring before I have figured that out in it's entirety.

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      @thomthom said:

      (Hard to give specific examples when I don't know how your plugin works.)

      I am using 2 kinds of objects:

      • source objects (faces)
      • geometry objects, like walls (groups)
        When a source face is moved the wall needs to be re-drawn to match shape and position.
        Check out this video(around 1:30): http://www.youtube.com/watch?v=J59EgH7LICs

      The plugin will probably work best when the update is fired immediately...

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      @thomthom said:

      simply keeping a cache of the info I get from the observers (unprocessed) - then at safe points I process and react on them.

      You mean like, create an array of "objects that need to be updated", and process the array seperately(like once a second with a timer)?

      Thanks for the list, I will try to pick the least buggy ones πŸ˜„

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      @tig said:

      So using an alternative IS recommended/possible...

      Hmmm, I already changed "SelectionObserver.onSelectionAdded" to "SelectionObserver.onSelectionBulkChange" because of a warning like that.

      I will try to get rid of that one too!

      But this is probably the most important to be able to disable all observers.

      And yeah, maybe it's enough to just have a disable-observer button instead of trying to unload the entire plugin. If someone really wants it completely disabled then the unload-extension feature(with restart) can always be used(and is probably the only thing that makes sure it's completely unloaded).

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      @thomthom said:

      Can't you keep a flag that reflects the enabled state of your plugin? One that will disable toolbar buttons and menus that cannot be used until enabled?

      Yes, I'm doing that using "Sketchup.write_default", seems to work fine.

      @thomthom said:

      Because while I think there are Ruby methods to undefine methods and modules/classes, there is no way to remove toolbars and menus from the UI.

      I would like to know how to undefine methods and modules/classes, that would help me out. I don't need to close the toolbar(however it would be great if you could reduce it to a single on/off button).
      Everything I can find on that subject says that you don't need to make destructors because the garbage collector takes care of any "unreachable" objects.

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Unload / reload plugin without closing SketchUp

      Ah! one thing I figured out:

      Re-attaching the observers won't be as difficult as I thought because the observer objects are only disconnected, not destroyed.
      So, if I keep track of where they were attached, I can easily re-attach them with "add_observer" πŸ˜„

      (but this only partially solves my problem)

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Ruby &quot;good practice&quot; using constants?

      @dan rathbun said:

      So for example, your nested module Brewsky::BimTools::Manager is actually an instance object, and the preceeding identifier is the reference to the instance.

      If you remember this... then it can be easier to understand how using an anonymous singleton proxy class instance inside your Module class instance, makes sense.

      Thank you very much for this very helpful post!
      I completely missed it untill now 😳

      My plugin is in need of "some" improvement... πŸ˜‰

      posted in Developers' Forum
      brewskyB
      brewsky
    • Unload / reload plugin without closing SketchUp

      My plugin uses EntitiesObservers to monitor changes to geometry.
      This is great while using the plugin, but a lot of unneeded overhead when NOT using the plugin.

      I know you can turn extensions on and off in the preferences window, but that requires you to restart SketchUp. And I don't want people having to restart every time when they do or do not want to use my plugin...

      Is there a "simple" way to unload the plugin by, for example, keep track of any objects you make and when you want to unload it, make sure the objects are no longer "reachable"(that's probably the tricky part) and just let the garbage collector clean them out?

      I have already made an array containing all my observer objects, so I only have to call "remove_observer" for every object in the array.
      That cleans out the most obtrusive things, but then I end up with a "half-loaded" plugin. And when I want to reload it i have to figure out where to put these observers again. It would be much cleaner if the entire thing could be unloaded.

      Tips anyone?

      Thanks!
      Jan

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      @ivreich said:

      I'm having some problems importing the IFC file into Revit 2013. I've attached the Revit error message and my skp file for you to look at.

      Hi Joel!

      Thanks for sharing this model!
      It points me to some "internationalization" bugs I wasn't yet aware of(mixing up commas and dots in numbers and the like).
      Is it possible to get a more detailed report from the revit ifc-importer?
      I can't make out the id's it reports in the screenshot.

      @ivreich said:

      Also, will it be possible to create bim elements with more complex surfaces, e.g. quad-based surfaces generated from curviloft, EEby, soap skin bubble etc?

      I still have a lot of ideas to improve the plugin. πŸ˜„
      The greatest challenge will be to translate things like complex surfaces to a usable/editable object in revit through IFC.

      Cheers!
      Jan

      posted in Plugins
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      @ludnid said:

      sketchup crashed while working within a group and specifically while trying to use the paint bucket tool.

      I will look into it, it should never interfere with your day-to-day SketchUp-ing!
      It probably has something to do with the observers the plugin uses.

      The first thing I want to do is make a on/off button that disables the observers(or even the entire plugin if possible). That should make sure there occur any problems when not using the plugin itself.

      Does anyone have tips on implementing this? I think it would be nice if I could minimize the toolbar to a single button to show that the plugin is not active...

      posted in Plugins
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      I have finally taken the time to set up a website for the project. πŸ˜„
      Check it out on:
      http://www.bim4sketchup.org/

      It's very basic, but it already contains some documentation.
      I will add more along he way...

      Cheers!
      Jan

      posted in Plugins
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      For this version I made a lot of improvements to the IFC-exporter, but I still get mixed results opening the files in different BIM-software packages.

      If anyone has any tips/opinions on what would be the best way to generate the IFC-files, I'm interested!
      The most important thing to think on is to get a good model-structure/scheme in the IFC.
      Not export too much (duplicate or unneccesary) data, but enough so all BIM-software can find the data they need to import useful objects...

      posted in Plugins
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      @watbywbarif said:

      I guess this was false alarm.

      Good to hear it works now!

      It might be interesting to try the new version I just added, it's WAY more stable πŸ˜„ .

      posted in Plugins
      brewskyB
      brewsky
    • RE: Ruby &quot;good practice&quot; using constants?

      I guess the way I'm passing the object into every sub-object is "structurally" the best way to go.
      But in this way I'm constantly making new pointers to always the same old base-object.
      And because there is only one instance, would it not be clearer to use some sort of "almost-global" object, such as a module-constant, and have access to it anywhere in the program?

      Like TT does?
      And after thinking on this, maybe TT's way of just making a module as a base-object for the plugin is a better approach than my BimTools-class. Because is't only used once, the module-approach seems more fitting...

      Something like:

      module Brewsky
      
        class BimTools
          attr_accessor ;project_list, ;web_dialog
          def initialize
            btProject = BtProject.new
          end
        end
        
        class BtProject
          attr_reader ;model, ;guid, ;name, ;description
          def update_dialog(value)
            dialog = PLUGIN.web_dialog
            
            # do something with "dialog" using "value"
            
          end
        end
        
        PLUGIN = BimTools.new
      
      end
      
      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Ruby &quot;good practice&quot; using constants?

      Thanks guys!

      I have to do some reading to be able to follow the discussion πŸ˜‰
      I kinda lost it somewhere along the way...

      TT's first post came close to what I want to do.
      This is more what I mean:

      module TT;;Plugins
      
        PLUGIN = QuadFaceTools.new
      
      end
      

      @dan rathbun said:

      Can you give us a code shell showing the namespace nesting, and how you wish to share the reference to your classes ??

      This is an example of what I'm doing now.
      I make some sort of "root-plugin" object(class-instance, not a module) that holds all other plugin objects/data.
      And pass this on to all nested objects to be able to access the embedded data.

      module Brewsky;;BimTools
      
        class BimTools
          attr_accessor ;project_list, ;web_dialog
          def initialize
            btProject = BtProject.new(self)
          end
        end
        
        class BtProject
          attr_reader ;model, ;guid, ;name, ;description
          def initialize(bt)
            @bt = bt
          end
          def update_dialog(value)
            dialog = @bt.web_dialog
            
            # do something with "dialog" using "value"
            
          end
        end
        
        BimTools.new
      
      end
      
      posted in Developers' Forum
      brewskyB
      brewsky
    • Ruby &quot;good practice&quot; using constants?

      I am wondering of it could be a good idea / good practice to use a constant as a placeholder for my plugin's main library object.
      The object pointer itself will never change(and thus could be called "constant"), only it's contents are dynamic.

      I considered this because a constant can be accessed from anywhere in the module, without having to resort to globals, or having to forward the object in every new class instance(as I do now).

      Cheers!
      Jan

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: [Plugin] bim-tools 0.13.4(june 22, 2015)

      @watbywbarif said:

      Hi, I have tried 0.11 on Sketchup 8 on Windows7 and Walls from faces is not working. Nothing happens when used.

      Hi Andrija,

      Thanks for trying the plugin!
      Can you show me the output of the "Ruby Console"?

      • Open the ruby console (Window --> Ruby Console)
      • Select some faces
      • Press the "Create From Faces" button
        https://lh4.googleusercontent.com/-hl6v6ZQJMTs/UE-Kr0KlqOI/AAAAAAAABwE/F_Fe7_TPcaQ/s24/PlanarsFromFaces_large.png

      I hope something shows up in the "Ruby Console", with that i might be able to help you!

      Cheers!
      Jan

      posted in Plugins
      brewskyB
      brewsky
    • RE: Nested Attribute Dictionaries

      @dan rathbun said:

      it's easier in Ruby to do:
      s = 'a' * 100000

      πŸ˜„ Ruby continues to amaze me, it 'reads' so logical!
      Still much to learn...

      posted in Developers' Forum
      brewskyB
      brewsky
    • RE: Nested Attribute Dictionaries

      @brewsky said:

      I can't seem to find a maximum length for an attribute string...

      @jim said:

      These are things you would need to experiment with.

      It's possible to store at least a string containing 100000 characters(looping much more than that freezes my pc).
      ` i = 0;
      s = ""

      while i < 100000 do
      s = s + "a"
      i +=1;
      end

      model = Sketchup.active_model
      model.set_attribute "testdictionary", "test", s
      v = model.get_attribute "testdictionary", "test"

      puts s.length
      puts v.length`

      returns:
      100000
      100000

      The file size increases substantially, storing a single string of 100000 long takes it from 8 to 200 kB.
      But maybe a text-file would increase similarly, it's a pretty long string...

      posted in Developers' Forum
      brewskyB
      brewsky
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 4 / 9