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

    wsellers89

    @wsellers89

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

    wsellers89 Unfollow Follow
    registered-users

    Latest posts made by wsellers89

    • Export spline curves

      I have a series of spline curves defining the fuselage of an aircraft. Is there a plugin that will take a spline curve and export it into a file of x, y, z points defining the curve?

      posted in Newbie Forum sketchup
      W
      wsellers89
    • RE: [Plugin] Export Cpoints to CSV v1.0 20110913

      Sorry to bother you, but I got referred to this post from the newbie section. I had asked the following:

      I am laying out a porous plate and was wondering if there is an easy way or perhaps a script that will read the construction points (e.g. centerpoints) of each of the circles representing the holes. If it could write out the points to a file would be great, but if it would print to the console -- I could write them down. There are a couple of hundred holes that is why I would like to automate this.

      Operating system: Mac OS X
      SketchUp version: V8

      This script sounds exactly like what I need. I placed the ruby script in the Main folder:
      MacHD/Applications/Library/Application Support/Google SketchUp 8/SketchUp/plugins/

      but when I relaunch SketchUp I don't see the script in the Plugins pull down menu. Am I missing something?

      Sincerely,
      Bill

      posted in Plugins
      W
      wsellers89
    • Reading Construction Points

      I am laying out a porous plate and was wondering if there is an easy way or perhaps a script that will read the construction points (e.g. centerpoints) of each of the circles representing the holes. If it could write out the points to a file would be great, but if it would print to the console -- I could write them down. There are a couple of hundred holes that is why I would like to automate this.

      posted in Newbie Forum sketchup
      W
      wsellers89
    • RE: Ruby script to rotate a shape using a arc

      Wow! Thanks for the help and the education regarding what it takes to make it rotate a precise number of degrees. It was way past my skill level!

      Thank you again.

      Sincerely,
      Bill

      posted in Newbie Forum
      W
      wsellers89
    • RE: Ruby script to rotate a shape using a arc

      Dear TIG,

      Because what I was ultimately heading toward was the ability to take a complicated profile (Versus a rectangle) and rotate it exactly 180 degrees. The profile could be something like a cross section of a rocket launcher or a cross section of a jet engine, which wouldn't work well with the Push/Pull.

      posted in Newbie Forum
      W
      wsellers89
    • Ruby script to rotate a shape using a arc

      Sorry to ask such an elementary question, and I hope that this is the right forum. I am working my way through ruby scripting and wanted to rotate a simple surface such as a rectangle to form half a cylinder. It is extremely important that the edges of the cylinder match up with the x-axis, so I used an arc going from 0 to 90 degrees. When the script rotates the rectangle it does something strange in that it appears to over rotate (look near the origin). The script is as follows:

      # Access the Entities object
      model = Sketchup.active_model
      ents = model.entities
      
      # Create the 2-D shape
      curve = ents.add_curve [5, 0, 0], [15, 0, 0],
      [15, 0, 10], [5, 0, 10], [5, 0, 0]
      curve_face = ents.add_face curve
      
      # Create the arc path
      path = ents.add_arc [0, 0, 0], [0, 0, 1], [1, 0, 0], 5, 0.0, 180.degrees
      
      # Create the figure
      curve_face.followme path
      

      and I will attach an image of what resulted. I do know that if I draw a rectangle on the x-axis and intersect with the rotated object it does line up, but why the strange behavior? Am I missing something simple?

      Sincerely,
      Bill


      Rotated rectangle.  Rectangle is 10 units long and 10 units high starting at x= 5

      posted in Newbie Forum sketchup
      W
      wsellers89
    • RE: Reading a file in Ruby

      I think that I found my answer by digging into the SketchUp API documentation. Their examples show the following for the edge.start and the edge.end command. Don't know if there is a more elegant way.

      edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
      vertex = edge.start
      if (vertex)

      display a pointer to the Vertex

      UI.messagebox vertex
      else
      UI.messagebox "Failure"
      end
      point = vertex.position

      Let's get the Point3d of the vertex

      if (point)
      UI.messagebox point
      else
      UI.messagebox "Failure"
      end

      vertex = edge.end
      if (vertex)

      display a pointer to the Vertex

      UI.messagebox vertex
      else
      UI.messagebox "Failure"
      end
      point = vertex.position

      Let's get the Point3d of the vertex

      if (point)
      UI.messagebox point
      else
      UI.messagebox "Failure"
      end

      posted in Developers' Forum
      W
      wsellers89
    • RE: Reading a file in Ruby

      Is there a SketchUp API command that would let you extract the beginning and end point (x,y,z) of a selected line or edge?

      posted in Developers' Forum
      W
      wsellers89
    • RE: Reading a file in Ruby

      Dear TIG and Chris,

      You both are geniuses and I can't thank you enough for your advice! I am attaching what I pieced together based on your inputs, and from info in the Ruby SketchUp programming examples. I put together a quick input file with the coordinates of a parabola just to test out the code, and it works just fine.

      I am still not sure of some of the finer points of your discussion (e.g. edges versus lines), but this gets me started. Is there a good reference or tutorials for learning more about Ruby on SketchUp? I am experienced in Fortran and to a less extent C, but I can follow most of the the code. I am not sure what ".to_f" does in the loop to parse out the x,y points and would like to know more.

      I will attach the simple input file in case you are interested.

      First we pull in the standard API hooks.

      require 'sketchup'

      Show the Ruby Console at startup so we Can

      see any programming errors we may make.

      Sketchup.send_action "showRubyPanel:"

      UI.menu("PlugIns").add_item("LinesFromFile") {
      UI.messagebox("I'm about to import data")

      #Set your filepath by using

      filepath = UI.openpanel("Open Data File", "/Users/sellers
      ", "*.txt")

      http://code.google.com/apis/sketchup/do ... #openpanel OR

      hard-code it in - if you get back-slashes in your path ..\folder\file.dat

      swap them for forward slashes for other ruby use filepath.tr!("\","/")

      Then you open the file for reading...

      lines=IO.readlines(filepath)

      Now process the array of lines to get the points as x/y values

      points=[]
      lines.each{|line|
      x=line.split(",")[0].to_f
      y=line.split(",")[1].to_f
      pt=[x,y]
      points<< pt
      }

      You now have an array of points.

      To connect points with 'Lines' use

      model=Sketchup.active_model
      ents=model.active_entities

      0.upto(points.length-2) do |i|
      ents.add_line(points[i],points[i+1])
      end#do

      }


      Simple data for a parabola

      posted in Developers' Forum
      W
      wsellers89
    • RE: Reading a file in Ruby

      Just beginning with Ruby. To start off simple, all I would like to do is read in the x,y points from a file and then connect them with a line.

      posted in Developers' Forum
      W
      wsellers89