What if we could use <blank>?
-
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?
-
Now please don't all beat me at once...
We use PC's, I'm a very part time coder, most of my time I just use software but I occasionally code macro's for -
Inventor
AutoCAD
Word
ExcelWhat do they have in common (currently)-- VBA
Four pieces of significant software, one basic language for the macro's.OK, I know I won't get VBA on SketchUp, but it would be really nice to get commonality of macro programming language across major applications. Probably no chance though.
P.S. - I have used Ruby on SketchUp
-
Tomot - have you seen wxWidgets? Peter Ellis put out support for it for use under SketchUp back in October.
Blog article: http://sketchupapi.blogspot.com/2008/10/wxsu-and-you.html
-
@avariant said:
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
You really need to check out Python. Your C mind will love it. Python supports full OOP and True procedural programming. No need to use instance vars (@var or @@var) when writing procedural code. Python is fully OOP. Here is a simple example of inheritance.
NOTE: the return line in the str() method is wrapping due to this groups display of text. this should be one line
class SchoolMember(); def __init__(self, name, age); self.name = name self.age = age def __str__(self); return 'Name;"%s" Age;"%s"' % ( self.name, self.age) class Teacher(SchoolMember); def __init__(self, name, age, salary); SchoolMember.__init__(self, name, age) self.salary = salary def __str__(self); return '%s, Salery;%d' % ( SchoolMember.__str__(self), self.marks) class Student(SchoolMember); def __init__(self, name, age, marks); SchoolMember.__init__(self, name, age) self.marks = marks def __str__(self); return '%s, Marks;%d' % ( SchoolMember.__str__(self), self.marks) t = Teacher('Mrs. Jones', 40, 30000) s = Student('Jack', 23, 75) for member in [t, s]; print member
And here is the output from that session:
Name;Mrs. Jones, Age;40, Salary;30000 Name;Jack, Age;23, Marks;75
As to your liking of extending Ruby with C, the same can be done with Python using built-in ctypes. But for those who do not know C, or do not want to know C, Python has something much better, Pyrex, and Pysco.
@unknownuser said:
Pyrex -- is a language specially designed for writing Python extension modules. According to the Pyrex Web site, "It's designed to bridge the gap between the nice, high-level, easy-to-use world of Python and the messy, low-level world of C." Almost any piece of Python code is also valid Pyrex code, but you can add optional static type declarations to Pyrex code, making the declared objects run at C speed.
@unknownuser said:
Psyco -- to keep it very short -- is a just-in-time (JIT) compiler of Python code into (x86) machine code.
Python has everything a non-programmer to pro needs. A very highlevel language using common sense approach to programming, extendable with C, and easily flys with Pyrex and/or Pysco!
-
I thought the thread was about using <blank>, not a decoy to try to convert from Ruby to python.
As for the tutorials, I am doing a nice ruby tutorial. Its pretty good for the syntax. But like others have stated, it would be easier if there were tutorials based entirely on a SU workflow. Its hard for my brain to understand how to implement some of the stuff I'm doing in the tutorial into SU. So more SU based ruby tuts would be grand. So quit jabbering and get making
btw, I've only taken 1 programming class and it was pascal. I don't really care what SU uses, but if it switched off of ruby right after I take the time to learn ruby, I'll be pretty upset.
Chris - not a programmer, just a dreamer.
-
@tomot said:
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.
Hello tomot,
You could easily write up a GUI for that with a very minimal amount of code using Tkinter, i will even write up a clone example if you want to see it!(send me a PM)Python also has wxPython module available that will give you all the great and awesome power WX provides. Of course WX takes quite a bit more to code than Tkinter, but it is a very powerful toolkit for professional quality GUI's
The great thing about Tkinter is the "every day" SU scripter(and not just the pros) can write GUI code easily, and it is built right in to the Python language!
@tomot said:
Modo is capable of using Perl and Python scripting. Why should SU not embrace Python as well?
I can assure this group, if we could get Python into SU, people would love it. Let the users decide what language is better (heck let them have both!). Python has the docs, the built in GUI, and has been proven since 1991.
And you have my commitment to build the Python API. If some of you want to help out, great. If not i will make this happen and you can enjoy the benefits. These two languages are the only choices for scripting, but Python gives you the extra advantages that Ruby simply can't.
If we don't get Python. Some serious effort needs to be made to create a SU Ruby beginners tutorial, SU API doc improvements, a multi-line Ruby console, and a real GUI toolkit for Ruby! Web dialogs are no going to cut it. We need real File Dialogs, Message Boxes, Widgets, etc... and we need them NOW!
-
Well, since your working on your tutorials, I'll throw in my requests.
I'm following the tutorial here:
http://pine.fm/LearnToProgram/
Its great. But it explains ruby as a language for stuff I don't care about. so its helped a bunch with the syntax, but for me I'd rather have tutorials that help walk me through the same steps using SU as the base, instead of the command prompt.
So do that and we'll be ready to roll.
Chris
-
@chris fullmer said:
I thought the thread was about using <blank>, not a decoy to try to convert from Ruby to python.
This Thread is about giving SU users the common sense tools they need to use SU to it's fullest capabilities. I want to hear everyones opinion on this subject. SU noob to pro! If you are with me, or against me, does not matter.
@chris fullmer said:
As for the tutorials, I am doing a nice ruby tutorial. Its pretty good for the syntax. But like others have stated, it would be easier if there were tutorials based entirely on a SU workflow. Its hard for my brain to understand how to implement some of the stuff I'm doing in the tutorial into SU. So more SU based ruby tuts would be grand. So quit jabbering and get making
btw, I've only taken 1 programming class and it was pascal. I don't really care what SU uses, but if it switched off of ruby right after I take the time to learn ruby, I'll be pretty upset.
Chris - not a programmer, just a dreamer.I am working towards a solution as we speak.
One solution would be to fix Ruby. This is a grand undertaking because this is a Ruby problem ,and the SU community has little control over Ruby direction. A lot must be done here -- A good introductory tutorial aimed at SU Ruby scripters with no programming experience, and dive-in tut for experienced programmers new to Ruby SU scripting, a multi-line Ruby console, real GUI support, and improvement of the current API docs. So far SU has been around for 9 years and none of this has happened yet. WHEN IS THIS GOING TO HAPPEN? WHERE IS THE CALLING FOR IT? WHERE IS THE COMMUNITY ON THIS SUBJECT?
The other solution would be to INCLUDE a Python API in SU. Python has the docs, and the built-in GUI already. It would be disastrous to wake up tomorrow with Ruby gone and Python in it's place. Many people have invested hours, days, months and years building awesome scrips and plug-ins for SU. That's why I want to ADD Python, NOT replace Ruby. I want to give SU user the choice here because i believe Python has much more to offer. Some people will stay with Ruby, most(i think) will join the Python bandwagon. All of this will be for the betterment of SU. That is my point here.
-
I see, you do NOT care about Ruby, jj. You do not look for information - instead YOUR only wish seems to be having Python for improving Sketchup. No problem with that, but it is only YOUR wish.
Ruby has GUI support for:
TK
wxWidgets
Qt
GTK
Fox
WebDialogs for SketchupMulti line consoles:
WebConsole - http://sketchuptips.blogspot.com/2007/08/plugin-webconsolerb.html
d/Code - http://www.errorinitus.de/ => SoftwareYour first steps could be using a bridge between Ruby and Python (or use the Sketchup SDK to write your own lib):
Ruby/Python - http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/index.html
Ruby-Python-Bridge - http://www.vyperlogix.com/ruby-python-bridge/
pyRuby-Python-Bridge - http://pypi.python.org/pypi/pyRuby-Python-Bridge/1.7azuby
-
@azuby said:
...
Ruby has GUI support for:
TK
wxWidgets
Qt
GTK
Fox
WebDialogs for SketchupAre any of these built-in?
@unknownuser said:
Multi line consoles:
WebConsole - http://sketchuptips.blogspot.com/2007/08/plugin-webconsolerb.html
d/Code - http://www.errorinitus.de/ => SoftwareI am talking about the Ruby Console in SU. Ruby has many good editors but not embedded directly into SU.
@unknownuser said:
Your first steps could be using a bridge between Ruby and Python (or use the Sketchup SDK to write your own lib):
Ruby/Python - http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/index.html
Ruby-Python-Bridge - http://www.vyperlogix.com/ruby-python-bridge/
pyRuby-Python-Bridge - http://pypi.python.org/pypi/pyRuby-Python-Bridge/1.7This is exactly how i want to start. The reason for this thread was to test the waters for SUuppers who would be interested in a Python API. From here i plan to get Python talking to Ruby, build support and see where it goes from there. Are you interseted in having more choices azuby?
-
Azuby,
If you (or anybody for that matter) know of a highlevel language besides Python that has more quality documentation, stable built-in GUI, clear syntax, is easy to learn, widely known and accepted, has a future, and open source -- Please let me know because i will dump Python and crusade for that language religiously.My religion is not Python, my religion is any language that will give me the most production with the least effort and expenditures. Which is the definition of a good language. this is the 21st century, it's time to send some archaic, redundant languages off to their destiny of extinction. Let today's high-levels rule until the next generation of languages renders them obsolete!
-
So quit posting here and just go make the tutorials, and do your python stuff. Aint no one here stopping you.
Chris
-
Christopher,
I see a lot of rage in your posts. Maybe you are angry because you are having trouble learning Ruby, and taking that frustration out on me. It's OK, i can understand that . Ruby is not nice to a nuby.But there is light at the end of the tunnel Chris, one way or another i am going to improve SU for everybody. Maybe you should get involved and contribute some of your ideas instead of pitching temper-tantrums to those who are trying to improve this great software. Which will, in effect, make your learning process much easier, and your potential for success much greater.
BTW, I love your quote
-
I understand, why fight a losing battle?!
FYI: C and Python interact very well, you can optimize with C where needed.
Now you have the best of both worlds. The readability, maintainability, and clear syntax of Python, coupled the speed and low-level access of C.
WOW!, If you have as much experience as you say, then you would know that.
-
I think you mis-read my posts. No real temper tantrums here per se. I would like there to be more tutorials for ruby in SU for beginners. I'm working my way through it, but I know it could be better. I'm pretty sure that python wouldn't make it much easier though. I have plenty of good info on Ruby. Its just difficult for my brain to understand it in context with SU. I would have the same trouble with Python. Its ok though, I'll figure it out and all will fine. And I did give my ideas. Go get working on the tuts. Thats all that I want. I've seen you say repeatedly that they are in progress - great. So go finish them
Chris
Thanks for the complement on my quote. I put it on when I was a noob on the forums years ago. I liked it so I've kept it ever since.
-
I think if i where to ask a stranger for a favor, I would do it in a very humble way, and I would probably want to include a "please" or "thank you" somewhere in the conversation. What do you think Christopher?
As we speak I am creating a Group dedicated to a SU Ruby tutorial aimed at non-programmers. This tut will teach basic programming principals while writing scripts for the Ruby SU API. I am writing the tut all by myself at this time. You see i could just teach myself Ruby, and then look down on the others who don't know it, but i want to give back, and empower my fellow SU brothers and sisters.
I want people to learn and give back them selfs by adding to this tutorial as a community project. You see if everybody volunteered a piece of their time (instead of just gimme, gimme, gimme all the time) maybe the SU world would be a better place(9 years ago)? Eh Christopher?
-
Hi Jessetopher, sounds like you want me to contribute more to the SU community because I'm not holding my own and I don't know much about community involvement.
And don't worry about the tuts. I'm just giving you a hard time cause you're so verbose here on the forum. I'm sure they'll get done and they'll be great. So don't mind me, I'm probably just cranky from having to work all weekend long.
Chris
-
All this sounds interesting (apart from "bickering" ). Can you tell us when the first tuts are going to be ready. I am keen to get me going. Are you saying that you intend to make a bridge which would than enable people to use Python instead of Ruby?
-
@jessejames said:
I will smash this wall to pieces, and lead you into the promised land!
I look forward to it.
@unknownuser said:
Has anybody seen such commitment for teaching/improving the SU Ruby API in SU's 9 years??
SU has only had an API since v4, and i believe there have been incremental improvements with each new version of SU, although i wouldnt be able to tell you what they were.
Advertisement