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

    Posts

    Recent Best Controversial
    • RE: [Plugin] Scale and Rotate Multiple (UPDATED Dec 22, 09)

      Hello

      I use this plugin all the time, but now with SU 2022 it seems to be causing SU to crash on startup. It was the only non-2022 compatible plugin I had, and removing it from the plugins folder has stopped the crashing.

      I see it is only marked compatible up to v2018, is it not being developed any more? Does anyone know of a good alternative if so?

      thanks

      posted in Plugins
      K
      keithswd
    • RE: [Plugin] Compo Spray 1.4.2 Updated

      Hi

      I am trying to use this tool to place 2D faceme components (plants) onto the ground. I keep getting a message stating

      "1000 trials to drop components done. Continue?"

      Whatever I press now, I get into an unbreakable loop where the either (if I press yes) the time to complete keeps going up exponentially and another message pops up or (if I press no) I get the spinning colour wheel. Either way I have to force exit sketchup.

      I haven't used the tool for a while, but don't remember this problem before.

      I have SU2016 on OS X.

      thanks

      posted in Plugins
      K
      keithswd
    • RE: [Plugin] Compo Spray 1.4.2 Updated

      Many thanks Oxer (and MTriple) this version is working for me too!

      Glad to have this very useful tool back in operation.

      posted in Plugins
      K
      keithswd
    • RE: [Plugin] Compo Spray 1.4.2 Updated

      Thanks Oxer. I have just tried putting the file & folder as you suggest but still get the error. I have double checked that there is no longer a copy in either user Application Support../Sketchup subfolders, or in the system support folder, but up pops the error when I start up.
      The error has changed to the updated path for the script, so maybe something else is wrong:

      Error: #<SyntaxError: /applications/sketchup 2014/sketchup.app/contents/resources/content/tools/compospray/compoutils.rbs:511: Invalid break
      /applications/sketchup 2014/sketchup.app/contents/resources/content/tools/compospray/compoutils.rbs:520: Invalid break>
      /applications/sketchup 2014/sketchup.app/contents/resources/content/tools/compospray/compoutils.rbs
      Error Loading File compoSprayToolbar.rb
      Error: #<NoMethodError: undefined method compSpray_env' for main:Object> /Applications/SketchUp 2014/SketchUp.app/Contents/Resources/Content/Tools/compoSprayToolbar.rb:7:in <top (required)>'

      posted in Plugins
      K
      keithswd
    • RE: [Plugin] Compo Spray 1.4.2 Updated

      Does anyone know how to get this plugin working on a Mac install of SU2014? I get this error after installation:

      @unknownuser said:

      Error: #<SyntaxError: /users/keithpocock/library/application support/sketchup 2014/sketchup/plugins/compospray/compoutils.rbs:511: Invalid break
      /users/keithpocock/library/application support/sketchup 2014/sketchup/plugins/compospray/compoutils.rbs:520: Invalid break>
      /users/keithpocock/library/application support/sketchup 2014/sketchup/plugins/compospray/compoutils.rbs
      Error Loading File compoSprayToolbar.rb
      Error: #<NoMethodError: undefined method compSpray_env' for main:Object> /Users/keithpocock/Library/Application Support/SketchUp 2014/SketchUp/Plugins/compoSprayToolbar.rb:7:in <top (required)>'

      posted in Plugins
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Hi John,
      The ear sounds painful! I hope you are recuperating well.
      Thanks for the workflow. I have got it to work, with SU loading a script automatically (which defines a function to set the current model behavior as I want it) and I call that function in console. It runs slowly compared to the all-Ruby solution - but at least it processes without crash. So I can send lots of files and leave it to run over lunch, or night!
      Many thanks again,
      Keith

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Thanks again for your help and suggested code. As it stands it does not modify any components. I discovered this is because it seems that even when the component file is loaded successfully, compDefinition.internal? returns false. I can only imagine that this is actually testing whether the component was created within the model or loaded from a file - in which case we are getting the expected result. I commented it out and it runs but... sadly it still bombs out at around 33 components.

      I really don't want to take up any more of anyone's time - this was just a little project for me to play with but it seems rather trickier than I could have forseen. But I thought you might like an update!

      def setcompfm
      
      model = Sketchup.active_model
      # set folder and get array of filenames
      folder = UI.openpanel("Choose a skp file to set folder","*.skp")
      
      return unless folder && folder = File.dirname(folder)
      
      skpFiles = Dir[File.join(folder, "*.skp")]
      
      length = skpFiles.length
      
      result = UI.messagebox "Process " + length.to_s + " files?", MB_YESNO
      
      return unless result == 6 # Yes
      
      # Returns a DefinitionList
      definitions = model.definitions
      
      # iterate through files
      i = 0
        puts()
        #
        skpFiles.each { |compFile|
          ###
          model.start_operation( "Update '#{File.basename(compFile)}'", true )
          ###
          compDefinition = definitions.load compFile
          begin
            #if compDefinition.internal?
              behavior = compDefinition.behavior
              behavior.always_face_camera = true
              behavior.shadows_face_sun = true
              compDefinition.save_as compFile
            #else
            #  putc(46) # period char
            #  redo
            #end
          rescue => e
            ###
            model.abort_operation()
            ###
            puts()
            puts "ERROR saving component file;"
            puts "  #{compFile}\n"
            puts e.message
            puts e.backtrace if $VERBOSE
            puts()
          else
            i += 1
            if i >= 10
              definitions.purge_unused
              i = 0
            end
            ###
            model.commit_operation()
            ###
          end
          # each skp file
        }
        definitions.purge_unused if definitions.length > 0
      
      
      end #end def
      
      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Thanks for the correction - I see my mistake now. However, the corrected syntax doesn't fix the crash. The folder selection works as it did before and populates the array with all the .skp files in the folder (about 200 for testing purposes), and my message box pops up and correctly reports the number to be processed.

      However it stops on the 33rd or 34th file no matter what that file is. Each time I run the script, I move the 33/34 successfully modified files out of the folder, so I am never processing the same files twice. I don't know what might be special about the 33/34 mark, but it bails at that point.

      Some kind of limit appears to be reached? Memory? I've no clue!

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Thanks Dan for the pointer to UI.openpanel, that all works fine.

      Not sure if it is because I need to learn about chunking my array, but my routine stops every time after processing 33 or 34 files (it is always after 33 or 34 files) and then SU8 crashes. Given that such a small number of files are processed before the hang/crash, I am not sure the array size is the problem? When the script stops running, I am left with the last loaded component in the component list. If I try and and check its 'Face-Me' status, SU crashes.

      def setcompfm
      
      model = Sketchup.active_model
      # set folder and get array of filenames
      folder = UI.openpanel("Choose a skp file to set folder","*.skp")
      
      if folder && folder = File.dirname(folder)
      	skpFiles = Dir[File.join(folder, "*.skp")]
      end
      
      length = skpFiles.length
      
      result = UI.messagebox "Process " + length.to_s + " files?", MB_YESNO
      
      if result == 6 # Yes
      
      # Returns a DefinitionList
      definitions = model.definitions
      
      # iterate through files
      begin
      
      	skpFiles.each do |compFile|
      
      		compDefinition = definitions.load compFile
      		behavior = compDefinition.behavior
      		behavior.always_face_camera = true
      		behavior.shadows_face_sun = true
      		compDefinition.save_as compFile
      		definitions.purge_unused
      
      	end #end do
      
      rescue
      	puts compFile
      
      end #end begin
      
      end #end if
      
      end #end def
      
      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Ah - I was wondering what might happen if I loaded a really huge folder - actually I have a couple of thousand file to process. Not all at once though... I will check out that link when I have more time, at first glance looks a bit scary for a novice!

      Yes, I really am in London UK (live in W14, work SE11)!

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      As the code stands it runs without any prompts at all. It processed 10 files in the folder in an instant. For my purposes I'd rather manually copy files to be processed into the folder and run the script unattended, knowing I had my own backups. It's only for me to use so I c an leave it rough and ready... Might be nice to select the folder via the file open dialog, other than that I think it serves my needs

      Thanks to all for the help and encouragement.

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      This code appears to work on a test folder of 10 .skp files. Haven't let it loose on the main folder of 500!

      model = Sketchup.active_model
      
      # set folder and get array of filenames
      loadFolder = "/Users/Keith/Illustration Library/Testfolder"
      skpFiles = Dir[File.join(loadFolder, "*.skp")]
      
      
      # Returns a DefinitionList
      definitions = model.definitions
      
      # iterate through files
      
      skpFiles.each do |compFile|
      	compDefinition = definitions.load compFile
      	behavior = compDefinition.behavior
      	behavior.always_face_camera = true
      	behavior.shadows_face_sun = true
      	compDefinition.save_as compFile
      	definitions.purge_unused
      	end
      

      no error handling of course so it's a bit 'quick and dirty'.

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Driven - Thanks so much for taking the time to write that up for me.

      Unfortunately I don't think this approach will work as it seems that it opens all the files in the folder in one go? I have hundreds of files to process (although I could put them into a working folder in batches I suppose). I am going to try modifying your code to get the array of *.skp files in the folder, then sequentially load each one as a component, modify it, save it back to the folder, delete and purge the instance, and move on to the next file. It seems like that will avoid the issue of not being able to close the current model via Ruby, and will only open one component at a time.

      cheers Keith

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      I could do it Windows (via Parallels). Or perhaps process the components within a single model:
      Load component from file
      Set attributes
      Save component back to file
      Delete component instance
      Purge component
      Next

      I'll get reading the Newbie guides... Thanks again.

      posted in Developers' Forum
      K
      keithswd
    • RE: New to Ruby - I want to write a script to...

      Dan - thanks for the response but I don't see how it would help me. I have a large number of components (actually a purchased library of entourage images as .skp files) which are not set up to Face-Me. Each time I insert one for the first time I have to set these two properties. I then save the component back to the file so I don't need to do it for that file again, but there are a hell of a lot yet to be updated...

      I hadn't expected any issues with T&C though!

      posted in Developers' Forum
      K
      keithswd
    • New to Ruby - I want to write a script to...

      I am a complete Ruby novice, my only experience of coding is writing some fairly simple routines in AutoLisp.

      I want to write a script that will process all .skp files in a selected folder, opening each in turn, setting 'Face the Camera' and 'Shadows Face Sun' both to 'True', close and save the model (ignoring any warnings about changing the Sketchup version). It needs to work with OS X 10.8.

      I am not even sure if this can be done with Ruby, as I have only encountered scripts which work within the current model, not access the OS file system etc.

      Any pointers gratefully accepted! Thanks

      posted in Developers' Forum
      K
      keithswd
    • SU8 randomly (?) hangs when adding face-me components

      I am experiencing two serious problems with Sketchup, resulting in frequent program hangs and crashes. I am really tearing my hair out over this now. I am unsure if the problems are related but I will describe both here in case they are:

      1. Program hangs
      I generally have no problems during basic modelling and applying materials. I am a garden designer, and I need to include a relatively large number of plants in my models and I almost exclusively use 2D 'face-me' components. I make extensive use of the CADPlants libraries together with some components from other sources.
      Problems start during this process, when I find that having inserted numerous components without any issue, I click to select a new one from the component window (from my local library) and immediately get the 'wait' colour wheel. At this point the program has hung. I have waited 15 minutes and the software will never recover. I have to Force-Quit and start again, from a recent save or AutoSave.

      Perhaps I am just expecting too much of the software and/or hardware?

      The behaviour occurs in SU8 on both my iMac and Mac Book Pro (specs etc below).
      It is not model specific.
      It is not component specific (i.e. Any individual component may or may not cause the issue).

      Troubleshooting already performed:
      Purging model
      Repairing model (no errors are ever found)
      Running SU with no plugins (by temporarily renaming the Plugin folder)

      As a workaround, I have had some success copying the surface on which I am placing the plant components to a new blank drawing (using Paste In Place). I then put the required plants on this surface, group them and copy-paste them back to the main model. I can often get 10 or 20 new components into the model this way. Occasionally it will cause SU to bomb out completely as I paste them in. I am having to add plants to renders in Photoshop instead, with less satisfactory results.

      I am not sure if it is just the quantity of face-me components or the textures that is resulting in the problems. A recent model that was particularly troublesome was 133MB in size on disk, with the following 'Entire Model' statistics including nested components:
      Edges: 68966
      Faces: 4490
      Component Instances: 304
      Groups: 53
      Component Definitions: 90
      Layers: 22
      Materials: 111
      Styles: 1
      All other items on the list are 0.

      I can provide a link to download this model if anyone cares to inspect it, but I do not want to post it publicly. PM me for link and password.

      2. Shaderlight render crashes
      Shaderlight will regularly cause SU8 to crash, shortly after hitting the 'Render' button. I am usually using the SU Lighting environment. Sometimes I use Moofe or Preset. I don't think it matters as far as the potential to crash goes. I am going to post about this direct to Shaderlight as well.

      Edit: Error log files added in case anyone understand them - I don't!

      System Info:
      iMac – Late 2011
      3.4GHz i7, 16GB RAM, OS X 10.8.3, Radeon 6970M 1024MB

      Mac Book Pro
      2.5GHz i7, 16GB RAM, OS X 10.8.3, Intel HD Graphics 3000 512MB

      Both Systems:
      SU Pro 8.0.16845


      Error log files

      posted in SketchUp Bug Reporting sketchup
      K
      keithswd
    • Matching 2d export from SU to shaderlight render?

      I have just worked out from this thread http://sketchucation.com/forums/viewtopic.php?f=15&t=34579 how to create a depth map from SU using Fog (thanks!).

      I just wondered if there is a way to get a perfect match between my Shaderlight render (set at 1920x1080) of a scene and what I get from exporting a 2D raster directly from SU. I know I can go into options and deselect 'Use View Size', and change dimensions in the box, but the aspect ratio is still determined by the SU window. It is not easy to match the 16:9 by changing the window size. I am not sure if unlinking the width and height in the Options dialogue is distorting the image or just changing the extents... Either way, it seems I have to eyeball the overlay of the two layers in Photoshop, which is not ideal.

      Is there a trick I am missing?

      thanks

      posted in Newbie Forum sketchup
      K
      keithswd
    • 1 / 1