ScriptSpot

Forum topic · General Scripting

Offset Verts to face normal

By JokerMartini · 2013-06-25

Description

What I'm trying to do is move the verts of the tube object, so they are align to the normal + an offset from the faces found at the end of the box, which are faces 9,10. See attached image for reference.


delete objects

b = box width:30 length:80 height:2 wirecolor:blue
convertToMesh b --collapse to Editable_Mesh
move b [random -10 10,random -10 10,random 0 10]
rotate b (eulerAngles (random -360 360) (random -360 360) (random -360 360))
--meshop.extrudeFaces b #{9..10} 5.0 0.0 dir:#common --extrude the single face	
	
t = tube radius1:4 radius2:2 sides:8 heightsegs:1 wirecolor:yellow
convertToMesh t --collapse to Editable_Mesh

-- Move TUBE's verts to align to the normal of faces #{9..10}
Attachments
Comments (2)

JokerMartini · 2013-06-26

the whole object but on the vertices level.

brttd · 2013-06-26

Do you need the vertices, or whole object?

If the whole object, you could center the tubes pivot, and place it in the center of the face. You would also need to offset it in the direction of the face normal(by the radius of the tube), and rotate it.