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

    Posts

    Recent Best Controversial
    • RE: [Plugin] ReGlue
      module Reglue
          extend self
      
          # Menü öğesinin eklenme konumunu belirleyen değişken
          SUPPORT_MENU_POSITION ||= Sketchup::Menu.instance_method(:add_item).arity != 1 ? 8 : nil
      
          def glue_components_to_faces
            model = Sketchup.active_model
            selection = model.selection
      
            if selection.empty?
              UI.messagebox("Hata: Hiçbir seçim yapılmadı!")
              return
            end
      
            faces = selection.grep(Sketchup::Face)
            components = selection.grep(Sketchup::ComponentInstance).select { |comp| comp.glued_to.nil? }
      
            if faces.empty? || components.empty?
              UI.messagebox("Hata: Lütfen hem yüzeyleri hem de yapıştırılabilir bileşenleri seçin!")
              return
            end
      
            model.start_operation("Bileşenleri Yüzeylere Yeniden Yapıştır", true)
      
            components.each do |component|
              closest_face = find_closest_aligned_face(component, faces)
              component.glued_to = closest_face if closest_face
            end
      
            model.commit_operation
          end
      
          def find_closest_aligned_face(component, faces)
            component_normal = component.transformation.zaxis
            faces.min_by { |face| face.normal.angle_between(component_normal) }
          end
      
          unless @loaded
            UI.add_context_menu_handler do |menu|
              selection = Sketchup.active_model.selection
              next if selection.empty?
      
              has_faces = selection.any? { |entity| entity.is_a?(Sketchup::Face) }
              has_glueable_components = selection.any? { |entity| entity.is_a?(Sketchup::ComponentInstance) && entity.glued_to.nil? }
      
              if has_faces && has_glueable_components
                position = SUPPORT_MENU_POSITION
                menu.add_item("Reglue", position) { glue_components_to_faces }
              end
            end
      
            @loaded = true
          end
      end
      
      
      posted in Plugins
      designerbursaD
      designerbursa
    • can you update it like this?

      Re: [Plugin] Recall last tool v1.2

      can you update it like this?

      code_text
      module Matt
        class MattObserver < Sketchup::ToolsObserver
          @@last_tool_id = nil
          @@toggle = true  # Variable to control toggling
      
          def onActiveToolChanged(tools, tool_name, tool_id)
            # Save the tool ID if it’s not one of the excluded IDs
            @@last_tool_id = tool_id unless [21022, 10508].include?(tool_id) || tool_id >= 50000
            puts "Active tool: #{tool_name} --> ID: #{tool_id}" unless [21022, 10508].include?(tool_id) || tool_id >= 50000
          end
      
          def self.recall_last
            # Get the ID of the currently active tool
            active_tool = Sketchup.active_model.tools.active_tool_id
      
            # If the active tool is the selection tool and there's no other active tool, switch to the last tool
            if [0, 21022].include?(active_tool)
              if @@last_tool_id
                Sketchup.send_action(@@last_tool_id)
              else
                puts "No previous tool. Selecting default tool."
                Sketchup.send_action("selectSelectionTool:")
              end
            else
              # If another tool is active, switch to the selection tool
              Sketchup.send_action("selectSelectionTool:")
            end
          end
        end
      
        # Add the observer to SketchUp's tools
        Sketchup.active_model.tools.add_observer(MattObserver.new)
      
        # Add "ReCall" menu item
        unless file_loaded?(__FILE__)
          menu = UI.menu("Plugins")  # Adds item under the "Plugins" menu
          menu.add_item("ReCall") {
            MattObserver.recall_last  # Calls the recall_last method when clicked
          }
          file_loaded(__FILE__)
        end
      end
      posted in Plugins
      designerbursaD
      designerbursa
    • Is it ok to add tolerance for snap points?

      Re: [Plugin] BezierSpline - v2.2a - 22 Apr 21
      I made a change like this if you don't mind

      def pick_point_to_move(x, y, view) 
          tolerance = 1000 # Tolerans değeri, piksel cinsinden
          @old_pt_to_move = @pt_to_move
          ph = view.pick_helper
          @selection = ph.pick_segment @pts, x, y
      
          if @selection
              if @selection < 0
                  # Segment üzerinde bir nokta bulduysak
                  pickray = view.pickray x, y
                  i = -@selection
                  segment = [@pts[i-1], @pts[i]]
                  result = Geom.closest_points(segment, pickray)
      
                  # Yakınlık kontrolü
                  if result[0].distance(@pts[i-1]) <= tolerance || result[0].distance(@pts[i]) <= tolerance
                      @pt_to_move = result[0]
                  else
                      @pt_to_move = nil
                  end
              else
                  # Kontrol noktasını bulduysak
                  @pt_to_move = @pts[@selection]
              end
          else
              @pt_to_move = nil
          end
          @old_pt_to_move != @pt_to_move
      end
      
      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] ReGlue

      @designerbursa ```

      module GlueComponentsToFaces
        extend self
      
        def glue_components_to_faces
          model = Sketchup.active_model
          selection = model.selection
      
          if selection.empty?
            return UI.messagebox("Error: No selection! Please select faces and components.")
          end
      
          faces = selection.grep(Sketchup::Face)
          components = selection.grep(Sketchup::ComponentInstance)
      
          if faces.empty? || components.empty?
            return UI.messagebox("Error: Select faces and components!")
          end
      
          model.start_operation("Glue Components to Faces", true)
      
          begin
            components.each do |component|
              closest_face = find_closest_aligned_face(component, faces)
              component.glued_to = closest_face if closest_face
            end
          rescue => e
            UI.messagebox("An error occurred: #{e.message}")
          ensure
            model.commit_operation
          end
        end
      
        def find_closest_aligned_face(component, faces)
          component_normal = component.transformation.zaxis
          closest_face = faces.min_by { |face| face.normal.angle_between(component_normal) }
          closest_face
        end
      end
      
      # Adding a menu item for ease of use in SketchUp
      if not file_loaded?(__FILE__)
        UI.menu("Plugins").add_item("Glue Components to Faces") {
          GlueComponentsToFaces.glue_components_to_faces
        }
        file_loaded(__FILE__)
      end
      
      
      ### I haven't tested it on the 2024 version but you can try this, maybe it will work. It works smoothly on my 2021 version
      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] ReGlue

      @rv1974 I am using Sketchup 2021 version
      Kayıt 2024-06-10 000123.gif

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] ReGlue

      @rv1974 If you can paste without extensions, I really congratulate you...

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] ReGlue

      @rv1974 I developed the code for pasting on all selected surfaces at once, it would be useful for everyone if it is updated in this way.

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] ReGlue

      @rv1974

      def self.glue_components_to_faces
        model = Sketchup.active_model
        selection = model.selection
      
        return UI.messagebox("Error: No selection!") if selection.empty?
      
        faces = selection.grep(Sketchup::Face)
        components = selection.grep(Sketchup::ComponentInstance)
      
        return UI.messagebox("Error: Select faces and components!") if faces.empty? || components.empty?
        
        model.start_operation("Glue Components to Faces", true)
      
        begin
          components.each do |component|
            closest_face = find_closest_aligned_face(component, faces)
            component.glued_to = closest_face if closest_face
          end
        ensure
          model.commit_operation
        end
      end
      
      def self.find_closest_aligned_face(component, faces)
      
        component_normal = component.transformation.zaxis
        closest_face = faces.min_by { |face| face.normal.angle_between(component_normal) }
        closest_face
      
      end
      
      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] Selection Toys

      When I install this plugin "ae_LaunchUp"; I get the console error

      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/tt_selection_toys/json.rb:39:in each' C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/tt_selection_toys/ui_manager.rb:280:in build_menus'
      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/tt_selection_toys/ui_manager.rb:262:in `block (2 levels) in build_ui'

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] Material Renamer

      Plugin name and menu text

      PLUGIN_NAME = 'Rename Materials by File Name'.freeze

      Plugin class

      class RenameMaterials
      def self.rename
      # Get the active model
      model = Sketchup.active_model

      # Get the file name and remove the extension
      file_name = File.basename(model.path, ".*")
      
      # Get all materials in the model
      materials = model.materials
      
      # Iterate through all materials and assign new names based on the file name
      materials.each_with_index do |material, index|
        new_name = "#{file_name}_#{format('%02d', index + 1)}"
        material.name = new_name
      end
      
      puts "Materials have been successfully renamed based on the file name."
      

      end
      end

      Menu item that activates the plugin

      UI.menu('Plugins').add_item(PLUGIN_NAME) { RenameMaterials.rename }

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] Soften/Unsoften

      jhs powerbar 3d rotate error fix

      def onLButtonDown(flags, x, y, view)

      nothing with this click if nothing is selected

      puts 'nil' if(Sketchup.active_model.selection.length == 0)

      Keep what's currently selected.

      Might be temporarily selected because its hovered if there was no selection when tool was selected

      @hasSelection = true

      Select point when and draw when clicking

      first 3 clicks select points and set jaw & pitch. 4th and 5th click are optional and sets roll

      if @state == 0
      # Select anchorpoint
      #@pAnchor.pick view, x, y
      if @pAnchor.valid?
      @state = 1
      @status_text = "Grab entity." # first status text defined in reset()
      Sketchup::set_status_text(@status_text, SB_PROMPT)
      end

      elsif @state == 1
      # Select startpoint 1
      #@pStart1.pick view, x, y, @pAnchor
      if @pStart1.valid?
      @state = 2
      @status_text = "Pick target to drag entity towards."
      Sketchup::set_status_text(@status_text, SB_PROMPT)
      end

      elsif @state == 2
      # Select targetpoint 1 and set yaw and pitch for selection
      #@pTarget1.pick view, x, y, @pAnchor
      if @pTarget1.valid?
      @state = 3
      @status_text = "(Optional) Grab entity again."
      Sketchup::set_status_text(@status_text, SB_PROMPT)

        self.rotateYawPitch(@pAnchor.position, @pStart1.position, @pTarget1.position)
      
        # Set rotated flag so script knows whether to update view or not when leaving tool
        @rotated = true
      end
      

      elsif @state == 3
      # Select startpoint 2
      #@pStart2.pick view, x, y, @pAnchor
      if @pStart2.valid?
      @state = 4
      @status_text = "Pick target to drag entity towards."
      Sketchup::set_status_text(@status_text, SB_PROMPT)
      end
      elsif @state == 4
      # Select targetpoint 2 and set roll for selection
      #@pTarget2.pick view, x, y, @pAnchor
      if @pTarget2.valid?
      self.rotateRoll(@pAnchor.position, @pStart2.position, @pTarget2.position, (@pTarget1.position - @pAnchor.position))

        self.reset(view)
      end
      

      end
      end#def

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] Shape Bender Beta

      Error: #<ArgumentError: Invalid arguments.>
      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/clf_shape_bender/clf_shape_bender_data.rb:302:in add_text' C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/clf_shape_bender/clf_shape_bender_data.rb:302:in curve_labeler'
      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/clf_shape_bender/clf_shape_bender_data.rb:191:in `onLButtonUp'

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugins] TIG-splitTOOLS

      Error: #<TypeError: wrong argument type (expected Sketchup::Entity or Array of Sketchup::Entity)>
      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/TIG-splitsausage.rb:85:in add' C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/TIG-splitsausage.rb:85:in splitsausage'
      C:/Users/User/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/TIG-splitTOOLS.rb:93:in `block in splitTOOLS'

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] FullScreen v5.1.3 (25 April 2024)

      c:/users/user/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/ams_windowsettings/imagesui.png

      Why am I getting this error in ruby console?

      I am using sketchup version 2021 and the error still persists...

      an image not in the plugin folder and the user path "%appdata%"

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] TT_Lib²

      Thanks for the update, it works fine. Will there be updates to Edge tools?

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: JHS Standard 2017

      PLEASE UPDATE 2021 VERSION

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] FullScreen v5.1.3 (25 April 2024)

      c:/users/user/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/ams_windowsettings/imagesui.png

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] TT_Lib²

      C:/Users/xxx/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/TT_Lib2/win32.rb:12: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead

      posted in Plugins
      designerbursaD
      designerbursa
    • RE: [Plugin] TT_Lib²

      It gives an error on startup!..
      Please update it.
      The sketchup version I'm using is 2021

      posted in Plugins
      designerbursaD
      designerbursa
    • 1
    • 2
    • 3
    • 1 / 3