Hide geometry lines with Ruby

Hello everyone,
I created this beam structure using “Api Ruby”
when I insert it in the Sketchup model
the lines of construction of the curved parts are visible…
Using the command “Soften Edges” I get the visual result I want…
It’s possible with " Api Ruby" to get the same result…
Some advice please…
I read in the online manual of the Api Ruby, of the method “Soft” e “Soomth”…
But I don’t think it’s so easy to apply to the created component…

Thank you for your help…

Joseph

Img_2

Take a look at Edge#soft= and Edge#smooth=. You will need to set these true for each edge in your curved surface.

Thanks for the answer, if you find a moment of time,
try to look at these other images that I created…
The image “Img_1.png” corresponds to the ruby code line,
see “Img_1_cod1.png”…etc…
The image “Img_4.png” and “Img_4a” are the visual result that I would like to get,
not within the program “Sketchup” manually,
but I thought it was possible simply in a line of ruby code,
call the same command “soft coplanar”…thank you for your help…

Greetings

Joseph.

Img_1






I assume you want to smooth/soften edges that meet a certain criteria…
Let us say that this smoothing is to do with the angle between that edges two faces normal - i.e. just like the manual context-menu tool…
e.g.

group_prot.entities.grep(Sketchup::Edge).each{|e|
  fs = e.faces
  n0 = fs[0]
  n1 = fs[1]
  ang = n0.angle_between(n1)
  if ang >= 90.degrees # or other angle you choose
    e.smooth = false
    e.soft = false
  else
    e.smooth = true
    e.soft = true
  end
}

There are methods to differentiate between the angle being concave or convex - my example ignores that and any edges meeting at an angle < 90° are smoothed… including coplanar [which can also be trapped for too]…

Please post code correctly, not images of code.

Hi, I’m attaching the full code…

Joseph.
copia_14062020_No_comment_proteo_param.rb (15.4 KB)

Hello, thank you for your reply, I study the example of code you sent me and try to see if I can make the visual change I want to get…

Joseph.

Hello to you all,
I would have solved it this way,
look at the “png” images…

Greetings

Joseph.

p.s. I’m sorry, I’m not quite sure yet how to insert “pieces of code”,
without having to use the image of the code…

Please see @DanRathbun’s reply up on June 14th, 2020 (above)

1 Like

As has been said…
Please learn how to format and post code, it’s all but impossible to debug an image…

Also please stop referring to the dotted lines as ‘construction lines’.
Guides, also known as construction-lines, are quite different from geometry.
What you show are smoothed [and perhaps hidden] edges, which will also display as ‘hidden-geometry’ - with different dot-patterns, but these are real edges forming the perimeter of faces within a surface…

1 Like

Oops… My writing mistake…

Greetings

Joseph.

Hello to you all,
the portion of code should now be formatted in correct way…

Greetings

Joseph.

##
edges = [] 
     group_prot.entities.each do |e| 
        if e.is_a? Sketchup::Edge 
          edges << e 
        end
     end
    
     edges.each do |e|
        if (e.length == 16.314445.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 14.088546.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 13.036009.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 13.463477.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 14.754000.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 17.710000.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 21.348000.cm) then
             e.smooth = true
             e.soft = true
        elsif (e.length == 25.551000.cm) then
             e.smooth = true
             e.soft = true
        end
     end
##

#####################

##
face_04up = group_prot.entities.add_face(pt_06,pt_06t,pt_07t,pt_07)
      
	linea_hide_face_04up = group_prot.entities.add_line(pt_06,pt_06t)
	linea_hide_face_04up.smooth = true
	linea_hide_face_04up.soft = true
	  	  
face_05up = group_prot.entities.add_face(pt_07,pt_07t,pt_08t,pt_08)
      
	linea_hide_face_05up = group_prot.entities.add_line(pt_07,pt_07t)
	linea_hide_face_05up.smooth = true
	linea_hide_face_05up.soft = true
	  
face_06up = group_prot.entities.add_face(pt_08,pt_08t,pt_09t,pt_09)
face_07up = group_prot.entities.add_face(pt_09,pt_09t,pt_10t,pt_10)
face_08up = group_prot.entities.add_face(pt_10,pt_10t,pt_10t_,pt_10_)
face_09up = group_prot.entities.add_face(pt_03t_,pt_03_,pt_04_,pt_04t_)
face_10up = group_prot.entities.add_face(pt_04t_,pt_04_,pt_05_,pt_05t_)
face_11up = group_prot.entities.add_face(pt_05t_,pt_05_,pt_06_,pt_06t_)
      
face_12up = group_prot.entities.add_face(pt_06t_,pt_06_,pt_07_,pt_07t_)
      
	linea_hide_face_12up = group_prot.entities.add_line(pt_06t_,pt_06_)
	linea_hide_face_12up.smooth = true
	linea_hide_face_12up.soft = true
	  
face_13up = group_prot.entities.add_face(pt_07t_,pt_07_,pt_08_,pt_08t_)
      
       linea_hide_face_13up = group_prot.entities.add_line(pt_07t_,pt_07_)
       linea_hide_face_13up.smooth = true
       linea_hide_face_13up.soft = true
##

###########################################