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

    Hologram

    Scheduled Pinned Locked Moved Plugins
    29 Posts 3 Posters 1.7k Views 3 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.
    • D Offline
      driven
      last edited by

      line 4

      
      SCRIPTS_DIR = File.dirname(__FILE__)
      PYTHON_PATH = "/usr/local/bin/python"
      

      "/usr/local/bin/python" need to be your path to where you instal the draw_pattern.py

      I would also changed line 3, then you can leave it all outside of SU and use load "<your path goes here>" from 'Ruby Console' to test it...

      good luck

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • robertWanR Offline
        robertWan
        last edited by

        Error Loading File solid_pattern.rb
        C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;3; Invalid escape character syntax
        ... and Settings\Administrator\My Documents\ScratchHolograms-ma...
        

        https://dl.dropboxusercontent.com/s/4tnvdjq10um4f1e/Clipboard01.gif?dl=0

        Robert
        ^


        solid_pattern.rb

        1 Reply Last reply Reply Quote 0
        • robertWanR Offline
          robertWan
          last edited by

          Error Loading File solid_pattern.rb
          C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;3; Invalid escape character syntax
          ... and Settings\Administrator\My Documents\ScratchHolograms-ma...
                                        ^
          C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;230; syntax error, unexpected tIDENTIFIER, expecting ')'
          	puts "Data export done. Python res...
          	    ^
          

          solid_pattern.rb

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by

            the line 3 error is pointing at you back slash ** try using forward slashes /, ruby uses either but python or system might not...
            and line 230 is missing a closing bracket )...
            sorry
            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              it was written for a mac, so maybe...

              	d = IO.popen(PYTHON_PATH + " draw_pattern.py " + base_dir + "/" + proposal)
              

              possibly needs to be

              	d = IO.popen(File.join(PYTHON_PATH , " draw_pattern.py ",base_dir, proposal))
              

              john
              EDIT added the missing bracket...

              learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                The error message points to line #3...
                Which reads:
                SCRIPTS_DIR = "C:\Documents and Settings\Administrator\My Documents\ScratchHolograms-master" PYTHON_PATH = "C:\Python27" ...

                You must always escape the \ folder de-liminator within ANY "" - OR use '' or / etc.
                So change these everywhere to be something like one of these examples...
                SCRIPTS_DIR = "C:\\Documents and Settings\\Administrator\\My Documents\\ScratchHolograms-master" ...
                or
                SCRIPTS_DIR = 'C:\Documents and Settings\Administrator\My Documents\ScratchHolograms-master' ...
                or
                SCRIPTS_DIR = "C:/Documents and Settings/Administrator/My Documents/ScratchHolograms-master" ...
                or
                SCRIPTS_DIR = 'C:/Documents and Settings/Administrator/My Documents/ScratchHolograms-master' ...

                The ' /' is the safer folder-path de-liminator...
                The \ within "" is taken as an escape character, like in \n == Newline and \t == Tab...
                [mod=:3v04zt7t]EDIT: @driven just beat me to it, but as I typed it... here it is anyway !
                πŸ˜’[/mod:3v04zt7t]

                TIG

                1 Reply Last reply Reply Quote 0
                • robertWanR Offline
                  robertWan
                  last edited by

                  Finished exporting vertex data.
                  Running python script...
                  Error; #<Errno;;EACCES; Permission denied - C;/Python27/ draw_pattern.py /C;\Documents and Settings\Administrator\My Documents/Untitled.pattern>
                  C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen'
                  C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern'
                  C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
                  
                  

                  http://www.screencast.com/t/2BSBkccw28NW

                  Robert


                  solid_pattern.rb

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by

                    Error: #<Errno::EACCES: Permission denied - C:/Python27/ draw_pattern.py /C:\Documents

                    you have spaces before and after draw_pattern.py which may be the issue...

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • robertWanR Offline
                      robertWan
                      last edited by

                      Finished exporting vertex data.
                      Running python script...
                      Error; #<Errno;;ENOEXEC; Exec format error - C;/Python27/draw_pattern.py C;\Documents and Settings\Administrator\My Documents/Untitled.pattern>
                      C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen'
                      C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern'
                      C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
                      
                      

                      solid_pattern.rb

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

                        EDIT:
                        I now realize it's about the Windows need for trapping spaces in file paths - change it thus:
                        Change your paths to keep the \ - the system-calls expect them NOT /:
                        SCRIPTS_DIR = "C:\\Documents and Settings\\Administrator\\My Documents\\ScratchHolograms-master" PYTHON_PATH = "C:\\Python27"
                        Then enclose the two parts of the system-call inside "" :
                        IO.popen('"'+PYTHON_PATH+"\\draw_pattern.py"+'" "'+base_dir+"\\"+proposal+'"')

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • robertWanR Offline
                          robertWan
                          last edited by

                          Finished exporting vertex data.
                          Running python script...
                          Error; #<Errno;;ENOEXEC; Exec format error - "C;\Python27\draw_pattern.py" "C;\Documents and Settings\Administrator\My Documents\Untitled.pattern">
                          C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen'
                          C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern'
                          C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
                          
                          

                          current plugin

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            driven
                            last edited by

                            have a look at Dan's
                            [Plugin] Hypocycloid Cam Profile Generator v1.0.0 http://sketchucation.com/forums/viewtopic.php?p=470834#p470834
                            it was based on a python [py/dxf] script that I couldn't get to run...
                            he reworked it to SU ruby, may be a simpler approach...

                            john

                            learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                              I'm no expert on 'python' but isn't the cmd code more like this:

                              path_to_py argument(s)

                              Also have you got 'python' set up right in cmd window ?

                              ftype Python26.File="C:\Python26\python.exe" "%1" %
                              assoc .py=Python26.File*

                              AND then run it...

                              IO.popen('"'+PYTHON_PATH+"\\draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')
                              OR
                              **system**('"'+PYTHON_PATH+"\\draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')

                              OR perhaps the .py part can't be inside "" ?

                              Read this about file associations... http://eli.thegreenplace.net/2010/12/14/problem-passing-arguments-to-python-scripts-on-windows/

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • robertWanR Offline
                                robertWan
                                last edited by

                                Error Loading File solid_pattern.rb
                                C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; syntax error, unexpected $undefined, expecting ')'
                                ...w_pattern.py+'" "'+base_dir+"\\"+proposal+'"')
                                                              ^
                                C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; unterminated string meets end of file
                                C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; syntax error, unexpected $end, expecting kEND
                                

                                solid_pattern.rb

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

                                  My typo !
                                  2 missing characters...
                                  Try:

                                  IO.popen('"'+PYTHON_PATH+"\\%(#0000FF)["+]draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')

                                  If you view your code in Notepad++ with suitable RB syntax coloring it's clearly wrong...

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • robertWanR Offline
                                    robertWan
                                    last edited by

                                    @tig said:

                                    If you view your code in Notepad++

                                    I use PSPad. I install Notepad++.

                                    Finished exporting vertex data.
                                    Running python script...
                                    Error; #<NameError; undefined local variable or method `draw_pattern' for main;Object>
                                    C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern'
                                    C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
                                    

                                    solid_pattern.rb

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

                                      Try this:
                                      d = IO.popen('"'+PYTHON_PATH%(#0000BF)[+"\\draw_pattern.py "+]base_dir+"\\"+proposal+'"')
                                      I misunderstood, there is no 'draw_pattern' variable !

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • robertWanR Offline
                                        robertWan
                                        last edited by

                                        Finished exporting vertex data.
                                        Running python script...
                                        Error; #<Errno;;EINVAL; Invalid argument - "C;\Python27\draw_pattern.py C;\Documents and Settings\Administrator\My Documents\Untitled.pattern">
                                        C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen'
                                        C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern'
                                        C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
                                        
                                        

                                        solid_pattern.rb

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

                                          I weary... try...
                                          d = IO.popen('"'+PYTHON_PATH+'\draw_pattern.py" "'+base_dir+'"\\"+proposal+'"')
                                          So many permutations... πŸ˜’

                                          TIG

                                          1 Reply Last reply Reply Quote 0
                                          • robertWanR Offline
                                            robertWan
                                            last edited by

                                            @tig said:

                                            I weary

                                            😳

                                            Error Loading File solid_pattern.rb
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;230; syntax error, unexpected tCONSTANT, expecting ')'
                                            	puts "Data export done. Python results w...
                                            	          ^
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;237; syntax error, unexpected tIDENTIFIER, expecting kEND
                                            if(file_loaded("solid_pattern.rb"))
                                                                         ^
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;238; syntax error, unexpected tCONSTANT, expecting kEND
                                            	 menu = UI.menu("Plugins");
                                            	                        ^
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239; syntax error, unexpected tCONSTANT, expecting kEND
                                            	menu.add_item("Make Solid Scratch Pattern...") { ExportPattern() }
                                            	                   ^
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; syntax error, unexpected tIDENTIFIER, expecting kEND
                                            file_loaded("solid_pattern.rb")
                                                                      ^
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; unterminated string meets end of file
                                            C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; syntax error, unexpected $end, expecting kEND
                                            

                                            solid_pattern.rb

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

                                            Advertisement