sketchucation logo sketchucation
    • Login
    1. Home
    2. danielbowring
    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.6b introduces important bugfixes for Fredo's Extensions Update
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 67
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Ruby, Undo Stack and dynamic components

      Another question on the undo stack, is it possible to prevent operations from appearing in the undo stack at all? To basically have transparent actions that are never added to the stack?

      In certain cases I have to show/hide entities during an input stage, and that clutters the undo stack. It's possible to move them into one operation, but the stack looks something like

      
      Operation 1
      hide/show-operations
      Operation 2
      
      

      Which adds an unnecessary undo step (as I undo all the operations performed in the ruby code).

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • RE: Ruby, Undo Stack and dynamic components

      @dan rathbun said:

      @dan rathbun said:

      Have you explored the extra arguments to start_operation() ??

      instead of redraw_with_undo( entity, progress_bar_visible=true )
      you can also use this:

      redraw( entity, progress_bar_visible=true, is_recursive_call=false )

      Combination of these was indeed the solution - thanks again ๐Ÿ˜„

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • Ruby, Undo Stack and dynamic components

      Hey,

      I'm working with using dynamic components in ruby. I'm able to set attributes and have them applied as such

      ent.set_attribute(dict, key, value)
      # ...
      $dc_observers.get_latest_class.redraw_with_undo(ent)
      

      However, doing so fills the undo stack with "Properties" and "redraw" operations, which is interfering with my own operation (which I start before the DC's are created and commit after the last redraw), as such

      def some_func()
          #...
          Sketchup;;active_model.start_operation 'My Operation'
          create_ent()
          Sketchup;;active_model.commit_operation
      end
      #...
      def create_ent()
          ent = Sketchup;;active_model.entities.add_instance(definition, transformation)
          ent.set_attribute 'dynamic_attributes', 'some_key', 'some_value' # adds "Properties" to the undo stack
          #...
          $dc_observers.get_latest_class.redraw_with_undo(ent) # adds "Redraw" to the undo stack
      end
      

      How can I ensure that my operation is the only one that appears in the undo stack, so that a single undo operation will remove all the ent, etc?

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • RE: Ruby String Encoding

      Thanks, base64 encoding fixes the issue.
      I'm storing complex types, basically class instances (or at least the information I can use to regenerate them).

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • Ruby String Encoding

      Is it possible to force the string encoding to UTF-8?

      I'm trying to Marshal objects to strings and then store them in attribute dictionaries, but its possible for then dump to contain the null character which causes the string to be terminated when added to the dictionary. I'm hoping to just swap the null characters out for a different string on write, then swap back to null on read but I can't get the null character into memory.

      Including the character in a file will make the file unable to load, and I can't figure out string encoding so I can't use \x00. Ruby 1.9.3 provides String_instance.force_encoding('UTF-8'), but Sketchup 8 uses 1.8.6 which doesn't have that method.

      I guess what I'm asking is if anybody knows how to force encoding in ruby 1.8.6 or if there is another to store data within the skp file.

      Thanks in advance.

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • RE: [Win] net/http

      @dan rathbun said:

      ... your talking about one of the standard Ruby libraries.

      I answered a similar question here:
      http://forums.sketchucation.com/viewtopic.php?f=180&t=39648#p350463

      Many thanks, worked great.

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • [Win] net/http

      Hey,

      Does anybody know how to make net/http accessible within Sketchup 8?

      posted in Developers' Forum
      danielbowringD
      danielbowring
    • 1
    • 2
    • 3
    • 4
    • 4 / 4