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

    Topics

    • H

      How to Change the Extension's UI from the Ruby Script?

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Tutorials sketchup
      2
      0 Votes
      2 Posts
      5k Views
      TIGT
      Look through my RB scripts and see how this is done in detail... for a simple menu item SUBMENU=UI.menu("Plugins").add_submenu("Haujiet") #Or other menu by name e.g. 'Tools' SUBMENU.add_item("Add..."){Sketchup.active_model.select_tool(Haujiet_Tool.new())} SUBMENU.add_item("Settings..."){Haujiet_Module;;settings()} for a command CMD1=UI;;Command.new("Tool_name"){Haujiet_Module;;some_module_action()} CMD1.tooltip="How_to_use_tool..." CMD1.status_bar_text="How_to_use_tool..." CMD1.small_icon=File.join(FOLDER_path, 'icon.png') CMD1.large_icon=File.join(FOLDER_path, 'icon.png') and for Toolbar TOOLBAR=UI;;Toolbar.new("Haujiet...") TOOLBAR.add_item(CMD1) TOOLBAR.restore if TOOLBAR.get_last_state.abs == 1 #TB_VISIBLE/NEVER for a context menu UI.add_context_menu_handler{|menu| sub = menu.add_submenu("Haujiet...") sub.add_item(CMD1) # perhaps with tests to see if it should show - e.g. the selection is a group? } See here... http://ruby.sketchup.com/UI/Command.html http://ruby.sketchup.com/UI/Toolbar.html
    • H

      Save as legacy version

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      2
      0 Votes
      2 Posts
      575 Views
      J
      It is possible to have a plugin not only remind you, but to actually save the model as v2014 whenever the model is saved by normal methods (using File > save, or ctrl-s.) I'll post something hopefully today. One problem though is a doubling of the save time since the model will be saved once as the default version, then again as the v2014 version. So maybe this is not the best way.
    • H

      Importing without Layers

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      8
      0 Votes
      8 Posts
      463 Views
      D
      sorry I wasn't clear... what I was suggesting is you save the base geometry as a new separate component... in the topo model it will still have layers, but not in the component... you would need two components if water and land are separate entities... if you upload a simple example we would understand your goal better... john
    • H

      Revit-like Adaptive Component

      Watching Ignoring Scheduled Pinned Locked Moved Dynamic Components sketchup
      12
      0 Votes
      12 Posts
      5k Views
      P
      Hi It is possible to create components with ruby code, but i believe its much easier to use the ruby code to load a defined component and position it, I will continue with the pipe line DC, I created earlier and develop that. If you look at the cylinder code in the linetool example, %(#000080)[vec = pt2 - pt1 length = vec.length if( length == 0.0 ) UI.beep puts "Cannot create a zero length cylinder" return end] I used that as the starting point, initially changing the cylinder for a simple line. I now need to load a component and scale, then rotate it to the line created. %(#0000BF)[path = Sketchup.find_support_file('rod.skp', 'Plugins/su_examples/') definitions = Sketchup.active_model.definitions definition = definitions.load(path)] to get a scaling factor I saved the pipe line DC with a length of 1 meter and used that to scale to the length of the line. I loaded that DC to the su_examples folder http://ruby-doc.org/core-2.2.0/Math.html gives the syntax for the maths being a roof carpenter, I used my knowledge of the relationship between a rafter and a hip (bevel cuts, lengths) to create a transformation sequence for the rotation searches in this forum helped to work out the method then I deactivated the line as it was no longer required as a reference added dc_observers.get_latest_class.redraw_with_undo(componentinstance) to redraw the scaled component (tig) I have attached the amended rod.skp and linetool.rb, which can overwrite the existing in the C:\Users"computer name"\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\su_examples [image: tvpC_Capture1.PNG] the base component linetool.rb
    • 1 / 1