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

    Posts

    Recent Best Controversial
    • RE: Clear the ruby window

      @jim said:

      Win32API allows you to call Windows API functions.

      Win API functions are some of the fundemental behind the scenes functions used by Windows itself to manage the Windows GUI.

      MS doesn't advertise them because many can be used to affect other peoples compiled programs. (In this case they are being used to manipulate the Ruby console.

      They can be difficult to learn to use properly as how they interact with each other is not published in depth. One fairly good source is:
      http://allapi.mentalis.org/apilist/f.shtml (Note the alphabetical list at the top of the web page.)

      FindWindow is used to locate a top level window by ClassName and WindowTitle. It returns a pointer to the found window.

      Windows pointers are created and destroyed constantly so you cannot save and reuse the value once you glom onto it.

      FindWindowEx is used to find Child or Sibling Window handles.
      Just about every Graphical object in Windows is a window. Textboxes, Listboxes Etc...

      SendMessage is an all purpose tool used to manipulate a Window.
      The kind of manipulation is defined by a list of MessageCode Constants.
      0x000C is the SET TEXT message. There are many more.

      The Win32API module that you are referencing in Ruby must remap some of the parameters as there appear to more than the functions normally take.
      In this case I believe that 'N' stands for number which would be the window pointers and P stands for a String Pointer. (Course that is just a guess.)

      posted in Developers' Forum
      G
      Gruff
    • RE: Iron Ruby?

      @cjthompson said:

      Ruby in Steel just allows you to type .rb files in VS, although I think I misunderstood you. Are you trying to find an IDE to write scripts or are you trying to find a way to connect .NET Applications with Sketchup?

      First:
      I would like to use the best IDE for the job.
      A Good Debugger with the ability to step througb code and hopefully a level of intellisense. VS should provide both.
      Even if I have to write pseudo modules that mimic the SU API I feel I would be miles ahead of using a text editor.

      Second:
      Of course I would like to find a way to drive Sketchup from VS. If it means I can use other VS languages so much the better. If it means I have to learn Ruby in VS... Less desireable from my standpoint but not out of the question.

      I've been poking around the Iron Ruby forum and it looks like IR is based on the Dot.NET framework and requires it to function. It also appears that Iron Ruby is not really ready for public consumption within VS at this time. They are still working toward version 1.00

      Cheers,

      posted in Developers' Forum
      G
      Gruff
    • RE: Iron Ruby?

      @cjthompson said:

      have you looked into Ruby in Steel? it's a VS extension for Ruby. I found the free version works well for me. I'm not sure what you mean by using the Windows forms tools, though.

      Isn't Ruby in Steel used to create Web based apps?

      Web programming is not area. I write Windows Desktop Apps.

      posted in Developers' Forum
      G
      Gruff
    • RE: Iron Ruby?

      @cjthompson said:

      After looking some more into it, Iron Ruby can run .NET code. But because Sketchup uses it's own API you can't attach iron ruby, as far as I know.

      SketchUp exposes a SketchUpLib that supposedly you can access through C++ which MS VS Supports along with C#. I am thinking that there might be a way to latch onto the SketchUp Ruby API with a work around. Perhaps a C++ Interop wrapper that Iron Ruby could exploit.

      The main reason I want to get an understanding of Iron Ruby is so that I can use the VS Debugger with Ruby and someday... (Hope against Hope) Intellisense. Which is a huge step forward twards learning a language in OOP.

      Another reason is that I am comfortable with the MS Visual Studio IDE. Finally I would hope that one could use Ruby with the Windows Forms tools.

      posted in Developers' Forum
      G
      Gruff
    • Iron Ruby?

      Anyone experiment with Iron Ruby?

      I'm looking for someone to lend a hand with setting it up on my PC.
      I have VS.NET 2008 Standard Edtion. (Comes with VB & C#)

      Thanks,

      posted in Developers' Forum
      G
      Gruff
    • RE: Where to Start with Ruby?

      Read Chris Pines Tutorial and put this cheat sheet together for myself.

      ==== Ruby for VB Programmers ====

      --- Variables ---
      All variables are variant objects.
      Variables do not have to be declared before use.
      Variables are not formally declared. (No Dim statement).
      As variants they may be re-assigned any data type at any time.
      Variables that are assigned strings or numbers have methods. (As in VB.NET).
      Variables that are spelled the same but with different letter case ARE BY DEFINITION different variables.
      Variables must be assigned names beginning with a lower case letter
      Ruby --- VB
      Nil ---- Nothing

      --- Conversion methods ---
      to_i = String to integer
      to_f = String to float
      to_s = Integer or float to string, Concantinates elements when used with string arrays.

      --- Strings Manipulation ---
      Literal Strings are denoted by single quote ( ' )
      Backslash is an escape character: ' results in single quote. (\=)
      Double quoted text is a more flexible form of string defintion. (Inserting and formating)
      Ruby --- VB

      • ------ & ------------------------ Concantination
      • ------ Str(<string>, <count>) --- Repeat Char/String

      ------ ' ------------------------ Comments

      --- Operators and Comparison Operators ---
      Ruby --- VB
      ** ----- ^ ----- Exponent
      % ------ Mod ----- Modulus
      == ----- = ------ (Comparison) Equivalent
      != ----- <> ----- (Comparison) Not Equivalent

      --- Bracket Characters ---

      denote an array.

      Curly Brackets { } denote a hash
      Parenthisis ( ) used in a formula or logical statement work as they should but are optional for methods

      --- Hashes / Dictionary ---
      Define as you would an array but with curly brackets and a key.
      myList = {}; myList{'Bob Mitchell'} = '54823-11'; myList{'Phil Brown'} = '23872-08'; #Etc...

      --- Arrays ---
      Arrays are denoted by square brackets rather than parenthisis
      Arrays are zero based.
      Arrays elements do not have to be all the same type.
      Arrays as objects also have methods. (Push, Pop,Last, Length, Sort, Etc...)

      --- Loops ---
      Arrays have an interator method: While Loop myArray.Each do | <variable> | ... End
      While <Statement True> puts <variable> puts <variable> end

      --- User Methods ---
      Last variable or Return <variable> Returns value
      Ruby ----- VB
      Def( ) --- Sub( ) or Function( )

      --- Classes ---
      Any class may be extended including Ruby's supplied classes.
      The new method (Implied) is required for object instantiation.
      An Initialize method may be declared inside a class.
      The Initialize method can take user parameters. these parameters are required after the <Class>.new method.
      Properties are defined by the use of the @prefix on variable names.
      local variables are private to class
      Private is a Class keyword in Ruby that defines all methods below it as internal to the class.
      Ruby --- VB
      Time --- Date

      posted in Developers' Forum
      G
      Gruff
    • RE: Where to Start with Ruby?

      Case sensitive? Ouch. I can see that giving me major heart burn.

      Does Sketchup have something similar to Excel's Record Macro?
      Such that I might dump the steps by which something was constructed?

      posted in Developers' Forum
      G
      Gruff
    • RE: Where to Start with Ruby?

      Thanks to 'NewOne' I managed to get Notepad++ up and running with the bridge link to Sketchup.

      Modified the Box.rb example as a simple test. Works nice.

      I ran a search for SketchUp Ruby Debugger on this forum.
      Found something by 'Pecan' but the page will not display.

      It says I do not have the rights to view the page. ???

      In any case I have a couple of beginner questions about box.rb script.

      I notice that the require 'Sketchup.rb' uses single quotes while other references to literal strings use double quotes.

      What is the distinction between the two?

      posted in Developers' Forum
      G
      Gruff
    • RE: Where to Start with Ruby?

      Thanks everyone for all the advice.

      So there is no programming environment with a debugger for Ruby inside Sketchup. (Similar to VBA inside Solidworks, Inventor, Autocad, IntelliCad, Excel, Word, Etc...)

      Sigh

      Does Sketchup Expose their API externally for other languages?
      (Or for that matter stand alone Ruby for Windows.)

      I notice that when I pull up VB6 there is a reference for the Sketchup Library. I cannot instantiate the SU Application object though. No errors. the object just returns a value of nothing. Wierd.

      Private Sub Command1_Click()
        Dim oSU As SketchUp.SkpApplication
        Dim oDoc As SketchUp.SkpDocument
        
        Set oSU = SketchUp.SkpApplication
        Set oDoc = oSU.ActiveDocument
        MsgBox oDoc.Description
        
        Set oDoc = Nothing
        Set oSU = Nothing
      End Sub
      
      posted in Developers' Forum
      G
      Gruff
    • Where to Start with Ruby?

      I would like to start learning Ruby.
      Where do I start? Where to I find an interpreter for Windows?
      An IDE?

      Saddly my only experience is with Microsoft VB.

      posted in Developers' Forum
      G
      Gruff
    • 1
    • 2
    • 3
    • 4
    • 4 / 4