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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Help with Su v8 plugin syntax

    Scheduled Pinned Locked Moved Plugins
    9 Posts 4 Posters 1.1k Views 4 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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by honoluludesktop

      Bad syntax?

      .
      .
      .
      e.vertices.each do |e|
        all_file_names.push ("  0\nVERTEX\n  8\n"),comp_inst_layer
         if block_origin_flag==1
          block_origin.push (e.position.x.to_f)+vx
          block_origin.push (e.position.y.to_f)+vy
          block_origin.push (e.position.z.to_f)+vz
          block_origin_flag=0
         end
         all_file_names.push "10\n",(e.position.x.to_f)+vx
         all_file_names.push "20\n",(e.position.y.to_f)+vy
         all_file_names.push "30\n",(e.position.z.to_f)+vz
         all_file_names.push  (" 70\n    32\n")
        end
      .
      .
      .
      

      Temp00.jpg

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Can you copy the whole of the actual text?

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          This is probably the error:

          all_components.push("0\nVERTEX\n 8\n"), comp_inst_layer

          But I am not sure if you mean:

          all_components.push("0\nVERTEX\n 8\n#{comp_inst_layer}")

          or

          all_components << "0\nVERTEX\n 8\n" << comp_inst_layer

          Hi

          1 Reply Last reply Reply Quote 0
          • honoluludesktopH Offline
            honoluludesktop
            last edited by

            Forgot to post>_< See above.

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Jim, or anyone, What's the difference between:
              all_components.push("0\nVERTEX\n 8\n#{comp_inst_layer}"), and
              all_components << "0\nVERTEX\n 8\n" << comp_inst_layer?
              "comp_inst_layer" is a integer that I need to add to the string. Will the former add a number to the string then add the line to all.components, and the latter ????

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                << works like push on Arrays, so the first one pushes a single element onto the Array; the second pushes 2 elements on the Array.

                Sorry, I mixed << and push unnecessarily. Maybe this makes more sense?

                all_components << "0\nVERTEX\n 8\n#{comp_inst_layer}" all_components << "0\nVERTEX\n 8\n" << comp_inst_layer?

                Hi

                1 Reply Last reply Reply Quote 0
                • honoluludesktopH Offline
                  honoluludesktop
                  last edited by

                  Thanks, I got it.

                  This was part of the last bit of code I wrote, only to discover that I failed to account for the location and orientation duplicated components properly. Only works if the component is not duplicated. Doesn't matter too much for how I use it, and I guess that doing it right is a bit too ambitious for my current coding ability. πŸ™‚

                  Addenda 1: Sigh! The code loads, but there are a bunch of other syntax errors as reveled by the "ruby console". Well, here is my chance to learn correct syntax.
                  Temp78.jpg
                  Addenda 2: OK, done.

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    This is a syntax error in Ruby 1.8.6:
                    all_file_names.push (" 0\nVERTEX\n 8\n"),comp_inst_layer

                    The error tells you "unexpected ',' expecting kEND"
                    So the first comma on the line is between the arguments...
                    Ruby was expecting an END of line.. and NOT another argument...
                    therefore Ruby thought the first argument was the entire argument list.

                    In Ruby 1.8.6 ... the first argument CANNOT be wrapped in parenthesis UNLESS you wrap the ENTIRE argumentlist ALSO in parenthesis, AND have no space between the end of the method name and the arglist opening (

                    like so:
                    all_file_names.push( (" 0\nVERTEX\n 8\n"),comp_inst_layer )
                    .

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • honoluludesktopH Offline
                      honoluludesktop
                      last edited by

                      Dan, Thanks.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement