• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Save skp file errors

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 4 Posters 944 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.
  • N Offline
    not registered yet
    last edited by 4 Dec 2007, 06:06

    I wanted to cycle through my library skp files and make sure the view of the geometry was centred.
    I am having some problem with Sketchup.active_model.save which is not working how I expect (see below). Any thoughts anybody?

    Thanks

    Bill Wood

    PS I figured out about find_support_files as per my earlier question

    -------------------------------------------------

    paths = Sketchup.find_support_files ("skp","Components/Architecture/")
    puts paths[0].class # type String
    Sketchup.open_file paths[0] # true file opened

    Sketchup.send_action "viewZoomExtents:"
    Sketchup.active_model.active_view.invalidate

    curpath = Sketchup.active_model.path

    returns C:\Program Files\Google\Google SketchUp 6\Components\Architecture\Door-SglExtHeaderWLite 3'-0x6'-8.skp

    puts curpath.class # type String

    Sketchup.active_model.save curpath

    gives Error:

    #<Exception: (eval):32:in `save': Invalid filename>

    fname = File::basename(curpath)
    puts fname.class # type String

    Sketchup.active_model.save fname # returns true but does not save actual file

    curpath = "C:/Program Files/Google/Google SketchUp 6/Components/Architecture/Door-SglExtHeaderWLite 3'-0x6'-8.skp"

    if I change \ to / for curpath returns true but does not save actual file

    Sketchup.active_model.save curpath

    [BillW]

    1 Reply Last reply Reply Quote 0
    • A Offline
      azuby
      last edited by 4 Dec 2007, 06:08

      Have you also tried to use filenames without inverted comma / apostrophe?

      azuby

      *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

      Bad English? PM me, correct me. :smile:**

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by 4 Dec 2007, 06:09

        FYI. The default path for model.save is not where you would expect, nor, the current working directory. Save a unique name and search for it. It's probably going to C:\Documents and Settings\Default User\Local Settings blah, blah or some such location. I've put in an enhancement request to make it more obvious/intuitive/documented.

        Todd

        1 Reply Last reply Reply Quote 0
        • A Offline
          Al Hart
          last edited by 4 Dec 2007, 06:10

          Bill,

          Were you ever able to save the .SKP where you wanted them?

          I tried saving it with the base name (xxx.skp) and no path. I don't think it resaved it, althoug it returned true.

          sname = File.basename(sfile)
          model.save(sname)

          I then saved it with new names using:

          component_name = File.basename(sfile,".*")
          sname = component_name + "_new.skp"
          model.save(sname)

          This seems to have worked (saving a new SKP in the original folder)

          Al Hart

          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

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

          Advertisement