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

    Posts

    Recent Best Controversial
    • RE: Web dialog pass data from Ruby to webdialog

      Hi,

      I have been working on those materials and I came to a solution. But still there's a problem.
      This is details.rb file

      ` dialog = UI::WebDialog.new("Details", true, "", 410, 875, 1030, 0, true)
      dialog.add_action_callback("pass_data"){|dialog,htmlpage|
      java = "set_details(#{@name.inspect},#{@description.inspect})"
      dialog.execute_script(java)
      }

      dialog.set_file 'C:\Program Files\Google\Google SketchUp 8\Plugins\set_id\details.html'
      dialog.show()`

      This is details.html file

      <html>
      <head>
      <script>
      function callRuby(htmlpage) {
      query = 'skp:pass_data@' + htmlpage;
      window.location.href = query;
      document.write(query);}

          function set_details(a,b){
      document.write(a);
      document.write(b);}
      
       </script>
      

      </head>

      <body onload="callRuby('pull_selection_count');">
      </body>

      </html>

      only "skp:pass_data@pull_selection_count" is the result on the webdialog box.
      What i want is to display the values of the Ruby variables name and description.

      Do you have any ideas for fixing this?
      Thank you in advance.

      posted in Developers' Forum
      S
      sachi
    • RE: Web dialog pass data from Ruby to webdialog

      Thank you very much. Thomthom
      I'll go through it.

      posted in Developers' Forum
      S
      sachi
    • Web dialog pass data from Ruby to webdialog

      Dear All,
      I want to implement a webdialog in Sketchup to display data from a database.
      This below link was very useful.
      http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.

      What I want to do is as following.

      1)From the Ruby program, the database will be accessed and necessary data will be retrieved.
      2)Then this data passed to the webdialog and show to the user.

      However in the above example, the webdialog contains a refresh button. users has to click that refresh button to view the data.

      What i want to is display data directly without a refresh button.

      Is there a way to pass string data from Ruby to HTML directly.

      Do you have any suggestions and any of you have try working with webdialogs?
      its bit difficult for me because i have to learn HTML and Javascript too.

      posted in Developers' Forum
      S
      sachi
    • How to draw parallel lines

      Dear all,

      I’m working on a school project. I’m developing a 3D model using Sketchup through Ruby extension. I want to draw a parallel line for a curved line.

      The curved line was drawn using Ruby API command entities.add edges. The points of the curved line were provided by a Ruby array.
      Now I want to draw a parallel line for this curved line. Do you have any suggestions please?
      Thank you

      posted in Developers' Forum
      S
      sachi
    • Web access for 3D model

      Dear all,

      I need to access a Sketchup 3d model through a web browser. The real model will be saved in a server. Clients should be able to explore the SU model. they should be able to orbit around and walk through the model. This should be just like browsing the internet and viewing web pages. Users don't have to download and install any plugin to view the model.
      is this possible to achieve?
      Thank you in advance

      posted in Developers' Forum
      S
      sachi
    • Offset a line Ruby command

      Dear all,
      Does anybody know about a Ruby API command to offset a line? I already checked the API.
      It has a command to offset a point.

      point1 = point2.offset vector

      But i need to offset a line, like a parallel line. Is there any command in Ruby API which i can work with or any suggestions to offset a line(draw a parallel line)?

      please help me, im stuck here

      thank you in advance

      posted in Developers' Forum
      S
      sachi
    • Calculating angle between a line and North

      Dear all,

      I need to calculate the angle between North and a line connecting two latlong points. I have number of pairs(about 50) latlong points. For each and every case, i need to calculate the angle between North and the line.
      Later, I wished to use this, calculated angle to rotate an object.
      Do SketchUp and Ruby API has a specific function to facilitate this need?(when you have two latlong points, it gives you the angle between north and the line) or do you have any suggestions to make this happen?

      Thank you in advance

      posted in Newbie Forum sketchup
      S
      sachi
    • Layer controllability over html web dialog box

      Dear all,
      I like to control the layer visibility over html web dialog box for displaying purposes. layers should be controlled by ticking in a html check box.
      is this possible? and i would be appreciate your suggestions. i think i saw something like this, somewhere in the internet. but now i cant find it.
      thanks in advance.

      posted in Developers' Forum
      S
      sachi
    • RE: Add entities to a layer

      thank you very much for the detailed explanation TIG. It cleared the doubted areas about the layers.

      posted in Developers' Forum
      S
      sachi
    • RE: Add entities to a layer

      thank you very much.it worked.i tested it for a simple program.now i'm going to apply it to my original code.
      thanks again 👍

      posted in Developers' Forum
      S
      sachi
    • Add entities to a layer

      Dear all,

      i want to control the visibility of several components in my model. to do that i add a new layer to the model. now i want to assign those components to newly added layer(new_layer). how could i assign those components to the new layer?
      theoretically there should be something like
      new_layer.add component_entity
      help me.thanks in advance

      posted in Developers' Forum
      S
      sachi
    • An animation for a walk through in a model using ruby

      Dear all,

      I developed a small 3 dimensional map using a Ruby plugin. It consists of several houses and a road. everything in there is coded in the ruby code. Now i want to add an animation to this map like a virtual tour within the map. So that user can walk through the map.
      As I've seen Sketchup animation is a combination of two or more scenes. User has to change the scene(click on the scene tab) manually to display the animation(to go to the next scene). I want to combine those scenes together to change automatically without any user trigger. I wish to define scenes place to place in the map and write a loop or something to change the scenes automatically. Mainly i want to do this using a ruby plugin.

      So do you think this is possible and if so how? i have goggled but didn't find anything that helps me.
      Please let me know your suggestions.

      Thank you

      posted in Developers' Forum
      S
      sachi
    • RE: Web Dialog: Trouble passing string from ruby to javascript

      Thank you very much
      it works just fine
      😄

      posted in Developers' Forum
      S
      sachi
    • Web Dialog: Trouble passing string from ruby to javascript

      “var” is a String type ruby variable. I can’t pass characters to web dialog box though the ruby variable “var”. This works fine when the string contains integers. (eg: var=”12”).I can’t figure out why?
      I like to know about your suggestions about this problem.

      Ruby Code
      ` var= "a"
      dialog = UI::WebDialog.new("Building details", true, "", 410, 875, 1030, 0, true)

      dialog.add_action_callback("pass_data"){|dialog,htmlpage|
      java = "set_id("+var+")"
      dialog.execute_script(java)
      }`

      %(#0000BF)[Html and javascript

      <html>
      <script>
      function callRuby(htmlpage) {
      query = 'skp:pass_data@' + htmlpage;
      window.location.href = query;}

      function set_id(var){
      var message = "ID = " +var+ " ";
      document.getElementById('output').innerHTML = message;}
      </script>

      <body>
      <h3 id="output">Object ID </h3>
      <input type="button" onclick="callRuby('pull_selection_count')" value="Refresh">
      </body>
      </html>]

      posted in Developers' Forum
      S
      sachi
    • RE: Sketchup and ruby

      Thank you very much TIG and kwalkerman. I have tried some simple codes.And the tool interface and pickhelper will be just fine for the task.
      But now it raised a problem. I want to select a whole sketchup entities object, as one object. So that when I click anywhere on that object (like a house or a building), the same data record will be retrieved from the database.
      The database contains a record for each house.

      Do you have any idea about this? Thank you

      posted in Developers' Forum
      S
      sachi
    • Sketchup and ruby

      I want to perform a onclick action on a sketchup object to connect to a Mysql database.

      I developed a Ruby class to create sketchup objects.

      And now I want to perform an onclick action on this sketchup objects. When I Mouseclick on a sketchup object ,an onclick action will be initialized and will automatically connect to the database.
      Is this possible with Sketchup and ruby?If so, what are the necessary ruby classes and methods for this event?

      Thank you.

      posted in Developers' Forum
      S
      sachi
    • 1 / 1