Hello, I’m working on modeling objects using the Followme function. If you do face.followme(edge), the result is Boolean, so I have to change the Face to Group or ComponentInstance to perform followme.
The flowme to the Z-axis operates normally, but sometimes it does not work normally with the X-axis.
The way we’re going is to click on the lines and enter the code. I’d like to ask you, including the picture that is error-prone.

The code is as follows.
Why? I need your help.

ents = Sketchup.active_model.entities
sel = Sketchup.active_model.selection
b = 100/25.4
h = 100/25.4
t1 = 6/25.4
t2 = 8/25.4
eee= (h/2 - t2)
sel.each do |ss|
	if ss.is_a?(Sketchup::Edge)
		po = ss.start.position
		x = po.x
		y = po.y
		z = po.z
		pts = Array.new
		pts1 = Array.new					
		pt1 = Geom::Point3d.new(x - b/2, y , z + h/2)
		pt2 = Geom::Point3d.new(x + b/2, y , z + h/2)
		pt3 = Geom::Point3d.new(x + b/2, y , z - h/2)
		pt4 = Geom::Point3d.new(x - b/2, y , z - h/2)
		pt5 = Geom::Point3d.new(x - (b/2-t2) , y , z + (h/2-t1))
		pt6 = Geom::Point3d.new(x + (b/2-t2), y , z + (h/2-t1))	
		pt7 = Geom::Point3d.new(x + (b/2-t2), y , z - (h/2-t1))
		pt8 = Geom::Point3d.new(x - (b/2-t2), y , z - (h/2-t1))
		pts.push(pt1, pt2, pt3, pt4)
		pts1.push(pt5, pt6, pt7, pt8)		
		face = ents.add_face(pts)
		face1 = ents.add_face(pts1)
		gp = ents.add_group(face)
		cp = gp.to_component		

Could you elaborate what issue you are having?

Also, if you wrap the code in triple backticks (```) it will be displayed as code with proper indentation. Opening with “```ruby” also adds Ruby syntax highlighting.

The problem is that the edge and the face are in different contexts when you do the followme.

    gp = ents.add_group(face); gt = gp.transformation
    ents.transform_entities(gt.inverse,ss);#put edge in gp
    ents.transform_entities(gt,ss);#take edge out of gp
1 Like

Thank you. I’m going to run it with the code you wrote me, and it works the way I wanted it to.