Create face point

From Macros Wiki
Jump to: navigation, search

! create a point in the middle of each selected face
! --------------------------------------------------

get_selected_solid_list  ! get list of selected solids
 
num_solids = number_of_solids
if num_solids<1 then stop "Please select at least 1 face"
 
num_points = 0
 
for i=1 to num_solids
sol_ref = next_solid_ref


get_solid_selected_face_list sol_ref
num_faces = number_of_faces


for j=1 to num_faces
face_ref = next_face_ref


! get the extents of the face in uv space
! ---------------------------------------


get_solid_face_uv sol_ref, face_ref, u1, v1, u2, v2


! get the xyz position of the middle of the face in uv space
! ----------------------------------------------------------


uu = (u1 + u2)/2
vv = (v1 + v2)/2


get_solid_face_point sol_ref, face_ref, uu, vv, xx, yy, zz


point xx, yy, zz                    ! create the point


next j
next i
 
redraw