sketchucation logo sketchucation
    • Login
    1. Home
    2. Morgan74
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 19
    • Groups 1

    Morgan74

    @Morgan74

    10
    Reputation
    1
    Profile views
    19
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Morgan74 Unfollow Follow
    registered-users

    Latest posts made by Morgan74

    • RE: Resize DC with ruby

      Hello,

      I wrote a small code to add a DC at a specific position and resize it.

      So when Sketchup add an instance of a DC its position is 0,0,0. You need to define a transformation to place it where you want.

      t1 = Geom;;Transformation.axes(...,...,...)
      newDC = Sketchup.active_model.entities.add_instance(Sketchup.active_model.definitions["MyDC"],t1)
      

      To set the length I used the set_attribute method of the DC definition

      len = 13
      len2 = 12
      newDC.definition.set_attribute "dynamic_attributes","_lenx_nominal",len.to_s
      newDC.definition.set_attribute "dynamic_attributes","_lenz_nominal",len2.to_s
      
      posted in Developers' Forum
      M
      Morgan74
    • SWIG C++ & gcc

      Hello everybody,

      I'm trying to compile a C++ extension for Sketchup using SWIG.
      Thanks to Chris topic I have a working solution to compile C extension but PellesC don't handle c++ code.

      So I moved to SWIG. I found this topic : http://forums.sketchucation.com/viewtopic.php?f=180&t=22109 but when I link the dll I still have some undefined references ๐Ÿ˜ž

      Here is some errors :

      obj\Release\example_wrap.o:example_wrap.cxx:(.text+0xd3): undefined reference to _imp__rb_eRuntimeError' obj\Release\example_wrap.o:example_wrap.cxx:(.text+0x113): undefined reference to _imp__rb_eRuntimeError'
      ....

      for information I'm on a PC and I use mingw32-gcc.exe to compile and link.

      Do you know a lib that I missed ?

      posted in Developers' Forum
      M
      Morgan74
    • RE: Interest in a Networking Sockets Workaround

      Hello RabidCicada,

      I'm very interested on your work. I'd tried to directly write a Socket inside SU with the SKSocket but this (non offical) Sketchup class is not fully fonctional. It was (for me) the only way to fire events from outside Sketchup (with a SKSocket_listener).

      But with your C++ Bridge I understand that you can send data to Sketchup from your pipe. I there a pool on incoming datas or is-it like handled events ?

      posted in Developers' Forum
      M
      Morgan74
    • RE: Auto Reload Plugin folder

      The traceback is always the same with this plugin because the lastest method used is "load" :
      ["C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:48:inload'", "C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:48:in AutoReload'", "C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:44:in upto'", "C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:44:in AutoReload'", "C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:35:in startTimer'", "C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/Morgan74DevTools.rb:34:in call'"]

      But you have in the error message the line of the error and a "small" description :

      http://lh5.ggpht.com/_6btJdjutpH4/TKw-MbBTbgI/AAAAAAAACMQ/CiQ9UrtbW9A/s800/Error2.PNG

      posted in Developers' Forum
      M
      Morgan74
    • RE: Auto Reload Plugin folder

      Here is an example of the error message :

      http://lh5.ggpht.com/_6btJdjutpH4/TKwn8qi67AI/AAAAAAAACMI/tWAdzkZTxPM/s800/Error.PNG

      posted in Developers' Forum
      M
      Morgan74
    • Auto Reload Plugin folder

      Hello,

      Thanks to Jim's topic http://forums.sketchucation.com/viewtopic.php?f=180&t=31394 I wrote a plugin to reload a complete folder.

      You define the folder to check and you can define some ignored files.
      When the LastModificationDate change SU reload the file.
      If an error occurs, a messagebox is displayed with the error message with a retry buton.

      My module name is Morgan74DevTools so to start the plugin just call "Morgan74DevTools.startAutoReload()" from the console, from your code or uncomment the last code line.

      module Morgan74DevTools
        Folder = "plugins/Morgan74"
        IgnoredFiles = ["Morgan74ToolLoader.rb","Morgan74Tools.rb"]
        
        @timer = nil
        @fileList = []
        @fileDate = []
      
        def self.startAutoReload()
          folder = Sketchup.find_support_file(Folder) #find folder
          @fileList = Dir.entries(folder) #find files
          #remove sub-folders & Ignored files
          to_delete_list = IgnoredFiles
          @fileList.each do |f|
            if File.directory?(File.join(folder,f)) == true
              to_delete_list.push(f)
            end
          end
          to_delete_list.each do |f|
            @fileList.delete(f)
          end
          #concat folder and files
          @fileList.collect! {|f| File.join(folder,f)}
          #Save last modification Date
          0.upto(@fileList.length()-1){|i|
            @fileDate[i] = Kernel.test(?M,@fileList[i])
          }
      
          self.startTimer()
        end
      
        def self.startTimer()
          #Start Timer
          @timer = UI.start_timer(2, true) do
            self.AutoReload()
          end
        end
      
        def self.stopAutoReload()
          UI.stop_timer(@timer)
        end
      
        def self.AutoReload()
          0.upto(@fileList.length()-1){|i|
            if Kernel.test(?M,@fileList[i]) != @fileDate[i]
              begin
                Sketchup.set_status_text("Loading ; " + @fileList[i].to_s(),SB_PROMPT)
                load @fileList[i]
                @fileDate[i] = Kernel.test(?M,@fileList[i])
              rescue Exception => e
                #Stop timer
                self.stopAutoReload()
                msg = "AutoReload Plugin\n\n"
                msg << "Error loading file ;\n" + @fileList[i].to_s() + "\n\n"
                msg << "Error message ;\n" + e.message + "\n\n"
                msg << "Fix the error before click RETRY or CANCEL to stop the plugin"
                result = UI.messagebox(msg,MB_RETRYCANCEL)
                self.startTimer() if (result == 4)#Retry = restart timer
              end
            end
          }
        end
      end
      
      #Morgan74DevTools.startAutoReload()
      

      Next step can be reload all the folders inside the plugin folder.

      posted in Developers' Forum
      M
      Morgan74
    • RE: Ruby File Auto-Reloader code

      Thank-you for this great Plugin !!! ๐Ÿ‘
      It's so boring to always close and re-open SU to update my plugins files !! ๐Ÿ‘ฟ

      posted in Developers' Forum
      M
      Morgan74
    • RE: SKSocket connected with my socket server

      Hello,

      Thanks for your answer and your way to send datas through a Webdialog using ajax.

      For the SKSocket class, I have asked to Scott (a Googler) at the Basecamp and the response is this class as been developed for an internal test but it's not fully implemented and fully working so don't use it if you want to be sure your code will run correctly.

      Regarding my needs : Now I just want to handles events from another windows software directly inside Ruby so I'll open another topic in the forum.

      posted in Developers' Forum
      M
      Morgan74
    • RE: Default save as v7?

      Hello,

      Sorry, but I think we can't do that because the Model.save method haven't option to set the SU version you want.
      http://code.google.com/intl/fr-FR/apis/sketchup/docs/ourdoc/model.html#save

      Bye

      posted in Developers' Forum
      M
      Morgan74
    • RE: SCF Basecamp Picasa webalbum

      Hi, can you register me please. I'll take my camera.
      See you in Boulder ๐Ÿ˜„

      posted in Corner Bar
      M
      Morgan74