Comments (8)
I wondered how many seconds it would take for you to notice that. ;)
This was an added feature in a recent maintenance release, so only up to date clients will have this.
It occurs to me that this whole block needs to be wrapped in a version check. I'm not sure what behavior would be on older versions of SketchUp.
from sketchup-stl.
No need for version checking - we can use feature checking:
SketchUp 6:
Sketchup::Menu.instance_method( :add_item ).arity
# > 1
SketchUp 8 M4:
Sketchup::Menu.instance_method( :add_item ).arity
# > -1
So one can do:
if Sketchup::Menu.instance_method( :add_item ).arity == 1
UI.menu("File").add_item("Export STL...")
else
UI.menu("File").add_item("Export STL...", insert_index)
end
So the version that support it accepts any number of argument, but the old ones only accepts one.
On the other hand - not all SketchUp classes works like this. UI.menu
accepts any number of arguments without caring. UI.menu('Plugins', 123, 456, 789)
doesn't raise any errors. (I checked to see if one could pick a sub-menu...)
from sketchup-stl.
Yeah, if it works in older versions, then awesome. Nice trick with the arity check! I learn something new every time you guys post.
from sketchup-stl.
I just pushed a guard for it.
from sketchup-stl.
Great catch Thom! Hehe we learn new things when you post as well scott :)
On Tue, Oct 30, 2012 at 8:55 AM, Thomas Thomassen
[email protected]:
I just pushed a guard for it.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-9910966.
from sketchup-stl.
Closing this one now. Feature guard has been pushed to master.
from sketchup-stl.
The thing about feature checking is that you don't always know who added or changed the feature. It's possible that some feature has been implemented poorly by a "rogue" plugin".
from sketchup-stl.
You can test on a plain vanilla installation.
from sketchup-stl.
Related Issues (20)
- White box in export STL dialog ander Wine HOT 8
- Incorrect Link on EW Page HOT 1
- Export STL raises exception in Ruby Console HOT 3
- network deployment of extension to multiple PCs HOT 3
- Fixing load errors on systems where multi-byte characters are present… HOT 19
- File:"sketchup-stl.rb" refers to MIT License in file header HOT 1
- Warn user if there is nothing to export HOT 7
- Giant STLs (3+MB) cause crashing. HOT 9
- Can we get this signed for 2017? HOT 3
- Seems to export files rotated 90º when previewed HOT 5
- Binary preview is solid black in macOS (but ASCII is ok) HOT 36
- Audible beep after an import? HOT 5
- Sketchup 2014 under Wine HOT 4
- Sketchup 2017 under wine - Blank export settings HOT 4
- Can't download Sketchup-STL RBZ HOT 1
- Error exporting this model HOT 1
- Use outside Sketchup HOT 4
- Plugin not working with Make 2017 HOT 3
- https://extensions.sketchup.com/content/sketchup-stl no longer exists HOT 2
- Does not support Sketchup 8 as claimed HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sketchup-stl.