What if we could use <blank>?
-
@unknownuser said:
OK, I'll bite.
C++.
For processing intensive scripts, the speed would be awesome.
Todd
Now that'd be interesting.
-
I wouldn't be writing SU plugins if it's been C++. I've tried to get my head around it before, but with no great success. But I still think it'd be interesting with C++ plugins with the potential for increased speed.
As for my own preference of script language; I'm not picky. Script languages doesn't seem too hard to pick up once you've learnt one. I had previous experience in JS and PHP scripting. (Some Visual Basic and C# programming as well) Getting into ruby only took a weekend to get me started writing the scripts I wanted. Though I'm still learning new ways the Ruby language works as oppose to what I've used before.
I find the API and documentation of the API much more important. And I feel that the SU API documentation have lots of room for improvement.
-
C++ code - no big thang!!
#include <iostream> int main() { std;;cout << "Hello World!" << std;;endl ; return(0); }
Ruby
def cout ; STDOUT << "Hello World!" ; return ; end cout ;
I don't do Python.
-
I've done it all... I'd just be showing off.
-
@unknownuser said:
C++ code - no big thang!!
I don't do Python.With Python not only is it "no big thang"
There is no "THANG" at all!print 'Hello World'
sorry Todd, but that was a
(big one's really do fall harder!)PS: That Ruby code could have been better
PPS: Do you want to try file I/O next ?? -
I code in several languages, and Python is not one of them. Therefore, I can't be held accountable for knowing the ins and outs of it. I have nothing against Python (sans the comment ), it's just not something I want to invest my time in.
On that same list is learning how to wallpaper and ballroom dance.
-
WOW!, your comments show a deep seeded hatred for Python. Where is this coming from Todd?
-
I'm having difficulty finding any major differences between Python and Ruby. The "Hello World" example you cited can be coded exactly the same in Ruby. There are tutorials and references on Ruby, one of which is Programming Ruby. As one that has done a lot of C, to name one, I don't find that Ruby is a difficult language to learn. I don't think that a non-programming will find much difference between learning Ruby or Python. Python is open source, yada, yada, yada..., well, so is Ruby. You make it sound a lot worse than reality. Ruby is not simply derived from Perl, it has also borrowed from Eiffel, Smalltalk, Lisp, and Ada.
For the most part, I'm with Todd on this... why introduce another programming API into SU? It's not worth the effort. The quality of the SU Ruby API documentation has nothing to do with the choice of Ruby. It has everything to do with taking the time to produce. As in most software projects, documentation is generally the lowest priority on the schedule. That's certainly the case for the SU Ruby API. If Python had been chosen as the SU programming API, then I'd be in favor of keeping it. But, it wasn't. Do you think it would be a good investment of time to create another programming API for SU when one already exists? There would be double the documentation requirements and that doesn't include the added development/support requirements and code bloat. It seems very little value added for such an increased effort.
-
I am gonna have to suggest Lua on this.
The language's ability of being "a powerful, fast, light-weight, embeddable scripting language", is really what it sounds.Lua does functional programing, which is great for non programers if you combine it with the amazingly simple syntax. Also Lua has enough all the sleeves to pull all the cards you'd probably want from a scripting language. You can even do oop... and still be fast!
Many programs have been using it as their scripting language either for adding functionality or simply automating the host program. An easy example is Ecotect.
-
@jessejames said:
WOW!, your comments show a deep seeded hatred for Python. Where is this coming from Todd?
You are going down a dead end road, JJ. I don't know Python. I don't know how to wallpaper. I don't know how to ballroom dance. I don't know you. I hate none of the above. As it stands rights now, of the above, the only one I would care to learn about would be you!
-
I'm not much of a script programmer, my experience is mostly in c++ and c#. My forays into ruby are really my first experience with script languages. Not experiencing other choices, I'd have to pick ruby. I like that you can inherit classes; I don't like that it's a little to loose when it comes to that . I really like how easy it is to extend ruby with c and c++, and the tools available in c to communicate with ruby. I hate ruby's garbage collection (but that's only an issue when extending in c/c++). So good and bad, but having nothing to compare it against, I say it's good enough.
Avariant's pick: Ruby
-
@unknownuser said:
@jessejames said:
WOW!, your comments show a deep seeded hatred for Python. Where is this coming from Todd?
You are going down a dead end road, JJ. I don't know Python. I don't know how to wallpaper. I don't know how to ballroom dance. I don't know you. I hate none of the above. As it stands rights now, of the above, the only one I would care to learn about would be you!
Hello again Todd,
So you want to get to know me eh? A little chit chat? Ask away, these are free and open forums ASAIK -
JJ, some of your comparisons are clearly misleading. I haven't seen one thing that Python does that Ruby doesn't. The grammar may be slightly different, but they do the same thing (including "list comprehension"). Ruby has the identical functionality, but the syntax is different. You're wasting time as far as I'm concerned. This is a "religious" argument and your "religion" is Python. Threads like this will not end in anything but wasted time and hard feelings.
-
@david. said:
... Ruby is not simply derived from Perl, it has also borrowed from Eiffel, Smalltalk, Lisp, and Ada.
And the best things about Ruby are borrowed from Python.
@unknownuser said:
1Q.)For the most part, I'm with Todd on this... why introduce another programming API into SU? It's not worth the effort. The quality of the SU Ruby API documentation has nothing to do with the choice of Ruby. It has everything to do with taking the time to produce. As in most software projects, documentation is generally the lowest priority on the schedule. That's certainly the case for the SU Ruby API. If Python had been chosen as the SU programming API, then I'd be in favor of keeping it. But, it wasn't.
2Q.)Do you think it would be a good investment of time to create another programming API for SU when one already exists? ...These are all good questions and i will give good answers for them.
1A.) Look, an API is for users to wield the full power of an application(or maybe just automate a simple task), not so a few at the top can make money writing scripts because the language is poorly documented and overly complicated.
I have nothing against the professionals who want to write professional plug-in/scripts. But at least give the users of that application the common sense tools they need to get their scripting done, so don't handicap them with a poor language choice (Ruby)
I want to give every SU user the ability to write useful scripts for them selfs. My number one complaint about Ruby is Poor documentation. Ruby has no good free introductory tutorials. But Python has tons and tons of good free tutorials that cover vast amounts of programming tasks. At the following link, there are 300+ Python tutorials listed in more than 50 Categories, and this is just one site!!!
300+ tuts
http://www.awaretek.com/tutorials.htmlHere is a list of nonprogrammer tuts:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammersHere is a list of experienced programmer tuts:
http://wiki.python.org/moin/BeginnersGuide/ProgrammersRuby cannot touch the amount of good docs available for Python.
2A.) Yes, i absoulty think bringing in Python -- even next to Ruby -- would be a great idea. This would give all SU users the power they need. Not only do i think this is a great idea, i am willing to spend my time(free of charge)to make this happen. Even if i have to do it completely alone. That is my commitment! I have no will to make capital gains on the SU users. My goal is to extend their SU experience.
I plan write an introductory tut specifically targeted at SU users with no programming experience for SU Python scripting. Not only that, i plan a much better console for SU. You may say, why do we need a better console, a console is only good for trying out short pieces of code. I say Yes, this is exactly how a n00b learns. They type a command and see the results right away. The single line console in SU is almost useless and could easily be improved. Noobie's have a problem understanding how to format code to fit on one line.
Skethchup.active_model.selection[0].offset(-3)
or this
def f;for x in model.selection; x.this;x.that;end;end
All that does is serve to frustrate and defeat the user before they have a fighting chance. A multi-line console will ease the learning curve.
PYTHON GUI
Also Python has a built-in GUI(Tkinter). Tkinter is a very easy to use GUI toolkit, which contains all the main widgets a GUI needs, built right into the language. How would you like to have that on board for ya scripting pleasure, eh?here is a Tkinter program that contains a button widget
from Tkinter import * root = Tk() def call(); print 'Hello SketchUp' Button(root, text='Press Me', command=call).pack() root.mainloop()
That short piece of code creates a main window with a button that prints 'Hello SketchUp'.
Look, i want to improve this great software for everyone. The more people we have coding, the more ideas and improvements we can bring to SU. Let's empower all SU users!!
-
@david. said:
I'm having difficulty finding any major differences between Python and Ruby. The "Hello World" example you cited can be coded exactly the same in Ruby.
Hello David,
You right, the hello world in Ruby looks exactly like Pythonprint "Hello World"
Python and Ruby share many likeness because Ruby took them from Python, which is OK, i don't mind. But Ruby and Python are very different also -- VERY different.
don't forget to scroll down on the Ruby code
RUBY WAY:
module YourNameSpace class MyClass def method1(arg) if arg == this do this elisf arg == that do that else do that end end end require "scriptname" YourNameSpace;;MyClass.new
PYTHON WAY:
class MyClass; def method1(arg) if arg == this; do this elif arg == that; do that else; do that from scriptname import MyClass instance = MyClass()
First thing you will notice is how clean Python code looks to the eyeballs. No need to declare a module, The script IS the module. Now you have a nice clean namespace and did not even have to worry about it! Also notice Python does not use an ugly and redundant "end" statement.
This is just a very simple syntax comparison, wait until you try regular expressions, or string formatting, or list comprehensions (Oh wait, Ruby can't do that one).
Ruby looks too much like Perl. If you like S&M, well i guess Ruby is your language. If you want to get things done in the easiest and most painless way, Python is your common sense approach to everyday programming! Which makes it the perfect scripting language
-
@remus said:
Are you a fan of python by any chance?
Maybe just a wee bit
@unknownuser said:
Although this doesn't require a language I know having the ability to record and save a set of proceedures as a macro (while building a model) would be useful and could be a replacement for a lot of simple rubies.
I very much agree for those needing a simple repetitive action or what-not. But here again you will be limited. You could do so much more with a little bit of code. Not only that, learning a few things about programming can be transfered to automating tasks on your machine, and/or other scripting languages/programs.
Programming is not rocket science, and scripting of an API is nothing more than saying to SU "Hey, do this if this condition: else do that". The base code is already there, all you have to do is call the methods(). Just as your car is already designed, engineered, and built for you, so is the SU API. All you have to do is put a little gas in, turn the key and go! It is really not as hard as you think. But i think the barrier here is Ruby. (see next section)
@pixero said:
How about a thread with ruby programming tutorials for everyone?
Very good idea, and I am already two steps ahead of you. I have started a tutorial for non-programmers. The main purpose is to get them over the initial "hump" quickly and show how easy it really is to write useful scripts. I have postponed it for now because i found as i was writing the tut, how teaching/learning would be so much more simple if Python were available.
SketchUp is changing the world of 3D modeling much the way Python changed the world of programming. I see a great future for this software. It is evolving rather quickly, and has brought many people to the wonders and joys of the modeling world(novice and professional alike). I only want to guarantee this future upwards evolution by giving people the common sense tools they need to wield the full power of this great application. SU is truly the only software i have seen that can carry the title of "21st century software"
The combination of Sketchup's intuitive and ground-breaking UI, coupled with the common sense approach and simplistic elegance of Python will be an unstoppable force. Not only will this expand SketchUp's influence, but will give a SketchUp user the complete power they need over the application -- in the quickest, and most painless way.
SU users need a language that...
1.) is easy to learn
2.) is widely supported
3.) is open source
4.) Has ample, AND clear documentation (most important)*and if you can teach good programming principals in the process, what a plus!!
Python fits all these and then some. Modelers need to concentrate on modeling, but they also need the power scripting brings, and a lot of you do not realize this power yet, but i want to change that. If Python were here i would not need to write a tutorial, i would just point you to one of the great tuts that already exist out there.
For those that don't know anything about either language i will explain. Ruby and Python are by far the only two "very high level" languages that exist today(IMO) -- High level simply means easy to use.
Ruby is a language with lots of shortcuts and has many ways to do the same thing. But these shortcuts make learning the language painful for non-programmers, and even experienced guy's like myself. This is because there are more rules to learn, more syntax, and two scripts can look wildly different. Ruby is a direct descendant of Perl(a very powerful, but VERY cryptic language). If you are a Perl programmer, you would love Ruby.
But if you are a non-programmer or a C programmer, you will find Python very easy to learn. I believe Python is the perfect scripting language for any software. Python revolutionized programming the way SU revolutionized modeling. SU is made for modelers, not professional programmers, so I believe Ruby was the wrong choice in this regard. Not everybody wants to, or needs to script SU. But for those that do, i want to give you a fighting chance. The pros can learn any language, this is about making SU more useful to EVERY SINGLE USER.(and lots of pro's love Python too)
Let me tell you the perils that a SU user faces on his quest to learn SU scripting. The first thing this user must overcome is his sense of self worthlessness. The "I can't possibly write code" syndrome. Once this person finally builds enough self courage to overcome this monster, a new and more powerful one awaits around the corner. Poor documentation. I am not just talking about the SU API(which is better than most API's). This extends well into the world of Ruby itself. I have yet, in my months of looking to find a decent tutorial for the Ruby language that i can suggest for struggling SU users. There exist no Ruby tutorial that will ease a new programmer into the language. The SU API docs have some shortfalls too. They are missing some real good examples, and the links to example scripts are broken! This is a travesty to all new SU scripters.
PYTHON HISTORY
Python came into being around 1991 by a computer science genius named "Guido van Rossum". This man is truly a man before his time(currently works at Google). Python revolutionized the world of programming and showed other languages how easy programming should be. Python promotes good coding styles by indentation, syntax is clear, and choice of keywords is perfect. I like to think of Python as simplistic programming elegance. No other high level language can compete with Python.There are literally hundreds, and i would say even into the thousands, of good free tutorials across the web for Python for all levels(beginner to pro). Not only is the language easy to learn, you will never be without clearly written tutorials for this language. The community is huge, and many people follow this language. Python is by far the easiest of all languages to learn for non-programmers and just as powerful as any other high level, i can speak from experience.
Hopefully people will come to their senses and demand a change or the inclusion of the Python programming language next to the Ruby API. For it will be for your benefit SU users.
PS: Did i mention that Python is Google's official language of choice. That Google uses Python in their search engine and applications. Python is also used by Nasa, Industrial Light and Magic, and many more respected people. It pretty much runs YouTube.
check here for more details
http://www.python.org/ -
@unknownuser said:
OK, I'll bite.
C++.
For processing intensive scripts, the speed would be awesome.
Todd
OK Todd, Show the good people here a hello word program in C++ and then in Ruby and Python.
If you want to write a...
a.) OperatingSystem
b.) 3D game of the year
c.) Graphic Software(SU)
d.) Device Driver
...then C++ is your language.It would take hundreds of lines of code to write even the simplest of scripts. And you would need to compile a version for every platform.
Sorry Toddy, low-levels are just not any good for scripting. With that attitude why not just use assembler? Or wait, i have an idea, just write binary 1's and 0's, and spoonfeed them to your processor
PS If you are really serious about scripting SU with C++, I hope at least you have a good carpal tunnel specialist on retainer
-
@david. said:
JJ, ...Threads like this will not end in anything but wasted time and hard feelings.
I carry no hard feeling towards anyone. I simply state my points, that's all. I welcome everyones point-of-view, even if they are totally against me. Free speech rules in my world.
It is good to question the status quo from time to time. Revolution is a very natural and needed process. And if you have to storm the palace and "let some heads roll", Oh well. It will be for the betterment of all mankind.
The advancement of knowledge/Technology is a never ending pursuit. Grow complacent and you shall grow extinct!
-
Sketchup challenge
Ruby(0): +1, you can use it with Sketchup
Ruby(1): +1, it is used by many people to improve SketchupSketchup challenge - result:
Ruby 2:0 PythonConclusion: I think, I should use Ruby to improve Sketchup instead wasting time explaining all the advantages of progamming language XYZ. Let's call it: Pragmatic programming.
Btw. The rubyfied school example:
class SchoolMember def initialize name, age @name = name @age = age end def to_s "Name; \"#{@name}\" Age; \"#{@age}\"" end end class Teacher < SchoolMember def initialize name, age, salary super name, age @salary = salary end def to_s super + " Salary; \"#{@salary}\"" end end class Student < SchoolMember def initialize name, age, marks super name, age @marks = marks end def to_s super + " Marks; \"#{@marks}\"" end end t = Teacher.new 'Mrs. Jones', 40, 30000 s = Student.new 'Jack', 23, 75 [t, s].each { |m| puts m }
Hope, you like the short lines.
azuby
-
@jessejames said:
PYTHON GUI
Also Python has a built-in GUI(Tkinter). Tkinter is a very easy to use GUI toolkit, which contains all the main widgets a GUI needs, built right into the language. How would you like to have that on board for ya scripting pleasure, eh?here is a Tkinter program that contains a button widget
> from Tkinter import * > root = Tk() > def call(); print 'Hello SketchUp' > Button(root, text='Press Me', command=call).pack() > root.mainloop() >
That short piece of code creates a main window with a button that prints 'Hello SketchUp'.
Look, i want to improve this great software for everyone. The more people we have coding, the more ideas and improvements we can bring to SU. Let's empower all SU users!!
I have been looking for a better GUI solution. And quite frankly I'm disappointed that not more has happened with the Ruby API, since the release of SU7. It appears that Ruby is stuck where it is right now. And I'm not quite sure what Web Dialogs are going to do for SU going forward. I would like to hear from some of the other Ruby experts we have in this Forum. The attachment below may be a it ambitious but I would like to have the capability to produce such a GUI. And if Python has that capability, I'm on board. Modo is capable of using Perl and Python scripting. Why should SU not embrace Python as well?
Advertisement