sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Read Serial port or USB interface

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 8 Posters 2.7k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      morisdov
      last edited by

      on windows at least two ways to do this:

      1. use the ruby "Win32api.so" library to read data from a dll exposing public methods of these input devices. You can build this dll quite quickly with visual studio for example.
      2. "communicate" your input devices to an internet explorer page and then use Sketchup 6 new web-dialog functionality.
        http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html

      Moris

      1 Reply Last reply Reply Quote 0
      • A Offline
        alapalap
        last edited by

        Hello morisdov,

        @unknownuser said:

        1. "communicate" your input devices to an internet explorer page and then use Sketchup 6 new web-dialog functionality

        I have been tried your sugestion, but it's not clearly enough. I had created serial port appplication in VB6. I want to send string data "motor_on", then the motor starts running in sketchyphysics. Could you explain step by step please ?

        Regards
        alapalap

        1 Reply Last reply Reply Quote 0
        • A Offline
          alapalap
          last edited by

          Could somebody help me please ?

          1 Reply Last reply Reply Quote 0
          • J Offline
            jblively
            last edited by

            @alapalap said:

            Could somebody help me please ?

            Could you just use Ruby to write to a text file, and the have the VB app, poll and read the value from the text file and then do the communication to the port?

            Kind of a non-direct route...but should get you going.

            Joe

            1 Reply Last reply Reply Quote 0
            • A Offline
              alapalap
              last edited by

              To Joe : I am still confuse what you are saying. I am still beginner on it. May I know the detail ? or may be, where I can find the article of it in web ?

              1 Reply Last reply Reply Quote 0
              • M Offline
                MartinRinehart
                last edited by

                Highly likely that you can kludge something together and highly unlikely that the result will survive the next release of Windows or SketchUp. Can you solve the problem with a WebDialog? (The user clicks a "motor on" checkbox and you send "motor on" to sketchyphysics.)

                Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  @alapalap said:

                  I [have] created [a] serial port application in VB6. I want to send string data "motor_on", then the motor starts running in sketchyphysics. Could you explain step by step please ?

                  (1) get TBD's SketchUp Bridge ( sub.exe ) utility and install as he explains.

                  • Download SUBridge v1.1 from http://labs.plugins.ro
                    (2) write small ruby snippets, in a subfolder of Plugins, ie:

                  • .../Plugins/alap/motor_on.rb* .../Plugins/alap/motor_off.rb
                    (3) from your VB6 application, call the Ruby snippets, using Shell( )

                  • [url=http://msdn.microsoft.com/en-us/library/xe736fyk(VS.71).aspx:1u4emsd7]VB Shell function (click to read reference at MSDN.)[/url:1u4emsd7]* motor_on (VisualBasic)

                  
                  Sub motor_on()
                    Dim pID As Integer
                    pID = Shell("""C;\Program Files\Google\Sketchup 7\Plugins\sub.exe"" alap\motor_on.rb", AppWinStyle.MinimizedNoFocus)
                  End Sub
                  
                  
                  • motor_off (VisualBasic)
                  Sub motor_off()
                    Dim pID As Integer
                    pID = Shell("""C;\Program Files\Google\Sketchup 7\Plugins\sub.exe"" alap\motor_off.rb", AppWinStyle.MinimizedNoFocus)
                  End Sub
                  
                  • ...etc,.. etc. [There are only 2 lines in the code blocks above; the forum may wrap the long Shell line in a strange way, but it's all 1 line.]

                  P.S.: You may also want to have a look at TBD's SUDLL

                  • example (MS VC++6) on how to create a DLL and communicate with Sketchup Ruby
                  • [url=http://plugins.ro/labs/SUDLL.zip:1u4emsd7]Download SUDLL.zip[/url:1u4emsd7] from http://labs.plugins.ro

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    I think I made an error.. and meant to have the 2nd argument in the Shell calls be a Ruby statement, like: "load 'alap\motor_on.rb'" instead of just the rubyscriptname.

                    @TBD ??

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • tbdT Offline
                      tbd
                      last edited by

                      it was ok, the command line needs the .rb file that needs to be executed in the Sketchup context.

                      SketchUp Ruby Consultant | Podium 1.x developer
                      http://plugins.ro

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        Sofia Oliveira
                        last edited by

                        Hi! I am a student of electrotechnical engineering and i'm doing a project. I need a little help! How i get values from serial port to sketchyphysics?

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement