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

    krisjaniszakis

    @krisjaniszakis

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

    krisjaniszakis Unfollow Follow
    registered-users

    Latest posts made by krisjaniszakis

    • RE: Ruby array to hash

      Thanks TIG it is a good point πŸ˜„

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Ruby array to hash

      Thanks TIG your generous script prints out unique arrays and it is not realy the exact case.

      thomthom -> name, value
      h{"name" => value, "name" => value,}

      Looks like I havn't told all the details.

      1. I have multidimensional array[] in Ruby
      2. I want to send array[] to Webdialog using dialog.execute_script()
      3. I want to send to PHP and arrange and do stuf with array[]

      My array[] looks like this array[[value1, value2, value3,...],[value1, value2,...],...]

      Im trying to transform array[] to hash{}
      hash{0=>[0_0=>value1,0_1=>value2,0_2=>value3,...],1=>[1_0=>value1,1_1=>value2,...],...}

      maybe I don't need transform, maybe I can send directly from Ruby to PHP without sending to Webdialog ?

      posted in Developers' Forum
      K
      krisjaniszakis
    • Ruby array to hash

      Hi is there a fast way or some ruby libraries how to convert array[] to hash{} ?
      Example of array[]:
      a=[] a << [test1, test2, test3, test4]

      How can I fill in hash{} with entity name and value?

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Webdialog connect to PHP

      Thanks GΓ‘bor and jiminy-billy-bob I combined both scripts and now understand how to do it πŸ˜„

      Does some one know how big(length) array ("v") I can send through ?
      window.location='http://myserver.com/myfile.php?v=' + v;

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Webdialog connect to PHP

      Thanks I thought about it too, but could you pleas post small code example ?

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Webdialog connect to PHP

      It gives me blank page and doesn't transfer
      data
      array to that page 😞

      I will try to look at AJAX thanks.

      posted in Developers' Forum
      K
      krisjaniszakis
    • Webdialog connect to PHP

      Have some one tried to send data from Webdialog to PHP.
      How to do it ?
      I found that post_url could help but it doesnt.

      data << [aa,bb,11,22] dlg = UI::WebDialog.new dlg.post_url("http://localhost/sketch/index.php",data)

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Angle between north and face

      Thanks it was the thing I was looking for πŸ˜„

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Angle between north and face

      @jolran said:

      Hi!

      No response ey? I give it a try.

      Maybe this code is part of a larger piece, otherwise I have a little trouble following your logic.

      Have never used shadow info, and do not have time to look up the methods revolving that.
      Does it really return an angle?

      What is entity ? a face?

      Unless you are going to use those variables later why not just enter:

      tr = Geom::Transformation.rotation(ORIGIN, Z_AXIS, rotation)
      Does not really matter for solving this problem though..

      Try putting a bang to it! Edit in place..

      north_vector.transform! (tr)

      I just wanted to automating angle between north and face.
      With entity I meant "face".

      Here is updated code

      ` north_angle = Sketchup.active_model.shadow_info['NorthAngle']
      flat_normal = entity.normal.clone
      flat_normal.z = 0
      north_vector = Y_AXIS.clone
      north_vector.z = 0
      point = ORIGIN
      up = Z_AXIS
      rotation = north_angle.degrees
      tr = Geom::Transformation.rotation(point,up,rotation)
      north_vector.transform! (tr)
      angle = (north_vector.angle_between(flat_normal)).radians

          if flat_normal.x < 0
             angle = 360-angle
          else
             angle
          end`
      

      And here is Sketchup screenshot with my experiment.

      http://s8.postimg.org/dco1b0rrp/face2.jpg

      For this example script gives that angle between will be 100but not 50, where is the problem ?

      posted in Developers' Forum
      K
      krisjaniszakis
    • RE: Angle between north and face

      Can some one see:

      1. why if I change north angle result is not changing?

      ` north_angle = Sketchup.active_model.shadow_info['NorthAngle']
      north_vector = Y_AXIS.clone
      north_vector.z = 0
      flat_normal = entity.normal.clone
      flat_normal.z = 0
      point = ORIGIN
      up = Z_AXIS
      rotation = north_angle.degrees
      tr = Geom::Transformation.rotation(point,up,rotation)
      north_vector.transform (tr)
      angle = (flat_normal.angle_between(north_vector)).radians

          if flat_normal.x < 0
             angle = 360-angle
          else
             angle
          end`
      
      posted in Developers' Forum
      K
      krisjaniszakis