Workarounds for backward compatibilty


I see these code segments in some examples: are they still necessary for backward compatibility?

`#Shim for the Set class which was moved in SketchUp 2014.
if defined?(Sketchup::Set)
    Set = Sketchup::Set

and this:

if tb.get_last_state == TB_NEVER_SHOWN
  # Hide toolbar at first startup
  # Per bug 2902434, adding a timer call to restore the toolbar. This
  # fixes a toolbar resizing regression on PC as the restore() call
  # does not seem to work as the script is first loading.
  UI.start_timer(0.1, false) {

How to get a toolbar to appear on first load of a plugin?

If you use the Set class that ships with SketchUp prior to SU2014, yes. They always will be. Though we don’t recommend the use of that old class. The Set class from the Ruby Standard Library is much better and faster - but only exist in SU2014 and up.

For extensions that run on newer SketchUp versions, no this isn’t needed. But if you want to support older SketchUp versions - then yes, you need to use that.

Personally I don’t really bother to code for SketchUp versions older than SU2014 any more. The inclusion of Ruby 2.0 and the standard library and other bug fixes doesn’t make support for older versions worth it.

(P.S. Cn yoy wrap code as Preformated Text when you post? Makes it much easier to read code.)


When using workarounds (this one is copy-pasted from a SketchUp example), it is always good to specify how long the work-around is valid, if a time is known, or at least the exact circumstances/reasons under which the work-around was needed. So you don’t collect lots of legacy code and you know what can be cleaned up.

I believe bug #2902434 was fixed, but in what version was it? There is no easy way to look up…


I’m not an HTML guy. How do I wrap preformatted text?


That’s before my time - that issue reference is for some old issue tracker that we don’t use any more I’m afraid.

You can use the formatting toolbar:


Certainly. So that we can help you, it would be good to know what the problem is. Best you create your own question by clicking +New Topic and describe the problem in detail.


I have done that several times, i didnt get any answer, i also tried by private messages, i cant open my file, it says unexpected file format and then it closes.
sorry about the writing my native language is spanish


I see Jim started giving you an answer. I will also take a look. It is really enough if you upload your file only once, and keep the question focussed in one thread. Usually we reply in every thread, though maybe not as fast as an ambulance.