cpzq66
May 10, 2022, 10:24am
1
Can sketchup components be saved as other versions via ruby?
cpzq66
May 10, 2022, 10:25am
2
I would like a clear answer, please.
dezmo
May 10, 2022, 10:28am
3
Yes. But only if you are using SketchUp version 2022.0 or newer.
See here: #save_as method.
2 Likes
dezmo
May 10, 2022, 10:43am
4
There is an unclear answer as well, but since you are refused, I can not tell you what is a workaround for older SketchUp versions … you have to search in a forum yourself.
1 Like
cpzq66
May 10, 2022, 12:06pm
6
It would be great if the old version can also solve this problem, can you tell me your method, thank you
dezmo
May 10, 2022, 12:53pm
7
Hi Jim, i needed a solution to a older version i dont use.
With the directions of TIG i find a fine solution.
This way:
# Method: convert_component_definitions()
def self.convert_component_definitions(folder, new_version=false)
new_version = new_version || Sketchup::Model::VERSION_2016
# Store active model
active_file = Sketchup.active_model.path
# Loop trough all the files in folder and convert the .skp files
Dir.foreach(folder) {|file|
next if [".", ".."].include?(file)
n…
You can check other post on that topic too.
1 Like
saveFile = d.save_as (tempPath, Sketchup::Model::VERSION_8) Help me see what’s wrong here
saveFile = d.save_as (tempPath, Sketchup::Model::VERSION_8)
cpzq66
May 10, 2022, 11:05pm
13
Can you point me out where I am wrong, thanks
There is a space after save_as which is causing the syntax error.
saveFile = d.save_as (tempPath, Sketchup::Model::VERSION_8)
Please read the following post. It will make communicating easier
Continuing the discussion from Ruby backtick returns nothing! :
Triple backtick delimiter lines.
What is a backquote ?
[image]
Backquote character key on US keyboard.
If it is error message text (or some other plain text that contains <, >, #, or other characters that can confuse Discourse markdown,) then specify “text” as a lexing language:
```text
paste error message here
```
If it is Ruby, then:
```ruby
# code here
```
If it is Javascript, then:
```javascript
/* js…