sketchucation logo sketchucation
    • Login
    1. Home
    2. julien.decharentenay
    ℹ️ 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 4
    • Posts 8
    • Groups 1

    julien.decharentenay

    @julien.decharentenay

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

    julien.decharentenay Unfollow Follow
    registered-users

    Latest posts made by julien.decharentenay

    • RE: Secure http request from SketchUp ruby

      @dan rathbun said:

      (b) Any file specific to a plugin, belongs in THAT plugin's folder hierarchy.

      Thanks. It makes sense to me as well. At the moment, my implementation downloads the file (when first needed) in an application specific folder that is outside of the SketchUp/plugin directory - it is not SketchUp specific, nor a specific part of my plugin, but is required by my plugin...

      My preference would be to not download and store this file...

      posted in Developers' Forum
      J
      julien.decharentenay
    • Secure http request from SketchUp ruby

      Hi,

      Sketchup: 2014 14.0.4900
      OS: Windows 8

      I just wanted to share an issue that I encountered and ask for feedback. I was trying to use ruby to make http connection using the net/http library. It worked fine for http connection, but failed for https connection with the error message:

      Error; #<OpenSSL;;SSL;;SSLError; SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B; certificate verify failed>
      

      The issue is reasonably well documented:

      • An explanation of the issue can be found there https://github.com/oneclick/rubyinstaller/issues/153
      • Fix for ruby (standalone) can be found in various place from updating the pem certificate list manually (not really applicable on Windows as the path is hardcoded to a location valid only for the person that compiled the library) to downloading the certificate locally and using the environment variable "SSL_CERT_FILE"

      From within SketchUp, the environment variable fix only works if the environment variable is set manually, but does not work when setting the environment variable within ruby using the ENV variable.

      I found that the following code works, which set the path to the certificate file manually when creating the http connection:

      require 'net/http'
      
      uri = URI('https://www.google.com.au')
      
      http = Net;;HTTP.new(uri.host, uri.port)
      http.use_ssl = (uri.scheme =~ /^https$/i)
      http.ca_file='C;\Users\owner\Documents\cacert.pem'
      
      request = Net;;HTTP;;Get.new(uri.request_uri)
      response = http.request(request)
      puts response.body
      

      I was wondering if anyone had encountered a similar issue and if so have a different solution. I was also wondering of how to include the certificate file (cacert.pem) in the plugin: (a) ship a predownloaded version or download it when needed, (b) keep it in my own plugins directory (Roaming\SketchUp...\Plugins\MyPlugin\Certificate) or keep it somewhere more accessible?

      Have a great day.

      posted in Developers' Forum
      J
      julien.decharentenay
    • RE: Use of start/commit_operation

      Dan and thomthom, thanks for your time and answer.

      posted in Developers' Forum
      J
      julien.decharentenay
    • RE: Use of start/commit_operation

      Thanks a lot for the link and taking the time to writing it. It is very clear and detailed.

      Just a quick question: on the last page (section Segments and Points), the example for testing multiple points faster reads:

      <span class="syntaxdefault">pickhelper</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">init</span><span class="syntaxkeyword">(&nbsp;</span><span class="syntaxdefault">x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">y&nbsp;</span><span class="syntaxkeyword">)<br />for&nbsp;</span><span class="syntaxdefault">point&nbsp;in&nbsp;points<br />&nbsp;&nbsp;p&nbsp;pickhelper</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">test_point</span><span class="syntaxkeyword">(&nbsp;</span><span class="syntaxdefault">point</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">y&nbsp;</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end</span>
      

      Shouldn't the second call reads "test_point( point )" or does it not matter?

      posted in Developers' Forum
      J
      julien.decharentenay
    • RE: Use of start/commit_operation

      Thanks for the feedback. I think that drawing from the draw method using View.draw is the way forward in my case - and avoid adding entities to the model.

      Beyond the code extract shown, the user is also able to select the input point to change their location (or delete). I used PickHelper.picked_element (or a loop through PickHelper.all_picked) to retrieve the construction point. If I am drawing the point using View.draw, PickHelper.picked_element/all_picked will not pick the point drawn with View.draw and I will have to test using PickHelper.test_point. Is it correct?

      Thanks in advance. Julien

      posted in Developers' Forum
      J
      julien.decharentenay
    • Use of start/commit_operation

      Hi,

      I am trying to use start_operation/commit_operation to implement undo/redo for a plugin. I am unsure if I am going about it the right way. Attached is a sample of the code that I am trying to write. The purpose is to allow the user to specify coordinates that are used in other parts of the plugin - in this example the coordinates are defined when the left button is released. For visual feedback, the selected coordinates are shown as construction point - which are deleted when the tool is unselected.

      From the redo/undo point of the issue: the tool creates the correct undo/redo statement, but SketchUp also creates "Erase" and "Guide" undo/redo when the tool is deactivated/activated.

      Is there any way to let SketchUp know not to create the "Erase" and "Guide" undo/redo? Or should I use another visual feedback mechanism in place of construction point (such as through the draw function or other)?

      Thanks a lot for your help.
      Julien

      Note: the code also has issues if the undo button is press while the tool is active or the construction point is erased. A test e.deleted? in the deactivate would avoid the error message, but it might be best handled with an entity observer.

      module Hibou
      	class TestingOperationCommitTool
      		def initialize()
      			@cPoints = []
      		end # def initialize
      
      		def activate()
      			begin
      				dictionary = getDictionary()
      				if ((nCoordinate = dictionary["nCoordinate"]) != nil)
      					for i in 0...nCoordinate
      						x, y, z = dictionary["Coordinate_#{i.to_s}"].split(",")
      						@cPoints.push(Sketchup.active_model.entities.add_cpoint(Geom;;Point3d.new(x.to_f.m, y.to_f.m, z.to_f.m)))
      					end
      				end
      			rescue Exception => e
      				UI.messagebox("Error; #{e.to_s}.\nBacktrace; #{e.backtrace}")
      			end
      		end # def activate
      
      		def deactivate(view)
      			begin
      				@cPoints.each() { |e|
      					Sketchup.active_model.entities.erase_entities(e)
      				}
      			rescue Exception => e
      				UI.messagebox("Error; #{e.to_s}.\nBacktrace; #{e.backtrace}")
      			end
      		end # def deactivate
      
      		def onLButtonUp(flags, x, y, view)
      			begin
      				model = Sketchup.active_model
      				inputPoint = Sketchup;;InputPoint.new()
      				inputPoint.pick(view, x, y)
      				if (inputPoint.valid?())
      					model.start_operation("Define coordinate")
      					@cPoints.push(Sketchup;;active_model.entities.add_cpoint(p3d = inputPoint.position))
      					dictionary = getDictionary()
      					dictionary["nCoordinate"] = @cPoints.length
      					dictionary["Coordinate_#{(@cPoints.length-1).to_s}"] = [p3d.x.to_m, p3d.y.to_m, p3d.z.to_m].join(",")
      					model.commit_operation
      				end
      
      			rescue Exception => e
      				model.abort_operation
      				UI.messagebox("Error; #{e.to_s}.\nBacktrace; #{e.backtrace}")
      			end
      		end # def onLButtonUp
      
      		private
      		def getDictionary()
      			return Sketchup.active_model.attribute_dictionary("HibouTestingOperation", true)
      		end # def getDictionary
      	end # class TestingOperationCommitTool
      end # module Hibou
      
      if (not file_loaded?(__FILE__))
      	UI.menu("Plugins").add_item("Hibou-Testing") { Sketchup.active_model.tools.push_tool(Hibou;;TestingOperationCommitTool.new()) }
      	file_loaded(__FILE__)
      end
      
      
      posted in Developers' Forum
      J
      julien.decharentenay
    • [Plugin] Khamsin (CFD Modelling) v1.0

      Hibou Scientific Software Pty Ltd is pleased to announce the release of Khamsin version 1.0.

      Khamsin, a SketchUp Plugin for CFD Modelling, allows for the set-up and management of analysis using open-source CFD tools and solvers directly from the SketchUp 3D environment. Khamsin enables the definition of all CFD simulation parameters directly within SketchUp without having to use different software for geometry definition and case setup (or hard to understand ASCII files).

      Khamsin version 1.0 has been in development over the last few months and includes the following key features among other improvements:

      • Amazon AWS: we introduced an option to submit and run analysis on the Amazon EC2 cloud and use the Amazon S3 storage system for analysis storage;
      • Linux: while SketchUp does not work under Linux, you can now prepare and submit the analyse to a Linux computer from SketchUp on Windows;
      • Installation process: the installation process has been revised to use the SketchUp rbz installation process.

      Khamsin support thermal analysis, laminar and turbulent flow analysis with and without buoyancy forces, as well as two-phase laminar and turbulent flow with sharp interface (think water around a ship hull).

      Free license for non-commercial use. Contact us for commercial licenses.

      More information, documentation and download from http://www.hibouscientificsoftware.com.au/khamsin.

      Videos at http://www.youtube.com/user/HibouSoftware/videos.

      Happy SketchUp and Khamsin modelling.
      The Hibou Scientific Software development team

      posted in Plugins
      J
      julien.decharentenay
    • Khamsin, a Google Sketchup plugin for CFD modeling

      Hi,

      I have been working (a bit in my corner and spare time) on writing a SketchUp plugin to undertake CFD modeling. At the moment, it is in its very early stages. But following the principle "release early, release often", I put together a version 0.1.

      In short, Khamsin is a plugin extension of Google Sketchup which will aim to provide an integrated environment to conduct CFD analysis. Khamsin interacts with the existing third-party software Gmsh and OpenFVM for meshing, analysis and post-processing purposes. The long
      term goal of Khamsin is to become an integrated CFD package tailored for the building environment (wind studies, indoor air quality, thermal comfort), using 3D environment already in use by architectural practices.

      More information and plugin downloads are available at http://sites.google.com/site/juliendecharentenay/Khamsin-Home.

      If you are interested and would like to be included in our mailing list, register your interest http://sites.google.com/site/juliendecharentenay/Khamsin-Home/khamsin-registration-form.

      I welcome your feedback on the project.

      Julien de Charentenay, on behalf of the Khamsin development team

      posted in Plugins
      J
      julien.decharentenay