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

    Topics

    • A

      Problems with SketchUp 8 plugins in Sketchup 2015

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      12
      0 Votes
      12 Posts
      643 Views
      Dan RathbunD
      @tig said: So your code ABSBMP::MoMo::class_variables returns an Array of Symbols >>> [:@@a, :@@b,...] So you need the step varstr = varstr.to_s to make it into a String. :@@a >>> "@@a" Then you use attstr = varstr.gsub(/^[@][@]/, "") to strip off the initial '@@'... Many of the global query methods changed from Ruby 1.8 to Ruby 2.0. They now return arrays of symbols (for each variable or method name.) In Ruby 1.8 they returned array of string (for each variable or method name.) There are also many other "breaking changes" in Ruby 2.0 that need to be dealt with. (@TIG, Was there a post here on breaking changes?) Also garbage collection is much better under Ruby 2.0, so any menu reference will most likely only be valid during the evaluation of the file in which the reference is first made by an API call. So the attempt to hold the reference @@menu[:top] across multiple files may no longer work. We have been complaining about the non persistence of UI element references, for years! (Especially menu references.) So the workaround is to save the menu NAME (as a string,) instead of the actual reference to the menu object. @@menu[:top]= "Plugins" ... then whenever you need the object reference, use: topmenu = UI.menu( @@menu[:top] ) or submenu = UI.menu( @@menu[:top] ).add_submenu( "MoMo" )
    • A

      Save pages as jpg-files

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      724 Views
      TIGT
      Manually File Export 2D image select jpg etc and add a name OR get this http://www.smustard.com/script/SceneExporter [free] or this http://www.smustard.com/script/SceneExporterPro [$10] which exports all of the Scene tab views as jpg image files named after the tab...
    • A

      Inputbox prompts by variable

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      245 Views
      J
      In the first example, prompts is an Array of Strings, which is the correct form. In the second, p just a String; so when you write prompts = [p], y0u get an Array containing a single String. p = [] p << "What is your Name?" << "What is your Age?" << "Gender" prompts = p Do not use p as a variable. Although it does work, p is a shortcut for the .inspect method. p prompts is the same as puts prompts.inspect
    • A

      Identify groups by its attributevalue and delete them

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      13
      0 Votes
      13 Posts
      507 Views
      thomthomT
      yea sure... it was a test.
    • A

      How to draw a cylinder by ruby?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      11
      0 Votes
      11 Posts
      3k Views
      D
      hi have a look at linetool.rb and class CylTool < LineTool in the Example scripts folder in ../SketchUp/Plugins/examples/linetool.rb, or download it if it's not...... john
    • A

      Add to existing groups to a new group

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      233 Views
      TIGT
      See this parallel thread http://forums.sketchucation.com/viewtopic.php?p=277009#p277009
    • A

      Layer color by ruby-code?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      16
      0 Votes
      16 Posts
      896 Views
      A
      @thomthom said: I see an issue with this method: It has multiple .start_operation and commit_operation inside the code flow - which will interfere with any start_operation you started yourself - since SU doesn't handle nested start_operations: ` model.start_operation ... layer.color = 'red' # this breaks the undo stack ... model.commit_operation` Though, it is not related to the error you got. Sorry, I don´t understand that. I tried now that: def layer_color model = Sketchup.active_model layer = model.layers.add "Test_Layer" layer.color = [255,255,255] end if( not file_loaded?("test.rb") ) plugins_menu = UI.menu("Plugins") plugins_menu.add_item("LayerColor") {layer_color} end #----------------------------------------------------------------------------- file_loaded("test.rb") That works without error - but the new layer has the color 102,68,0 and not 255,255,255!!!??? I test that: def layer_color model = Sketchup.active_model layer = model.layers.add "Test_Layer" layer.color = "Blue" end if( not file_loaded?("test.rb") ) plugins_menu = UI.menu("Plugins") plugins_menu.add_item("LayerColor") {layer_color} end #----------------------------------------------------------------------------- file_loaded("test.rb") The same result like before - Color 102,68,0 instead of blue Than I test that: def layer_color model = Sketchup.active_model my_mat = materials.add "Ahorn" my_mat.texture = "O;\\Sketchup\\Mat\\Ahorn.jpg" layer = model.layers.add "Test_Layer" layer.color = my_mat end if( not file_loaded?("test.rb") ) plugins_menu = UI.menu("Plugins") plugins_menu.add_item("LayerColor") {layer_color} end #----------------------------------------------------------------------------- file_loaded("test.rb") There was no error but also no layer!!
    • A

      Soften-Edges using by ruby

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      23
      0 Votes
      23 Posts
      4k Views
      TIGT
      The unexpected reversion of smoothed edges to solid is a known bug. Never save when in a edit session. Even an auto-save can trigger this, so never stay inside an edit session for longer than you need to...
    • A

      Add a group to another group by rupy-code

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      241 Views
      thomthomT
      @andreas said: Hi, I would like to insert "Group1" into "Group2" by ruby-code. What should I do to make this work? Are you talking about existing groups? If so, refer to TIGs post. If you are creating new groups via Ruby: group1 = model.active_entities.add_group group2 = group1.entities.add_group
    • A

      Edit group by ruby-code instead of a right mouse click

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      16
      0 Votes
      16 Posts
      3k Views
      TIGT
      To set up a shortcut that is context-sensitive you must be in that selection-context. So to shortcut 'Edit Group' you first need to select a group to get that possibility in the context-menu and you must then open SketchUp's Preferences > Shortcuts and filter for 'Group'... - then set up the shortcut on that tool's command... then of course you'll need to mimic some key-presses etc in some third party code executed by Ruby - all as outlined earlier [PC only]... PS: This 'context' issue when making shortcuts applies to many selection-sensitive commands - like Reverse and Orient, which both need a face to be selected before they appear in the context-menu list...
    • A

      Select a Group in Ruby code instead of using the mouse

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      313 Views
      TIGT
      If you want to clear any previous selection first use... Sketchup.active_model.selection.clear then Sketchup.active_model.selection.add(mogroup)
    • 1 / 1