Ruby's novice question

Asked 2 years ago, Updated 2 years ago, 48 views

  def self.legacy_save
    path = Sketchup.active_model.path

    if path.empty?
      Sketchup.send_action("saveDocument:")
      return
    end

    version = version_param(version(path))
    Sketchup.active_model.save(path, version)
    UI.messagebox("Saved in Sketchup #{version}")
  rescue StandardError => e
    UI.messagebox("Save Error\n\n#{e.message}")
  end

UI.messagebox("Saved in Sketchup #{version}")

If you watch this part...

When I save a program, I tell you which version of the program I saved

I made a pop-up message.

Sketchup 1

Sketchup 2

Sketchup 3

Sketchup 4 ... Sketchup 8

Sketchup 2013

Sketchup 2014

Sketchup 2015

This is the order of the program version

For example, if you save it as 8, a pop-up message appears saying Save in Sketchup 8 and

If you save it as 7, a pop-up message will appear saying Save in Sketchup 7[Normal operation]

If you save it as 2013, you will see a pop-up message called Save in Sketchup 9[Of course, it works normally]

Save in Sketchup 2013

instead of 9

Save in Sketchup 2014 instead of 10 so that it floats I'd like to make a conditional statement

Help me

ruby

2022-09-20 20:11

1 Answers

version = version_param(version(path))
version = version >= 9 ? version + 2004 : version

Can't you just do it?


2022-09-20 20:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.