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

    Malkomitch

    @Malkomitch

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

    Malkomitch Unfollow Follow
    registered-users

    Latest posts made by Malkomitch

    • RE: WxWindows for SketchUp Dialogs

      @unknownuser said:

      I would appreciate any help with solving this strange bugsplat which appears instead of a simple ruby error message in the console.
      It happens after triggering an 'evt_button'.

      It looks like WxSU doesn't handle errors communication between WxRuby and Sketchup.

      The best way to get rid of bugsplats is to handle exceptions by yourself, at the end of each method that uses WxSU:
      That way, you display the call stack, letting you know where the bug is.

      
      rescue => detail
         puts detail.message
         puts detail.backtrace.join("\n")
      
      
      posted in Developers' Forum
      M
      Malkomitch
    • RE: WxWindows for SketchUp Dialogs

      @unknownuser said:

      Have you used the WxFormBuilder? It would be nice to have a straight output compatible with WxSU! There is a beta which works with Python.

      Tomasz

      or you can export your design to a xrc file (xml style) and load it with xml methods from the Wx module.

      xml = Wx::XmlResource.get
      xml.load(your_file.xrc)

      (google for "xrcise", this utility write for you the code needed to load your xrc)

      posted in Developers' Forum
      M
      Malkomitch
    • RE: State of Observers — 28 February 2010

      Do you call the same observer several times?

      for example, if an AppObserver.onNewModel of your own call a new EntityObserver each time you perform a File>New, you'll stack the EntityObservers without removing the old one. Every methods trigger n times and it may cause unwanted issues.

      try to track your observers by storing them in a global variable, for example. And if you find some duplicates, use Sketchup.active_model.entities.remove_observer before calling a new one

      In my scripts, if i use observers, i'm used to call a little function "refreshObservers" of my own, triggered by AppObserver.onNewModel or AppObserver.onOpenModel, that flushes all the old observers and create new ones.

      I'm using an EntitiesObserver every day. This observer is designed to build and update a catalogue of everything drawn in or removed from sketchup. With onElementAdded and onElementRemoved, I never experienced any crash, excepted when I try to remove an entity inside the EntitiesObserver methods. It breaks the elementary rule: don't touch the collection you're watching in

      posted in Developers' Forum
      M
      Malkomitch
    • RE: State of Observers — 28 February 2010

      EntitiesObserver works well if you don't erase any entity inside the observer.
      Otherwise, it makes Sketchup crash in an ugly way.

      I'm not sure about EntityObserver but i think that's pretty much the same behavior.

      Thank you for the report

      posted in Developers' Forum
      M
      Malkomitch
    • RE: I have a question, about Model.import of sketchup API
      
      f = UI.openpanel("select a file", nil, ".skp")
      Sketchup.active_model.import f
      
      

      pretty simple to understand in the doc
      http://code.google.com/intl/fr/apis/sketchup/docs/ourdoc/model.html#import

      posted in Developers' Forum
      M
      Malkomitch
    • RE: Font of text

      the method .methods applied to a Text object returns the applicable methods
      in these methods, there is a set_last_size, which is not documented, and it requires 3 arguments.
      Does anyone know what it is?

      posted in Developers' Forum
      M
      Malkomitch
    • RE: Function: toggle toolbar

      It works!

      Thank you again!

      posted in Developers' Forum
      M
      Malkomitch
    • RE: Function: toggle toolbar

      Thank you Chris.
      I'll check that when i'll get back to work next monday.

      it's such a fast answer to my very first post here.
      This forum looks nice for sharing knowledge and ideas !

      posted in Developers' Forum
      M
      Malkomitch
    • Function: toggle toolbar

      Hello there

      For the project i'm coding on these days, i need to create a command, on a toolbar, which toggle another toolbar.
      The method get_last_state from the class Toolbar looks convenient for that but i noticed a strange behaviour.

      Here is my code for defining my toolbar and the function that toggle the other toolbars.

      
      #here is the function for toggling my toolbar
      def toggle(toolbar)
         toolbar.show if toolbar.get_last_state == -1
         toolbar.show if toolbar.get_last_state == 0
         toolbar.hide if toolbar.get_last_state == 1
      end
              
      #and then, the block defining my toolbars
      
      main_tb= UI;;Toolbar.new("main toolbar")
      	
      cmd= UI;;Command.new("Toggle the second toolbar"){toggle(second_tb)}
      cmd.large_icon = cmd.small_icon = File.join(path_to, "maintb.png")
      cmd.tooltip = cmd.status_bar_text= "Toggle the second toolbar"
      main_tb.add_item cmd
      main_tb.show
      
      main_tb= UI;;Toolbar.new("my toolbar")
      	
      
      second_tb= UI;;Toolbar.new("second toolbar")
      cmd= UI;;Command.new("hello"){UI.Messagebox("hello")}
      cmd.large_icon = cmd.small_icon = File.join(path_to, "secondtb.png")
      cmd.tooltip = cmd.status_bar_text= "hello"
      second_tb.add_item cmd
              
      
      
      

      But this code works for showing, not for hiding...
      hu??

      so i checked manually the method get_last_state directly in Sketchup, using the ruby console
      I noticed that the value returned by get_last_state never change, whatever i do with show and hide

      
      tb= UI;;Toolbar.new("my toolbar")
      #<UI;;Toolbar;0x4b22d08>
      cmd= UI;;Command.new("my cmd"){UI.Messagebox("hello")}
      #<UI;;Command;0x4b22ae0>
      tb.add_item cmd
      #<UI;;Toolbar;0x4b22d08>
      tb.get_last_state
      -1
      tb.show
      nil
      tb.get_last_state
      -1
      tb.hide
      nil
      tb.get_last_state
      -1
      

      is there a problem with this method?
      did i miss something?

      thank you for your time

      posted in Developers' Forum
      M
      Malkomitch