sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    (solved)locked files

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 2 Posters 1.3k 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.
    • jolranJ Offline
      jolran
      last edited by jolran

      Hi.

      This is probably trivial and basic, but I gotta ask. It's driving me totally nuts.

      I've created some components and saved them. Now it appears a locked icon next to the file name in the browser πŸ˜• And I then cannot retrieve them with ruby..
      I wanted first to save a component with textures and thought that was the issue, but with or without materials the problem remains.

      And no, it is not locked in Sketchup when saving. Tried different things. Right click save as, saving from the component broswer, saving in different folders, etc..

      Funny thing, did exact same thing a month ago and fine. Haven't changed any security setting or something like that..


      locked.jpg

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

        Is the component filename different then the model filename that Sketchup has open ??

        The "locked" file icon would indicate that the file was currently in use by some application.

        What happens when you close Sketchup ?? Does the icon return to normal ??

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • jolranJ Offline
          jolran
          last edited by

          Yes. Different file name. And no change in icons when I close Sketchup.
          I acctually did a reboot to doublecheck. Still persists.

          @unknownuser said:

          The "locked" file icon would indicate that the file was currently in use by some application

          That could be helpful.

          Although my first intuition was that I somehow was creating components in a different(or wrong) manner than before. Or some strange pop in my settings.

          I can save a SKP file in the file browser "Save as". And that come through as a normal skp icon.

          Very strange indeed.

          Thanks for the help Dan. Will investigate further tomorrow. It's late..

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

            WHERE are you saving these "locked" files ??

            IF you are saving files in the "Program Files" path, or other places that Windows feels is unsafe, then the system will lock the files as a security feature of Win7.

            You should save them under the User Documents path (because the user will always have read and write permissions on the directories beneath their "user" profile.)

            compname = 'widget' # or whatever, prompt the user, etc.
            
            if RUBY_PLATFORM =~ /darwin/ # Mac
              userpath = ENV['HOME']
              docsdir = 'Documents'
            else # Windows
              # File.expand_path() will convert '\'s to '/'s
              userpath = File.expand_path( ENV['USERPROFILE'] )
              ver = %x[ver].strip!.chop!.split().last.to_f
              docsdir =( ver<6.0 ? 'My Documents' ; 'Documents' )
            end
            docspath = File.join( userpath, docsdir )
            
            Dir.mkdir( docspath ) unless Kernel.test( ?d, docspath )
            filepath = docspath.dup  # make a copy
            ['Google Sketchup','Sketchup 8','Components'].each {|subdir|
              filepath = File.join( filepath, subdir )
              Dir.mkdir( filepath ) unless Kernel.test( ?d, filepath )
            }
            savepath = File.join( filepath, "#{compname}.skp" )
            success = my_definition.save_as( savepath )
            

            NOTE: On non-English Windows the name of the "Documents" dir may be in the local language.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • jolranJ Offline
              jolran
              last edited by

              Hi Dan, and thanks.

              Yes it appears to be Win 7 security issue as you say. Wierd..

              I was saving the files in Sketchup/Components.

              If I wasen't clear about what I was doing, In this case I was talking about saving the components manually, not by code. (Building a library for Hatchfaces).
              But thanks for the code. I'll think I'll need something like that further on, so you did not type it for nothing.

              Anyway, I saved the components in "User Documents path". Then moved them to desired folder.
              That did work. I can live with that..
              Just wonder if there will be any similar issues providing a plugin with a folder of premade skp files.

              1 Reply Last reply Reply Quote 0
              • jolranJ Offline
                jolran
                last edited by

                No, still don't work as expected. Probaly some win7 issue. But whats tripping me up is that it is happening all of a sudden.

                Now the skp files look OK in the browser. Same rights and fileattributes etc. But the new files don't show up when I create a list of names for a webdialog. Rebooting doesent help.

                To explain further I have a folder (something like: Plugins\JOLtest\Std_comps) where there are specific Hatch components.
                Last month or so I put some components there for testing, and their name show up in the dialog just fine. Yesterday I tried to add a few more and this happend(read topic).

                I'm using this simple Ruby code to get the components name to string array. For using it in Dialog. It works ok, since this folder will only contain specific Hatchcomps.

                
                def getComps(folder)#sorts .skp files to strings to array 
                			
                  comps=[] 
                  path = File.expand_path( File.dirname(__FILE__) )
                  path = File.join( path, folder ) #gets foldername from methodcall.
                  std_list=Dir.entries(path)
                  std_list.to_a.each{|fil| #return list as string if str. has ".skp" in it.
                     if fil.include? ".skp"
                        comps << fil.chomp(".skp") #remove ".skp" extension name
                     end
                  }
                  compList=comps.sort.join('|') #join each listitem with "|". 			
                  return compList
                end
                
                

                And then in a callback do an execute script like:

                @my_dialog.execute_script(%(document.getElementById("std_list").value="#{getComps('JOLtest\Std_comps')}";))
                

                Although I don't think the code is relevant to this problem, I'm just showing it so it's clear whats going on.

                Edited: BTW I can drag the "Nonworking" components into Sketchup(from folder), so they are not corrupted in that kind of way.

                1 Reply Last reply Reply Quote 0
                • jolranJ Offline
                  jolran
                  last edited by

                  OOPs πŸ˜„

                  There was a typo in my code. Now the comps are loading(hopefully).
                  Forget the last post.

                  Edit: Problem solved by saving components(like Dan said) in user/my documents/anyfolder.
                  Then I can copy and paste from there.

                  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