Save skp file errors
-
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 openedSketchup.send_action "viewZoomExtents:"
Sketchup.active_model.active_view.invalidatecurpath = 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 StringSketchup.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]
-
Have you also tried to use filenames without inverted comma / apostrophe?
azuby
-
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
-
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)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement