sketchucation logo sketchucation
    • Login
    1. Home
    2. Chris88
    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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 29
    • Groups 1

    Chris88

    @Chris88

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

    Chris88 Unfollow Follow
    registered-users

    Latest posts made by Chris88

    • RE: Mysterious Bug [followme related]

      THANKS to all for your efforts!
      Now it works!!! it's slower than before, but it runs and that's the main thing!
      @Dan: Thank you, you're the best! ^^

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      Dan, i have to correct myself: It works, when i load the script from the Ruby Console = step forward! πŸ˜„ [Edit:] i just noticed, this is what thomthom meant. 😒 [/Edit]
      But it doesn't work yet, when i want to load the script from the plugin-folder by starting SU normally and the script is located in the plugin-folder.

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      @Dan: Thank you. Now my code looks like:

      
      require 'sketchup.rb'
      
      module Chris88
      
        module LineA
      
          TIMER = nil
      
          def self.create_line()
            # delete lines 1-4 with loop
            #
             model = Sketchup.active_model
             entities = model.active_entities
      #--------------------------------------------------------------------------
             # Add the group to the entities in the model
             group = entities.add_group
             # Get the entities within the group
             # alle Objekte die den entities2 zugeordnet werden, werden automatisch zu einer gemeinsamen Gruppe gemacht
             entities2 = group.entities
            
            begin
              model.start_operation( 'LineA' )
              
              @width_small = 55 # 55  
              @depth_small = 45 # 45  
              @height_small = 30 # 30 
              @width_big = 70 # 70 
              @depth_big = 60 # 60
              @height_big = 70 # 40
          
              @height_line = (4/3) * @height_small
              @radius = 1
              @arcradius = 3        
      #--------------------------------------------------------------------------   
              @mat_linie=model.materials.add("Material_Linie")
              @mat_linie.color=Sketchup;;Color.new(124,252,0)  # => LawnGreen
      #--------------------------------------------------------------------------
              @anzahl_arcs = ((@depth_small-6)/6).to_i
          
              @pts =[]
              @helpvar_depth = 3
              @helpvar_pts = 1
              @helpvar_baseline = 1
              @helpvar_basearc = 1     
      #--------------------------------------------------------------------------
             1.upto(@anzahl_arcs) do |x|
              @helpvar2_pts = @helpvar_pts +1
      #--------------------------------------------------------------------------
             if (x%2 > 0)
              @pts[@helpvar_pts] = [((@width_big-@width_small)/2)+5.35, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              @pts[@helpvar_pts+1] = [@width_small+((@width_big-@width_small)/2)-5.3, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              # arc_point
              @pts[@helpvar_pts+2] = [@width_small+((@width_big-@width_small)/2)-5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+3), @height_line]
                
              arc_circle_odd = entities2.add_circle @pts[@helpvar_pts+1], X_AXIS, @radius, 42 
              arc_circle_face_odd = entities2.add_face arc_circle_odd
              arc_circle_face_odd.material = @mat_linie
              arc_circle_face_odd.back_material = @mat_linie
      
              line_circle_odd = entities2.add_circle @pts[@helpvar_pts], X_AXIS, @radius, 42 
              line_circle_face_odd = entities2.add_face line_circle_odd
              line_circle_face_odd.material = @mat_linie
              line_circle_face_odd.back_material = @mat_linie
      
              @helpvar_baseline_odd = entities2.add_line @pts[@helpvar_pts], @pts[@helpvar_pts+1]
      
              @helpvar_basearc_odd = entities2.add_arc @pts[@helpvar_pts+2],[0,-1,0],[0,0,1],@arcradius,-5.degrees,185.degrees 
              
              arc_circle_face_odd.followme @helpvar_basearc_odd
              line_circle_face_odd.followme @helpvar_baseline_odd
              
      #--------------------------------------------------------------------------
            elsif (x%2 == 0) 
              @pts[@helpvar2_pts-1] = [((@width_big-@width_small)/2)+5.3, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              @pts[@helpvar2_pts] = [@width_small+((@width_big-@width_small)/2)-5.35, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              # arc_point
              @pts[@helpvar2_pts+1] = [((@width_big-@width_small)/2)+5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+3), @height_line]
                    
              arc_circle_even = entities2.add_circle @pts[@helpvar2_pts-1], X_AXIS, @radius, 42 
              arc_circle_face_even = entities2.add_face arc_circle_even
              arc_circle_face_even.material = @mat_linie
              arc_circle_face_even.back_material = @mat_linie
              
              line_circle_even = entities2.add_circle @pts[@helpvar2_pts], X_AXIS, @radius, 42 
              line_circle_face_even = entities2.add_face line_circle_even
              line_circle_face_even.material = @mat_linie
              line_circle_face_even.back_material = @mat_linie
                      
              @helpvar_baseline_even = entities2.add_line @pts[@helpvar2_pts], @pts[@helpvar2_pts-1]
      
              @helpvar_basearc_even = entities2.add_arc @pts[@helpvar2_pts+1],[0,1,0],[0,0,1],@arcradius,-5.degrees,185.degrees
              
              arc_circle_face_even.followme @helpvar_basearc_even
              line_circle_face_even.followme @helpvar_baseline_even
              
            end # if
      #--------------------------------------------------------------------------
            if (x == @anzahl_arcs)
              @pts[@helpvar_pts] = [((@width_big-@width_small)/2)+5.35, ((@depth_big-@depth_small)/2)+(@helpvar_depth+6), @height_line]
              @pts[@helpvar_pts+1] = [@width_small+((@width_big-@width_small)/2)-5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+6), @height_line]
              
              @helpvar_baseline_ende = entities2.add_line @pts[@helpvar_pts], @pts[@helpvar_pts+1]
              
              line_circle_odd = entities2.add_circle @pts[@helpvar_pts], X_AXIS, @radius, 42 
              line_circle_face_odd = entities2.add_face line_circle_odd
              line_circle_face_odd.material = @mat_linie
              line_circle_face_odd.back_material = @mat_linie
      
              line_circle_face_odd.followme @helpvar_baseline_ende
              
            end # if
      #--------------------------------------------------------------------------
            @helpvar_depth = @helpvar_depth + 6
            @helpvar_pts = @helpvar_pts + 3
      #--------------------------------------------------------------------------
          end # upto - do    
          
      #--------------------------------------------------------------------------        
            rescue => e
              model.abort_operation
              puts("#{Module.nesting[0].name} Error #<#{e.class.name}; #{e.message}>")
              puts(e.backtrace)
            else
              model.commit_operation
            end
          end # def
      
        end # module LineA
      
      
        # run when file loads
        #
        if Sketchup.active_model &&
        Sketchup.active_model.active_entities
          LineA.create_line
        else
          LineA;;TIMER = UI.start_timer(2.0, true){
            if Sketchup.active_model &&
            Sketchup.active_model.active_entities
              UI.stop_timer(LineA;;TIMER)
              LineA.create_line
            end #if
          }
        end
      
      end # module Chris88
      
      

      Is this what do you mean?
      However it doesn't solve the bug.

      @thomthom: Thanks, that could help me. I know this, what you wrote in your sidenode, but it didn't work: When i draw a circle and a path, which starts at the central point of the cricle, Sketchup draw only the lines, but not the curves. This is why i decided alternatively to draw the lines and the curves seperately. Do you think the gaps could be the reason for the bug?

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      @thomthom: Correct. And yes, it crashes if it's located in the plugin-folder, too.
      And it doesn't matter, if i load the script with the Ruby Console or if i start SU normally and the script is in the plugin-folder.

      @Dan: Thanks Dan! I will test it in a few minutes...

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      The course of action of my program, which conduces to woodworking:
      in C#:

      • read technical values out of xml-files
      • generate a rubyscript for every object
        (tool, wood, machining line,...) in .txt- format
      • replace the wildcards (i.e: width,height,depth of a wooden box)
      • put all rubyscripts together an name the file xy.rb
      • start Sketchup with the file xy.rb as argument

      ... and my code is all but finished, when i start SU with the file xy.rb it crashes and SU reports a "bug splat"
      http://images.wikia.com/sketchyphysics/images/6/63/BugSplat.png

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      So because i'm almost at the end of coding my program, i actually don't want to modify the rubyscript, that it loads premade components.

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      @thomthom: i can start successfully the script in SU per Ruby Code Editor or per Sketchup Bridge in RDE to test it. The error appears when i copy my script in the plugin-folder, load it from ruby console in SU or start SU per cmd and assign my script as parameter in the cmd.

      @TIG: thanks for your corrected code and suggestion, but it doesn't solve the bug. And i don't 'understand' your first lines: "make a new template containing the desired stuff as the default" ... and it shouldn't be premade components (that's was my first attempt 😞 )

      posted in Developers' Forum
      C
      Chris88
    • RE: Mysterious Bug [followme related]

      the strange loop ist an advice of TIG... http://forums.sketchucation.com/viewtopic.php?f=180&t=41767,
      it makes sure that all services of SU are loaded succesfully.
      it runs also without this loop.

      And i have commenting out all loops and many lines, but i didn't found the failure.
      It's strange that i can run the script succesfully in SU, this bug is only when loading the script out of the plugins or starting SU per cmd with the script as parameter.

      (P.S. i have SU 8 free version)

      posted in Developers' Forum
      C
      Chris88
    • Mysterious Bug [followme related]

      Hi all,
      i have this code (i know it looks confusing, because i don't know
      how to program the 'followme'-function, but it's not the problem)

      
       module LineA
        def LineA.create_line
        unless Sketchup.active_model;
          until Sketchup.active_model.active_entities
          end
        end
        
          model = Sketchup.active_model
          entities = model.active_entities
      #--------------------------------------------------------------------------
          # Add the group to the entities in the model
          group = entities.add_group
      
          # Get the entities within the group
          entities2 = group.entities
      #--------------------------------------------------------------------------
          @width_small = 55 # 55  
          @depth_small = 45 # 45  
          @height_small = 30 # 30 
          @width_big = 70 # 70 
          @depth_big = 60 # 60
          @height_big = 70 # 40
          
          @height_line = (4/3) * @height_small
          @radius = 1
          @arcradius = 3
      #--------------------------------------------------------------------------
          @mat_linie=model.materials.add("Material_Linie")
          @mat_linie.color=Sketchup;;Color.new(124,252,0)  # => LawnGreen
      #--------------------------------------------------------------------------
          @anzahl_arcs = ((@depth_small-6)/6).to_i
          
          @pts =[]
          @helpvar_depth = 3
          @helpvar_pts = 1
          @helpvar_baseline = 1
          @helpvar_basearc = 1 
          
      #--------------------------------------------------------------------------    
          1.upto(@anzahl_arcs) do |x|
            @helpvar2_pts = @helpvar_pts +1 
      #--------------------------------------------------------------------------
            if (x%2 > 0)
              @pts[@helpvar_pts] = [((@width_big-@width_small)/2)+5.35, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              @pts[@helpvar_pts+1] = [@width_small+((@width_big-@width_small)/2)-5.3, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              # arc_point
              @pts[@helpvar_pts+2] = [@width_small+((@width_big-@width_small)/2)-5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+3), @height_line]
                      
              arc_circle_odd = entities2.add_circle @pts[@helpvar_pts+1], X_AXIS, @radius, 42
              arc_circle_face_odd = entities2.add_face arc_circle_odd
              arc_circle_face_odd.material = @mat_linie
              arc_circle_face_odd.back_material = @mat_linie
                      
              line_circle_odd = entities2.add_circle @pts[@helpvar_pts], X_AXIS, @radius, 42
              line_circle_face_odd = entities2.add_face line_circle_odd
              line_circle_face_odd.material = @mat_linie
              line_circle_face_odd.back_material = @mat_linie
                     
              @helpvar_baseline_odd = entities2.add_line @pts[@helpvar_pts], @pts[@helpvar_pts+1]
             
              @helpvar_basearc_odd = entities2.add_arc @pts[@helpvar_pts+2],[0,-1,0],[0,0,1],@arcradius,-5.degrees,185.degrees 
              
              arc_circle_face_odd.followme @helpvar_basearc_odd
              line_circle_face_odd.followme @helpvar_baseline_odd
              
      #--------------------------------------------------------------------------
            elsif (x%2 == 0) 
              @pts[@helpvar2_pts-1] = [((@width_big-@width_small)/2)+5.3, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              @pts[@helpvar2_pts] = [@width_small+((@width_big-@width_small)/2)-5.35, ((@depth_big-@depth_small)/2)+@helpvar_depth, @height_line]
              # arc_point
              @pts[@helpvar2_pts+1] = [((@width_big-@width_small)/2)+5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+3), @height_line]
                      
              arc_circle_even = entities2.add_circle @pts[@helpvar2_pts-1], X_AXIS, @radius, 42
              arc_circle_face_even = entities2.add_face arc_circle_even
              arc_circle_face_even.material = @mat_linie
              arc_circle_face_even.back_material = @mat_linie
                      
              line_circle_even = entities2.add_circle @pts[@helpvar2_pts], X_AXIS, @radius, 42
              line_circle_face_even = entities2.add_face line_circle_even
              line_circle_face_even.material = @mat_linie
              line_circle_face_even.back_material = @mat_linie
                             
              @helpvar_baseline_even = entities2.add_line @pts[@helpvar2_pts], @pts[@helpvar2_pts-1]
             
              @helpvar_basearc_even = entities2.add_arc @pts[@helpvar2_pts+1],[0,1,0],[0,0,1],@arcradius,-5.degrees,185.degrees
              
              arc_circle_face_even.followme @helpvar_basearc_even
              line_circle_face_even.followme @helpvar_baseline_even
              
            end # if
      #--------------------------------------------------------------------------
             if (x == @anzahl_arcs)
              @pts[@helpvar_pts] = [((@width_big-@width_small)/2)+5.35, ((@depth_big-@depth_small)/2)+(@helpvar_depth+6), @height_line]
              @pts[@helpvar_pts+1] = [@width_small+((@width_big-@width_small)/2)-5, ((@depth_big-@depth_small)/2)+(@helpvar_depth+6), @height_line]
              
              @helpvar_baseline_ende = entities2.add_line @pts[@helpvar_pts], @pts[@helpvar_pts+1]
                      
              line_circle_odd = entities2.add_circle @pts[@helpvar_pts], X_AXIS, @radius, 42
              line_circle_face_odd = entities2.add_face line_circle_odd
              line_circle_face_odd.material = @mat_linie
              line_circle_face_odd.back_material = @mat_linie
                      
              line_circle_face_odd.followme @helpvar_baseline_ende
              
            end # if
      #--------------------------------------------------------------------------
            @helpvar_depth = @helpvar_depth + 6
            @helpvar_pts = @helpvar_pts + 3
      #--------------------------------------------------------------------------
          end # upto - do    
      #--------------------------------------------------------------------------
        end # def
      end # module
      
      LineA.create_line
      
      
      

      When i execute it in SU there's no error, but if i load it in the plugins of SU,
      the hole SU break down and show me a 'Bug Splat', however no significant error message.
      I hope you can help me.
      Thanks

      posted in Developers' Forum
      C
      Chris88
    • RE: Error Message

      Thanks to all,
      the problem is solved

      posted in Developers' Forum
      C
      Chris88