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

    jim130

    @jim130

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

    jim130 Unfollow Follow
    registered-users

    Latest posts made by jim130

    • 3d text

      Hi my name is Jim and I’ve come to the Ruby Sketchup forum before and have been helped so much.
      As I’ve said before I’m new to Ruby and only get to work on my project in the winter so I’m back.
      I’ve tried the Quantum wave function method were you pound your head on the keyboard until the right combination of keys are intersected. But that hasn’t worked. So much for the wave function!

      I’ve printed out and read as much of the Ruby Sketchup API as I can find that applies to 3d text and how to get it to the face of an object but have not progressed very much.
      I’ve created a program to generate a geodesic and am at the point that I need to identify each triangle with a number on its face as well as two numbers at each vertices. After failing to place 3d text on the face of the triangle I went ahead and use 2d text at the vertices but that does not do what I really need.
      I need a 3d text on the surface that I can push pull and have some depth with. As I want to 3d print the form’s for a triangular block for a pizza oven build and each block needs to have its ID embossed into it. Among other things that I want to do with this.
      The way I have approached this is that each triangle is created one at a time in a loop. So that each time the triangle needs to gets the appropriate text placed on its face before going out of the loop and coming back and creating the next triangle.

      I am creating a bounding box with my text inside a bounding box and some were near the center but two major problems appear.

      1. The feedback on the center and corner numbers on the bounding box are not any wear close to wear they should be and

      2. I’ve tried everything I can think of to turn my text variable “m”, the triangle count number into a variable and Ruby won’t allow it.

      I’ll place the code I think you will need so you can see what I am doing and hopefully you can find the errors of my way.

      It’s either that or I’m back to the wave function.

      Thanks again.
      Jim.

      Here is the code.

      polygon_index = pm.add_polygon([pts_xyz_at_n[0] , pts_xyz_at_n[1] , pts_xyz_at_n[2]] )

        #puts" make triangle #{m}"
      
        try = []
        try[0] = pts_xyz_at_n[0]
        try[1] = pts_xyz_at_n[1]
        try[2] = pts_xyz_at_n[2]
      
        entities = mod.active_entities  
      
        group = Sketchup.active_model.entities.add_group   #Add the group to the entities in the model
      
        entities = group.entities             # Get the entities within the group
      
        face = entities.add_face try   # Add a face to within the group
      
        edges = face.edges
      
        status = face.reverse!
      
        normal = face.normal
      
        puts" The normal of triangle face # #{m} is ? #{normal}"
        
        area = face.area
      
        puts "The area of triangle # #{m} is  #{area}"
        
       Sketchup.active_model.entities
      
        model = Sketchup.active_model
      
        entities = mod.active_entities
      
        ################# adds 3d text on at 0,0,0 ######################
      
        group = ent.add_group   # Add the group to the entities in the model
      
        entities = group.entities   # Get the entities within the group
      
        boundingbox = model.bounds
      
        model_bb = model.bounds
      
        ############## adding 3d text to model ###################
        
        success = entities.add_3d_text( "m", TextAlignLeft, "Arial", is_Bold = 0.0 , is_italic = 0.0,letter_height = 0.025, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0)
      

      puts " success = #{success}"

        first_entity = model.entities[0] 
      
        first_entity_bb = first_entity.bounds
      
        fs_b = first_entity_bb
      
        puts"first_entity = #{fs_b}"
      
        boundingbox.empty?
      
        ptb_1 = boundingbox.center
      
        puts" boundingbox center = #{ptb_1}"
      
        corner_ = boundingbox.corner(0)
      
        puts" boundingbox corner(0) = #{corner_}"
      
        group.to_component
        
        m  =  m  +  1                    #### incrementing  m
      

      Here is the output.

      Points and side length for triangle # 9

      Point, # 1 is [3, 3] and has the co ordinance of [0.13238464691208032, 0.2812274564551052, 0.9504658978615464]

      Point, # 2 is [4, 2] and has the co ordinance of [6.005807236859207e-17, 0.19473874066922284, 0.9808551487771093]

      The length of side 1 of triangle # 9 is between point [3, 3], and point [4, 2], for a length of 0.16102639307745903

      Point, # 2 is [4, 2] and has the co ordinance of [6.005807236859207e-17, 0.19473874066922284, 0.9808551487771093]

      Point, # 3 is [4, 4] and has the co ordinance of [5.719967031754901e-17, 0.3568220897730899, 0.9341723589627158]

      The length of side 2 of triangle # 9 is between point [4, 2], and point [4, 4], for a length of 0.16867215218162387

      Point, # 3 is [4, 4] and has the co ordinance of [5.719967031754901e-17, 0.3568220897730899, 0.9341723589627158]

      Point, # 1 is [3, 3] and has the co ordinance of [0.13238464691208032, 0.2812274564551052, 0.9504658978615464]

      The length of side 3 of triangle # 9 is between point [4, 4], and point [3, 3], for a length of 0.1533157615327414

      333 The normal of triangle face # 9 is ? (0.039739, 0.276548, 0.960178)

      The area of triangle # 9 is 0.01117362776006554

      The bounding box output stuff.

      success = true

      first_entity = #Geom::BoundingBox:0x00000248a3959ac8

      boundingbox center = (0", 0", 0.079675")

      boundingbox corner(0) (-0.850651", -0.850651", -0.850651")

      number of triangles = 10

      Frequency = 8

      Radius = 1.0

      I think I can get the text to the face if I can just get the bounding box right and its cooridnates.


      screen shot

      posted in Developers' Forum
      J
      jim130
    • Sketchup Pro 16 crashes when I go to save, every time.

      Sketchup Pro 16 crashes when I go to save, every time.
      I set my backup time for one minute and then wait for a minute before I attempt save.
      so when I go back to work on the file the next time I go and get the last auto save and I recoup my file that way.

      posted in Newbie Forum sketchup
      J
      jim130
    • RE: How can I draw a circle on a slope

      Thanks TIG
      I’ve have been beating my head against the code and am starting to get it.
      I do have one more question about the angle circle code though
      what does the "tptr" do in this statement? It looks like it is multiplying the two points together "inst = cents.add_instance(defn, tptr)"

      posted in Newbie Forum
      J
      jim130
    • RE: How can I draw a circle on a slope

      TIG
      Thank you very much.
      I applied the code and it worked perfectly. I did make a modification to it as I was really looking for arcs in those circles.
      But with few modifications I was able to achieve my goal. I had given up on the arcs and thought circles would be easier but still had to ask for help.
      Thanks again.
      One question about your solution, for me it is very hard to follow all the different group statements and there logical order. Without the logical understanding it is very hard to move forward in writing code.
      I am probably not alone, and I was wandering if you could give a more thorough treatment of the grouping statements.
      I’ve always been befuddled by the progression of these statements.
      Thank you
      Jim

      posted in Newbie Forum
      J
      jim130
    • RE: How can I draw a circle on a slope

      This is my attempt at making and rotating the circle.
      This is inside a loop so that angle_a changes each time through.
      Without the two lines of code to make the transformation rotation, the grouped circle is created.
      But when I add the transformation.rotation I get the error message "wrong number of arguments (5 for 3)"
      The coke:

      centerpoint = Geom::Point3d.new

      vector = Geom::Vector3d.new 1,0,0

      vector2 = vector.normalize!

      model = Sketchup.active_model

      entities = model.active_entities

      circle = mod.active_entities

      group=circle.add_group # Add the group to the entities in the model

      edges = entities.add_circle centerpoint, vector2, 1,100 # at this point a circle is made

      but when I add the next two line I get the error message.

      pt1 = 0,0,0

      transformation = Geom::Transformation.rotation pt1, 0,1,0, angle_a.radians

      posted in Newbie Forum
      J
      jim130
    • RE: How can I draw a circle on a slope

      Sorry I should have been more specific.
      Using Ruby in Sketchup: how to draw a circle and through the use of a loop to make copies of it rotated around the Y axis incremented by an angle each reiteration.

      Thanks for all the responses.
      Jim

      posted in Newbie Forum
      J
      jim130
    • How can I draw a circle on a slope

      I need to draw a set of circles with in a loop with the center and 0,0,0 and all having the same radius but having the normal vector increment each time through the loop. So that each circle is sloped at a deferent angle.

      posted in Newbie Forum sketchup
      J
      jim130