sketchucation logo sketchucation
    • Login
    1. Home
    2. Morgan74
    3. Posts
    ℹ️ 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

    Posts

    Recent Best Controversial
    • 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
    • RE: Get together before base camp

      @pout said:

      If i'm comming over, i'll see you guys back there, i'm probably gonna be the only not native english speaker there so look for the accent πŸ˜„

      Hello, I'm a french guy and my english is not very good so ... no comment for my accent ... 😳

      posted in Corner Bar
      M
      Morgan74
    • RE: Get together before base camp

      Hello,

      For SuperShuttle I can't help you but there is a skyRide Bus (for $12).

      Here somes informations :
      http://www3.rtd-denver.com/schedules/getRouteList.action?routeType=9
      http://www.rtd-denver.com/PDF_Files/skyRideMap.pdf

      posted in Corner Bar
      M
      Morgan74
    • RE: Get together before base camp

      @unknownuser said:

      I get into Denver Int'l at 7:30 PM on the 31st, so if I make it to the party I will be fashionably late. I'll be sure to wear something Google-esque so I can be easily identified by even the most heavily imbibed.

      I'll also arrive at Denver airport at 7:30 PM on 31st, so I will arrive late but no late enough to miss the 3D Facepalm (or Faceplant) πŸ˜„

      Wyatt : Do you flight from Washington ??
      At Denver I'll meet a college who will arrive earlier and we will rent a car at the airport. I booked a room at the Best Western. Perhaps we can drive you to Boulder ?

      posted in Corner Bar
      M
      Morgan74
    • SKSocket connected with my socket server

      Hello everybody,

      I wrote a small socket server to transport data between Sketchup and a PC over my LAN network.
      The SKSocket can connect and send data to my server without problems (FYI : String are send with UTF8 encoding)
      But (There is always a "but"...) when my server want to reply or send data to Sketchup : the SKSocket_listener isn't triggered 😞
      So I have captured the TCP stream with Wireshark (see image) and the TCP message is ACK by Sketchup 😒 😒 but never seen in Ruby.
      TCP stream

      Is there someone with a idea for this problem ?

      posted in Developers' Forum
      M
      Morgan74
    • RE: [info] Using Ruby Modules

      Oops I have used the wrong thread 😳 😳

      Shame on me πŸ˜’ πŸ˜’

      posted in Developers' Forum
      M
      Morgan74
    • RE: [info] Using Ruby Modules

      Thanks Dam for this interesting topic. I was rewriting all my plugin's code when I saw this thread.
      So the only thing I need to do to follow you is adding a "TOP_LEVEL" namespace to my modules.

      But I have a question about adding methods to Sketchup classes :
      I want to add a method to "Geom::Point3d", how can I use a special name ??

      Here my current code :

      
      class Geom;;Point3d
        def myFirstMethod
          return(self.z*self.z)
        end
      end
      
      
      posted in Developers' Forum
      M
      Morgan74
    • RE: IES in SketchUp

      Not very clear ??!!

      You can found informations on the IES web site :
      http://www.iesve.com/Software/Model-Building/SketchUp-plug-in

      posted in Extensions & Applications Discussions
      M
      Morgan74
    • RE: Problem while creating a circle ?!

      Thanks a lot for your reply!!
      It's really better now !!
      But with circleface = ( **outline**.first.faces.to_a - [face] ).first

      posted in Developers' Forum
      M
      Morgan74
    • Problem while creating a circle ?!

      Hello everybody,

      I'm trying to draw and paint a circle in the center of a Face, so here is my code :

      The current selection is a Face :

      
      center = Sketchup.active_model.selection.first.bounds.center
      normal = Sketchup.active_model.selection.first.normal
      outline = Sketchup.active_model.entities.add_circle(center,normal,10)
      circle = Sketchup.active_model.entities.add_face(outline)
      circle.material = "red"
      
      

      This code draw a circle but "add_face" always return nil so I can't paint in red this new circle !??
      Can't you help me please, because I don't understand the problem?

      posted in Developers' Forum
      M
      Morgan74
    • 1 / 1