sketchucation logo sketchucation
    • Login
    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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Question on Ruby Problem

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 177 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      ktkoh
      last edited by

      Working on a new woodworking joint rb starting with dowel joint and I have this problem passing a negative number to a procedure.

      
          points_DowelCircle_Comp1(@xcl[i],ycl)
      
          def points_DowelCircle_Comp1(x,y)
          UI.messagebox("x = " + x.to_s)
          UI.messagebox("y = " + y.to_s)
          r=@@dia/2
          @pt[0]=Geom;;Point3d.new(x+r,y,0)
          @pt[1]=Geom;;Point3d.new(x+(0.866*r),y+(0.5*r),0)
          @pt[2]=Geom;;Point3d.new(x+(0.5*r),y+(0.866*r),0)
          @pt[3]=Geom;;Point3d.new(x,y+r,0)
          @pt[4]=Geom;;Point3d.new(x-(0.5*r),y+(0.866*r),0)
          @pt[5]=Geom;;Point3d.new(x-(0.866*r),y+(0.5*r),0)
          @pt[6]=Geom;;Point3d.new(x-r,y,0)
          @pt[7]=Geom;;Point3d.new(x-(0.866*r),y-(0.5*r),0)
          @pt[8]=Geom;;Point3d.new(x-(0.5*r),y-(0.866*r),0)
          @pt[9]=Geom;;Point3d.new(x,y-r,0)
          @pt[10]=Geom;;Point3d.new(x+(0.5*r),y-(0.866*r),0)
          @pt[11]=Geom;;Point3d.new(x+(0.866*r),y-(0.5*r),0)
          
          #Debug @pt.each {|e| UI.messagebox("point = "+ e.to_s)}
          
        end #points_DowelCircle
      

      When @xcl[i] is a negative number ie. -0.375 the program quits and the UI.messagebox at the start of the method does not happen. What am I doing wrong?

      Keith

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I suspect you haven't shown us the right bit of the code that's failing...
        I also assume you get no errors in the Ruby Console ??
        add a line in front of this...
        points_DowelCircle_Comp1(@xcl[i],ycl)
        like
        **puts @xcl[i] puts @xcl[i].class** points_DowelCircle_Comp1(@xcl[i],ycl)
        ???

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          ktkoh
          last edited by

          Thanks TIG as usual you were right on the problem and I found the error earlier in the code and it resulted in dir_y did not exist and program did not actually reach the point I thought was the problem.

          Keith

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better πŸ’—

          Register Login
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement