sketchucation logo sketchucation
    • Login
    1. Home
    2. jessejames
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 166
    • Groups 1

    Topics

    • J

      Ruby scripts lack style

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      24
      0 Votes
      24 Posts
      1k Views
      J
      @thomthom said: Watch it Jesse - behave yourself. You will get nowhere fast with this attitude. What attitude? @thomthom said: Chris has a very good point: where are your examples? Where is the work you have done for the community? Don't try to discredit me by questioning my resolve ThomThom. I have been preaching freedom to slaves on this list for ~1.5 years. I have been trying to open your minds to new possibilities, out of the box thinking styles, clean coding styles, better API, better languages, etc, etc. But most importantly i have tried to bring freedom to the slave mindset around here. @thomthom said: If you really want to be helpful and guide people - then start producing something yourself. Provide a starting point of what you want to achieve - then you might get people listening. Sure i want to help, but with all the negative energy why should i? Instead trying so hard to discredit me, how about saying Yes, i would like to help keep the code base clean and written in a proper style. Yes i would like to make the API better. Yes i would like to make the Docs better. @thomthom said: Right now, and given your history, I can't help but feel that you are trolling and have no intention do any other than that. I really hope you are not one of these people that are entertained by starting quarrels. I can't believe you would call ME a troll. All i have ever done was come here to help. Givin out my spare time and for what? Just because you don't agree with my statements does not mean i am a troll.
    • J

      Idea: show console on script error

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      13
      0 Votes
      13 Posts
      683 Views
      thomthomT
      The docs should really be mentioning this.
    • J

      Ruby Console hell... no more!

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      8
      0 Votes
      8 Posts
      1k Views
      J
      @unknownuser said: Would now be a bad time to point out i actually quite enjoy scripting in SU? Great punch line remus . Your keen sense of comic relief no doubt qualifies you as a mod. I always seem to get a good giggle from your posts. But seriously folks we have an issue here. Some people will say that tring to improve SketchUp is a lost cause. Well that may be slightly true but we cannot give up already. I think a lot of newer scripters (some may never had experianced with scriping before) are now joining the fray but have found major workflow issues that quite frankly are just impossible to overcome alone... @unknownuser said: Wait a minute Jesse! uhhh, excuse me a moment, Yes Joe! @unknownuser said: Jesse, why in the world would some people feel that SketchUp scripting (the way it stands now) is a good system? We all know it sucks eggs! Thats a good question Joe and one has many complicated and reveiling answers. You ever hear the expression "more than meets the eye" Joe? I think for one people just get so accostomed to something that the "fear of change" simply (in their minds) out-weighs the hassles they currently endure. So they just choose to endure it. What about the "Helsinki Syndrome", have you ever heard of that one Joe? Well some correlations can be drawn between that state of mind and the current state of SketchUp scripters. If you where to ask them privately you'll find that they are just scared Joe, they feel helpless, and like little children they need guidance to free their minds from this hell-state. For example, lots of people use Microsoft OS even when far better (and free) choices are available. But what is most entertaining is when you ask them WHY? Why do you choose to use a proprietary OS when a number of free alternatives exists? It's like a deer caught in headlights Joe, don't even waste your time. But sadly there is also evil afoot in the form of FUD mongers and jolly green greedies. Some people have capital gains to be made from SketchUp scripting and they will do anything to keep their piece of the pie even if that means stepping on the little people (thats you and me Joe) to get to where they are going. Sometimes just by making a system uncomfortable you can keep the noobies out and therefore curtail competition. This system has been successfully employed by many major corporations! But we are not here to talk about M$'s evil world domination practices, we are here for the wonderful SketchUp. @unknownuser said: This is all very sad Jesse , i'm beginning to lose faith in my fellow SketchUp brothers and sisters. Yes i know, but i believe in growth Joe, and i believe in change. i believe we can cultivate these confused chaps into productive scripters that produce SketchUp scripts with much ease. No more shall they lament the torturous trappings of the Ruby Console. No more shall they endure 3rd party patch-ware and windowing multiplicity! Heck, they may even start to enjoy this!
    • J

      Ruby's global nightmare!

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      26
      0 Votes
      26 Posts
      1k Views
      M
      jessejames, @jessejames said: Am i moving to quickly for ya? Having written code in Python, Ruby, C#, Java, JavaScript, various dialects of Basic, and C++, probably not. Also, having a CompSci prof in the late '70's always wax on about the elegance of Pascal conditioned me to the large distinction between 'elegant' when finished, vs easy to reach 'finished.' The Python features you’re referring to would be considered simple syntax conventions by most programmers, and, hence, trivial. I'll respond anyway. Namespaces – Lets say I'm working on a real project, and production code will be a minimal set of files. As the code is being created, it's often helpful to have the code being worked on by itself, in a separate IDE container. Once complete, it's moved into another container that has finished code. Often, that IDE container is a file. I don't want the namespace changing if I move code between them. End vs indent – I've written code where there may be a lot of end statements, one after the other. Also, indenting is commonplace today. Hence, it would seem that Python's removal of statements like 'end' would be helpful, even though almost all other languages use them. Conversely, when writing code, I often leave test/debug statements on the left margin as a marker that I can delete them when the code works. I can't do that in Python. I might suggest that you read a few books like 'Design Patterns' by the 'Gang of Four' to get an idea of what the real distinctions are in programming languages. Real distinctions affect whether a framework can be moved/ported to another language, as opposed to simple syntax conventions. I might also suggest that there's plenty of others forums for your concerns. This one is for Ruby used in SketchUp. BTW, I'm ignoring the flame, otherwise we might get into that layman concept... Greg
    • J

      Ruby Console woes

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      17
      0 Votes
      17 Posts
      866 Views
      J
      @martinrinehart said: Let's do something about this. Hello Martin, I knew enlightened minds like myself existed in SketchUp land, but just did not have the physical evidence until now. Well that's still only less than a handful of Python coders i have a count of... Myself, Greg, You, and a very interested fan tomot who stood by me last year through trials and tribulations and got nothing in return. And there where a few other seeming interested parties... (Sorry if i left anyone out) hmm, not enough to start the revolution, but it's a start nonetheless! But seriously, Python IDLE is a great yardstick to judge entry level IDE's on. If you like "fancy" IDE's, well you will be disappointed with IDLE. But IDLE is built for one thing, introducing noobies to the Python programming language in a very comfortable way. So we all know that a new multi-line interactive console is desperately needed. I can't see why SketchUp dev would not alow us to build this for them, and then they could throw it in the source distro. But we must get this into the core SketchUp release. If someone just releases another plug-in and that ugly Ruby console stays in SketchUp then we might all just as well download one of the already existing Ruby IDE's out there. But a real Ruby SUIDLE("swiddle" or "sweedle") OR SUIDE("sweede") would be a god send for everybody! And Taking IDLE's modular approach we could start simple and just add to our hearts desire! The current Python IDLE weighs in a 1.53MB but a lot of this can be trimmed. Only the most important features are really needed... Minimum Features -syntax highlighting -bracket matching Icing on the Cake -code completion -object browsing -smart indent -call tips -"your wish here" But most importantly this whole redundant cycle of the current Ruby scripting experiance is quite laborious. Here is a short script that describes the process in painstaking detail... from patience import * from meds import Prozac, Asperin rants = [ 'OMG!, not again!', 'rats, here we go again!', 'Somebody just shoot me already!', ] def lament(self); self.sanity -= 1 print random.choice(rants) def medicate(); self.swallow(Prozac, Asprin) count = 0 while self.sanity > 0; count += 1 if count % 5 == 0; self.medicate() self.write_or_tweak_code() try; su = SketchUp.open() try; su.test_script_functionality(); break except ScriptRuntimeError; self.lament() except ScriptLoadError; self.lament() finally; su.close() print 'Finally! \ It only took %d cycles to complete this task *sarcasm*' %(count) ...needs to go the way of the Dodo.
    • J

      What if we could use <blank>?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      63
      0 Votes
      63 Posts
      4k Views
      thomthomT
      @unknownuser said: I'd rather they fix a bug or two in the one we got. I second that. I'd be more than happy if SU8 only addressed bugs.
    • J

      Ruby namespace?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      24
      0 Votes
      24 Posts
      4k Views
      J
      @dan rathbun said: (7) The methods within the 'sketchup.rb' script were intended (for the most part,) to extend developer's use of the classes Module and Class. BUT they were not wrapped within the proper namespace(s) in the script, and so get defined as methods of Object, and so become inherited by ALL classes, such as the Numeric classes, the Sketchup::Entity subclasses, the Geom::subclasses, etc. where they will NEVER be used. Very informative post Dan! But i disagree that the problem boils down to a lowly script. This problem is inherent in the design of the Ruby language itself! @dan rathbun said: Open a new model, draw something simple a cube, select a Sketchup::Face object. Switch to the console, type (all 1 command): **Sketchup.active_model.selection[0].private_methods(true).sort.join("\n")** Look at the list, you will see that the Face object has inherited as private methods (which you will never call from outside the object,) all those methods defined in 'sketchup.rb'! What kind of drain of memory will this have when you get to a model that has tens of thousands of Entities it it? Exactly! this is what most of the folks in this thread have missed! Ruby just blindly sucks in every method it can find! In Python we have a system of using single and double leading underscores to indicate private and public methods. It's not a forced convention but we all understand and use it like a forced convention. But even more importantly Python objects have a dir "special method" that will return the appropriate list of methods when using the introspection function dir(obj). Python also (as i have mentioned time and time again) uses every file as "module" automatically so none of the name clashing occurs unless you import the module in a certain manner.
    • J

      CALLING ALL MATRIX GURUS, HELP! , please :)

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      11
      0 Votes
      11 Posts
      1k Views
      J
      jzer7, Thanks so much, but no luck. I going to post a section of the script i am parsing this data from, maybe it will help... import Blender from Blender import Camera, Object, Scene, NMesh from Blender import Mathutils from Blender.Mathutils import * cur = Scene.getCurrent() #Camera Parameters c0001 = Camera.New('persp') c0001.lens = 49.739047 o0001 = Object.New('Camera') o0001.name = "voodoo_cam1" o0001.setMatrix(Mathutils.Matrix([0.999938,0.001129,-0.011103,0.000000], [0.001072,-0.999986,-0.005202,0.000000], [-0.011108,0.005189,-0.999925,0.000000], [1.054297,1.571880,-8.966838,1.000000])) o0001.link(c0001) cur.link(o0001) c0002 = Camera.New('persp') c0002.lens = 49.739047 o0002 = Object.New('Camera') o0002.name = "voodoo_cam2" o0002.setMatrix(Mathutils.Matrix([0.999943,0.001132,-0.010635,0.000000], [0.001076,-0.999985,-0.005294,0.000000], [-0.010641,0.005282,-0.999929,0.000000], [1.071295,1.559580,-8.822482,1.000000])) o0002.link(c0002) cur.link(o0002) ################################################## # [snip] # many, many more cams are created and then comes # some IPO curve data ################################################# #Render camera animated with IpoCurves crender = Camera.New('persp') crender.lens = 35.0 crender.setDrawSize(1.0) orender = Object.New('Camera') orender.name = "voodoo_render_cam" orender.link(crender) cur.link(orender) cur.setCurrentCamera(orender) ipo = Blender.Ipo.New('Object','render_cam_objipo') orender.setIpo(ipo) locx = ipo.addCurve('LocX') locx.setInterpolation('Linear') locy = ipo.addCurve('LocY') locy.setInterpolation('Linear') locz = ipo.addCurve('LocZ') locz.setInterpolation('Linear') rotx = ipo.addCurve('RotX') rotx.setInterpolation('Linear') roty = ipo.addCurve('RotY') roty.setInterpolation('Linear') rotz = ipo.addCurve('RotZ') rotz.setInterpolation('Linear') camipo = Blender.Ipo.New('Camera','render_cam_camipo') crender.setIpo(camipo) lenscurve = camipo.addCurve('Lens') lenscurve.setInterpolation('Linear') locx.addBezier((1,o0001.LocX)) locy.addBezier((1,o0001.LocY)) locz.addBezier((1,o0001.LocZ)) rotx.addBezier((1,o0001.RotX*18/3.141593)) roty.addBezier((1,o0001.RotY*18/3.141593)) rotz.addBezier((1,o0001.RotZ*18/3.141593)) lenscurve.addBezier((1,c0001.lens)) locx.addBezier((2,o0002.LocX)) locy.addBezier((2,o0002.LocY)) locz.addBezier((2,o0002.LocZ)) rotx.addBezier((2,o0002.RotX*18/3.141593)) roty.addBezier((2,o0002.RotY*18/3.141593)) rotz.addBezier((2,o0002.RotZ*18/3.141593)) lenscurve.addBezier((2,c0002.lens)) ############################################ # [snip] # many more lines of IPO # the only thing left is "point cloud" data # which i am leaving out. # The last thing in the script is this... ########################################### # Scene Helper Object scene_dummy= Object.New('Empty','voodoo_scene') scene_dummy.setLocation(0.0,0.0,0.0) cur.link(scene_dummy) scene_dummy.makeParent([orender,ob]) scene_dummy.setEuler((-3.141593/2, 0.0, 0.0)) scene_dummy.SizeX=0.2 scene_dummy.SizeY=0.2 scene_dummy.SizeZ=0.2 Maybe this helps, maybe not ?? the lines don't wrap correctly in the code tags so it mucks up the code a bit
    • J

      Create and move between muti cameras

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      8
      0 Votes
      8 Posts
      649 Views
      J
      Thanks a lot Phil, Although i may try to write a flight path script myself. I am very interested in completing my study of the Ruby API, and things are coming along faster every day! I love this program!
    • 1 / 1