sketchucation logo sketchucation
    • Login
    1. Home
    2. j_jones
    ℹ️ 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 15
    • Posts 40
    • Groups 1

    j_jones

    @j_jones

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

    j_jones Unfollow Follow
    registered-users

    Latest posts made by j_jones

    • RE: How to use Fredo tools offline?

      @rich o brien said:

      It could be that your running Libfredo 14.1 and its recently updated to 14.2 ...

      Thank you again! I updated LibFredo and hopefully no more issues...

      posted in Newbie Forum
      J
      j_jones
    • RE: How to use Fredo tools offline?

      now the crazy thing is appeased somehow, probably because I posted about it!

      Don't know how long it will behave though...

      posted in Newbie Forum
      J
      j_jones
    • RE: How to use Fredo tools offline?

      It's happening again, this time I can't even use the tool even if I validate the license!

      Everything was fine for a while but now it says I can't use Curviloft. So, I go online, reactivate the license, but as soon as I try to use it again, it says it's invalid....

      not again

      After validating the license through the web, I turn of the wifi off again

      license never satisfied

      But as soon as I try to use the tool, again, the same error, as above....

      I can't use the tool at all now...

      Here is the output of the Fredo plugins information

      Fredo6 Plugins Information on 2023-09-06 17:34:45 -0700

      • Platform: x86_64-darwin14 - Ruby: 2.2.4
      • Sketchup: 17.3.116
      • LibFredo6: v14.1a
      • LibFredo6 Binary loaded
      • Sketchucation ExtensionStore: 4.3.1
      • SCFLicense: v6.1a - 72
      • Fredo6 Plugins

        TopoShaper v2.6a - licensed FULL
        ToolsOnSurface v2.5a - licensed FULL
        Curviloft v1.9a - licensed FULL
        FredoTools v4.3a
        FredoSketch v1.2a
        Animator v3.8a
        JointPushPull v4.6a - licensed FULL
        Curvizard v2.4b - licensed FULL
        FredoScale v3.5a - licensed FULL
        ThruPaint v2.2a
        FredoPortrait v2.8a
        RoundCorner v3.3a - licensed FULL
        VisuHole v1.4b - licensed FULL
        FredoGhost v2.0a
        FredoCorner v2.6a

      • SCFLicense directory present

        Signature File: 2022-06-29 18:42:44 -0700
        Curvizard: 2023-07-30 19:53:00 -0700
        JointPushPull: 2023-07-30 19:52:44 -0700
        ToolsOnSurface: 2023-07-30 19:52:12 -0700
        VisuHole: 2023-07-30 19:54:11 -0700
        Curviloft: 2023-09-06 17:33:49 -0700
        RoundCorner: 2023-07-30 19:53:54 -0700
        TopoShaper: 2023-07-30 19:51:46 -0700
        FredoScale: 2023-07-30 19:53:14 -0700

      Thank you for any help
      -j_jones

      posted in Newbie Forum
      J
      j_jones
    • Perlin noise installation

      Hello Sketchup Friends!

      I found this cool project in github that will let you play around with perlin noise.

      https://github.com/huseyinbicen/Sketchup-Ruby-3DTerrain-via-Perlin-Noise

      It says in the installation instructions to add the files in the "lib" folder to the "Ruby library."

      Then gives this example:

      1-) C:\Program Files\SketchUp\SketchUp 2015\Tools\RubyStdLib Open Directory 2-) Move the "perlin_noise.rb" and "perlin" files in the "lib" folder to the directory in step 1.

      But I have no such folder in my directory trees for Sketchup.

      
      ./Library/Application Support/SketchUp 2017
      ./Library/Application Support/SketchUp 2017/SketchUp
      ./Library/Application Support/SketchUp 2017/SketchUp/Materials
      ./Library/Application Support/SketchUp 2017/SketchUp/Plugins
      ./Library/Application Support/SketchUp 2017/SketchUp/Styles
      ./Library/Application Support/SketchUp 2017/SketchUp/Components
      ./Library/Application Support/SketchUp 2017/SketchUp/Autosave
      ./Library/Application Support/SketchUp 2017/SketchUp/Classifications
      ./Library/Application Support/SketchUp 2017/SketchUp/Templates
      ./Library/Application Support/SketchUp 2017/WebCache
      ./Library/Application Support/SketchUp 2017/WebCache/GPUCache
      ./Library/Application Support/SketchUp 2017/WebCache/Dictionaries
      ./Library/Application Support/SketchUp 2017/WebCache/Local Storage
      ./Library/Caches/com.sketchup.SketchUp.2017
      ./Library/Caches/com.sketchup.SketchUp.2017/fsCachedData
      
      

      As for Ruby the language, I could only find these dirs

      
      ./.gem/specs/api.rubygems.org%443
      ./.gem/specs/api.rubygems.org%443/quick
      ./.gem/specs/api.rubygems.org%443/quick/Marshal.4.8
      ./.gem/ruby
      ./.gem/ruby/2.3.0
      ./.gem/ruby/2.3.0/cache
      
      

      Can anyone tell me where I might put these perlin noise filees so they could be used by Sketchup 2017?

      Thank you for any hints
      j_jones

      posted in Extensions & Applications Discussions
      J
      j_jones
    • RE: Rotating faces to create a u-shape

      After some struggles, I came up with this script which "solves" it, however I the ruby console plus crashes about 20 seconds after running this script, I have yet to figure out how to trap that error, whatever it is

      link to animated gif demonstration:

      four sides via rotation.gif

      favicon

      Google Docs (drive.google.com)

      Here is the revised script that at least does what I was trying to do.

      The difference is that I used transform_entities instead of transform!
      that seemed to have the desired effect on the resulting face so that I could extract it's vertices after the xform. An idea I got from here: https://forums.sketchup.com/t/move-a-group-api-ruby/130338/5

      
      module RotateFaces
      
        def self.get_face_from_entities(things)
          face = nil
          things.each do |thing|
             if thing.is_a?(Sketchup;;Face)
               face = thing
               break
             end
          end
          return face
        end
      
        def self.rotate_face(entz, face, axis_pt1, axis_pt2, angle)
          axis = axis_pt1.vector_to(axis_pt2)
          xform = Geom;;Transformation.rotation(axis_pt1, axis, angle)
          entz.transform_entities(xform, face)
          return face
        end
        
        def self.get_face_vertices(face)
          verts = []
          face.outer_loop.vertices.each{|v| verts << v.position}
          return verts
        end
      
        def self.create_rotated_face(entz, pts, axis_pt1, axis_pt2, angle)
          model = Sketchup.active_model
          active_entities = model.active_entities
          model.start_operation("create rotated face",true,false,true)
      
          face = self.get_face_from_entities(entz)
          face_xformed = self.rotate_face(entz, face, axis_pt1, axis_pt2, angle)
          verts = self.get_face_vertices(face_xformed)
      
          model.commit_operation
          return [verts, face_xformed]
        end
      end
      
      model = Sketchup.active_model
      active_entities = model.active_entities
      
      begin 
        things1 = []
        group1 = active_entities.add_group
        pts1 = [[10,10,0], [20,10,0], [20,10,10], [10,10,10]]
        pt0, pt1, pt2, pt3 = pts1
        g1_entities = group1.entities
        face1 = g1_entities.add_face(pts1)
        puts "face1; ", face1
        puts "group1;", group1
      
        group2 = group1.copy()
        things2 = RotateFaces.create_rotated_face(group2.entities, pts1, pts1[0], pts1[3], -90.degrees)
        puts "create_rotated_face returned; ", things2
        pts2 = things2[0]
        face2 = things2[1]
        puts "group2;", group2
        # (10", 10", 0")
        # (10", 0", 0")
        # (10", 0", 10")
        # (10", 10", 10")
      
        group3 = group2.copy()
        things3 = RotateFaces.create_rotated_face(group3.entities, pts2, pts2[1], pts2[2], -90.degrees)
        puts "create_rotated_face returned; ", things3
        pts3 = things3[0]
        fac3 = things3[1]
        # (20", -0", 0")
        # (10", 0", 0")
        # (10", 0", 10")
        # (20", -0", 10")
        puts "group3;", group3
      
        group4 = group3.copy()
        things4 = RotateFaces.create_rotated_face(group4.entities, pts3, pts3[0], pts3[3], -90.degrees)
        puts "create_rotated_face returned; ", things3
        pts4 = things4[0]
        fac4 = things4[1]
        puts "group4;", group4
      
        puts "made it this far"
      
      rescue StandardError => e 
        puts "error last global outer try;", e
      end
      
      
      
      
      posted in Extensions & Applications Discussions
      J
      j_jones
    • Rotating faces to create a u-shape

      Hello, I am just learning the Ruby API and have a hopefully simple question.

      My goal is to draw a face in an arbitrary point in space (not at the origin). Then I want to copy the face and rotate it 90 degrees to create a corner shape. Then copy the second face and rotate it 90 degrees to create a u-shape

      This is some example code I came up with to do this, however, I'm running into a problem in that I can't seem to access the points of the rotated face. The positions of the points are identical the ones in the original face for some reason and do not reflect the transformed shape.

      Here is the script.

      
      
      model = Sketcup.active_model
      active_entities = model.active_entities
      
      # draw first face
      
      #     p3         p2 
      #      +---------+
      #      |         |
      #      |         |
      #      |         |
      #      |         |
      #      +---------+
      #     p0         p1
      
      model.start_operation("first face",true,false,true)
      
      pts = [[10,10,0], [20,10,0], [20,10,10], [10,10,10]]
      pt0, pt1, pt2, pt3 = pts
      group1 = active_entities.add_group
      g1_entities = group1.entities
      face1 = g1_entities.add_face(pts)
      
      # print out the vertexes of the first face
      puts("first group")
      group1.entities.each do |thing|
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      
      # end of first face
      model.commit_operation
      
      
      

      So far so good, here is the face, ready to go

      first face

      Now on to the second face

      
      
      model.start_operation("second face",true,false,true)
      
      # make a copy of the first face
      # then rotate it to create a corner shape
      
      #            pt0 
      #             +---------+
      #            /|         |
      #           / |         |
      #          /  |         |
      #         +   |         |
      #         |   +---------+
      #         |  /pt3
      #         | /
      #         |/
      #         +  
      
      group2 = group1.copy
      g2_entities = group2.entities
      
      axis = pt0.vector_to(pt3)
      angle = -90.degrees
      xform = Geom;;Transformation.rotation(pt0, axis, angle)
      group2.transform!(xform)
      
      # notice that the points of the group2 face have not been rotated
      #   they still reflect the points of the first face
      puts("second group")
      group2.entities.each do |thing|
         puts thing
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      # end of second face
      
      model.commit_operation
      
      
      

      Second face rotated, looks good except if I query the second face for the positions of its vertices, it just reports the same positions as the first face.

      second face

      By the way, I must be doing something really weird because when I run this script in Ruby Console Plus, it freezes and then goes blank. I haven't had any trouble with the console until I ran this script! I guess it's because I really should put all this logic into a module or class instead of just in the global namespace.

      Now I would like to rotate the second face to create a u-shape, but I don't know what points to pick because the points given don't reflect the rotation

      
      
      model.start_operation("third face",true,false,true)
      
      # make a copy of the second face
      # then rotate it to create a u-shape
      group3 = group2.copy
      g3_entities = group3.entities
      
      #         goal 
      #             +---------+
      #            /|         |
      #           / |         |
      #          /  |         |
      #         +---------+   |
      #         |   +-----|---+
      #         |  /      |
      #         | /       |
      #         |/        |
      #         +---------+  
      
      # at this point I don't really know which points to choose to create
      # the axis for rotating the third face as I don't seem to be able
      # to access the rotated shape's actual points?
      
      puts("third group")
      group3.entities.each do |thing|
         puts thing
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      # end of third face
      
      # model.commit_operation
      
      
      

      Thanks for any clues
      j_jones

      posted in Extensions & Applications Discussions
      J
      j_jones
    • Rotating faces to create a u-shape

      Hello again, I am just learning the Ruby API and am back with another simpler question.

      My goal is to draw a face in an arbitrary point in space (not at the origin). Then I want to copy the face and rotate it 90 degrees to create a corner shape. Then copy the second face and rotate it 90 degrees to create a u-shape

      This is the code I came up with to do this, however, I'm running into a problem in that I can't seem to access the points of the rotated face. The positions of the points are identical the ones in the original face for some reason.

      Here is the script.

      By the way, I must be doing something really weird because when I run this script in
      Ruby Console Plus, it freezes and then goes blank. I haven't had any trouble with the
      console until I ran this script!

      
      
      model = Sketcup.active_model
      active_entities = model.active_entities
      
      # draw first face
      
      #     p3         p2 
      #      +---------+
      #      |         |
      #      |         |
      #      |         |
      #      |         |
      #      +---------+
      #     p0         p1
      
      model.start_operation("first face",true,false,true)
      
      pts = [[10,10,0], [20,10,0], [20,10,10], [10,10,10]]
      pt0, pt1, pt2, pt3 = pts
      group1 = active_entities.add_group
      g1_entities = group1.entities
      face1 = g1_entities.add_face(pts)
      
      # print out the vertexes of the first face
      puts("first group")
      group1.entities.each do |thing|
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      
      # end of first face
      model.commit_operation
      
      
      

      So far so good, here is the face, ready to go

      first face

      Now on to the second face

      
      
      model.start_operation("second face",true,false,true)
      
      # make a copy of the first face
      # then rotate it to create a corner shape
      
      #            pt0 
      #             +---------+
      #            /|         |
      #           / |         |
      #          /  |         |
      #         +   |         |
      #         |   +---------+
      #         |  /pt3
      #         | /
      #         |/
      #         +  
      
      group2 = group1.copy
      g2_entities = group2.entities
      
      axis = pt0.vector_to(pt3)
      angle = -90.degrees
      xform = Geom;;Transformation.rotation(pt0, axis, angle)
      group2.transform!(xform)
      
      # notice that the points of the group2 face have not been rotated
      #   they still reflect the points of the first face
      puts("second group")
      group2.entities.each do |thing|
         puts thing
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      # end of second face
      
      model.commit_operation
      
      
      

      Second face rotated, looks good except if I query the second face for the
      positions of its vertices, it just reports the same positions as the first face

      second face

      BTW, at this point Ruby Console Plus tends to freeze and then ultimately goes blank and has to be restarted. I have no idea why.

      At this point I would like to rotate the second face to create a u-shape, but
      I don't know what points to pick because the points given don't reflect the rotation

      
      
      model.start_operation("third face",true,false,true)
      
      # make a copy of the second face
      # then rotate it to create a u-shape
      group3 = group2.copy
      g3_entities = group3.entities
      
      #         goal 
      #             +---------+
      #            /|         |
      #           / |         |
      #          /  |         |
      #         +---------+   |
      #         |   +-----|---+
      #         |  /      |
      #         | /       |
      #         |/        |
      #         +---------+  
      
      # at this point I don't really know which points to choose to create
      # the axis for rotating the third face as I don't seem to be able
      # to access the rotated shape's actual points?
      
      puts("third group")
      group3.entities.each do |thing|
         puts thing
         if thing.is_a?(Sketchup;;Edge)
           puts "#{thing.start.position} #{thing.end.position}"
         end
      end
      # end of third face
      
      # model.commit_operation
      
      
      

      Thanks for any clues
      j_jones

      posted in Newbie Forum
      J
      j_jones
    • RE: Thicker spirals without inner faces?

      @fredo6 said:

      The method is to draw a single spiral as a group, and then just rotate them and assign them colors, as you do.

      However, you need to have
      [list][]the start operation outside the loop on spirals
      [
      ]the creation of a group at the beginning of the spiral generation method. You basically create the group ( group = model.active_entities.add_group) and create the faces in that group ( ee = group.entities and face = ee.add_face....)

      For thickness, you need first to offset them from the origin. Otherwise, the spirals would collide at origin. You may want to draw a cylinder at origin as the starting point of the spirals. Second, there is no other way than to compute the offset of an individual spiral, which requires a little bit of calculation (there is no API for that unfortnately).

      Thank you this is helpful. I see now how to create a separate group for each spiral, that will help.

      As for the thickness issue, I am now trying to build my own box from each face which resulted in a new question!

      posted in Newbie Forum
      J
      j_jones
    • RE: [Plugin] Proper Animation V1.08 Beta(Updated 14/11/10)

      Does anyone still have a copy of this plugin? The original google pages site is long gone.

      Thanks for any info
      -j_jones

      posted in Plugins
      J
      j_jones
    • Thicker spirals without inner faces?

      I've started playing with the Ruby api aspect of Sketchup.

      I created this script to draw a spiral out of log spiral curves.

      
      module LogSpirals
      
        def self.rotate_thing(thing, rotation_angle)
          rotate_transform = Geom;;Transformation.rotation([0,0,0], [0,0,1], rotation_angle.degrees)
          thing.transform!(rotate_transform)
        end 
      
        def self.make_material(rgb, alpha)
          model = Sketchup.active_model
          r, g, b = rgb
          color = Sketchup;;Color.new(r, g, b)
          material = model.materials.add("Rainbow Face r #{r} g #{g} b #{b} alpha #{alpha}")
          material.color = color
          material.alpha = alpha
          material
        end
      
        def self.color_face(face, material)
          face.material = material
          face.back_material = material
        end
      
        def self.create_spiral(scale_factor, growth_factor, steps, z_offset, thickness, rotation, rgb, alpha)
          model = Sketchup.active_model
          entities = model.active_entities
          
          model.start_operation("log_spiral",true,false,true)
          
          # create a spiral starting at the origin
          spiral_points = []
      
          (0..steps).each do |angle|
            theta = angle.degrees
            r = scale_factor * Math.exp(growth_factor * theta)
            x = r * Math.cos(theta)
            y = r * Math.sin(theta)
      
            # subtract 10 so the spiral starts at the origin
            x2 = (x * 100) - 10
            y2 = y * 100
            point = Geom;;Point3d.new(x2, y2, 0)
            spiral_points << point
          end
      
          # make a copy of the spiral offset up the z axis by z_offset    
          spiral_points2 = spiral_points.map{ |point| point.offset([0, 0, z_offset]) }
      
      
          material = self.make_material(rgb, alpha)
      
          # turn it into a solid with thickness
          (0...steps).each do |i|
            pts = [spiral_points[i], spiral_points[i+1], spiral_points2[i+1], spiral_points2[i]]
            # create a face along the spiral
            face = entities.add_face(pts)
            # color the face
            self.color_face(face, material)
            # extend the face to have a thickness
            face.pushpull(thickness)
          end
      
          # create a group out of the spiral
          spiral_group = entities.add_group(entities.to_a)
          # rotate the spiral the given degrees
          self.rotate_thing(spiral_group, rotation)
          
          # refresh the view so the spiral is drawn
          model.active_view.refresh
          model.commit_operation
        end
      end #LogSpirals Module
      
      
      scale_factor = 0.1
      growth_factor = 0.4
      steps = 360
      z_offset = 10
      thickness = 0
      # 1          2          3        4          5          6          7         8          9           10         11       12
      # yellow     yellow-g   green    green-cyan cyan       cyan-blue  blue      mage-blue  magenta     red-mage   red      orange
      # 255,255,0  255,127,0  0,255,0  0,255,127  0,255,255  0,127,255  0,0,255   127,0,255  255,0,255   255,0,127  255,0,0  255,127,0
      # 30,        60         90       120        150        180        210       240        270         300        330      360
      color_yellow =       [255,255,0]
      color_yellow_green = [127,255,0]
      color_green =        [0,255,0]
      color_green_cyan =   [0,255,127]
      color_cyan =         [0,255,255]
      color_cyan_blue =    [0,127,255]
      color_blue =         [0,0,255]
      color_magenta_blue = [127,0,255]
      color_magenta =      [255,0,255]
      color_red_magenta =  [255,0,127]
      color_red =          [255,0,0]
      color_orange =       [255,127,0]
      
      colors = [color_yellow, color_yellow_green, color_green, color_green_cyan, color_cyan, color_cyan_blue, color_blue, 
        color_magenta_blue, color_magenta, color_red_magenta, color_red, color_orange]
      angles = [30,60,90,120,150,180,210,240,270,300,330,360]
      alpha = 0.5
      
      # this doesn't quite work as it keeps duplicating all the work over and over
      # (0...12).each do |i|
      #  color = colors[i]
      #  angle = angles[i]
      #  spiral = LogSpirals.create_spiral(scale_factor, growth_factor, steps, z_offset, thickness, angle, color, alpha)
      # end
      
      i = 11
      rotation = angles[i]
      color = colors[i]
      spiral = LogSpirals.create_spiral(scale_factor, growth_factor, steps, z_offset, thickness, rotation, color, alpha)
      
      

      The first result is ok, but I decided I wanted to have thicker arms to each spiral.

      thin spirals: https://drive.google.com/file/d/1sF3KD4oTrsLs0IzA4099fzoaGW2zUzZq/view?usp=drive_link

      thin spirals

      thicker spirals: https://drive.google.com/file/d/1MS-RIx5OlmCeZwGkQi9QI3zvcOLmS53K/view?usp=drive_link

      thicker spirals

      I sort of solved this by adding a pushpull to each face of the arm, however, this creates a bunch of overlapping and internal faces that are visible in the finished model.

      Is there a way to make the arms thicker without all these internal and overlapping faces?

      Thanks for any ideas
      j_jones

      posted in Newbie Forum
      J
      j_jones