Notifications
Clear all
[Closed] How to make planar baseed on the selected face with maxscript?
Jun 10, 2020 7:22 pm
Hello guys,
I know from editable_poly there is a make planar tool , but it seems make all selected faces planar to an average direction. What I want is :
-
select one face as target
-
make other faces planar based on the target
Any suggestions?
2 Replies
Jun 10, 2020 7:22 pm
- get selection center
- project all verts of the selection to the plane
delete objects
gc light:true
obj = plane widthsegs:7 lengthsegs:7 width:100 length:100 isSelected:true
convertToPoly obj
polyop.setFaceSelection obj #{1..8, 14..15, 21..22, 28..29, 35..36, 42..49}
t = Box boxmode:true
rotate t (EulerAngles 22 44 66)
proj_plane_normal = t.dir
face_selection = polyop.getFaceSelection obj
proj_plane_center = [0,0,0]
for f in face_selection do proj_plane_center += polyop.getFaceCenter obj f
proj_plane_center /= face_selection.numberset
vert_selection = polyop.getVertsUsingFace obj face_selection
for v in vert_selection do
(
pt = polyop.getVert obj v
distance_to_plane = dot (pt - proj_plane_center) proj_plane_normal
projected_point = pt - distance_to_plane * proj_plane_normal
polyop.setVert obj v projected_point
)
redrawViews()