Notifications
Clear all

[Closed] convert faceselection to normals

Hi there!

i am a beginner in maxscript and want to convert a polygon selection from my editablepoly to a normalselection so i can set all the normals of the poly to the facenormal

i tried a lot but always got undefined when using the editNormals.ConvertFaceSelection stuff and dont know how to get it right …

so here is what i wrote till now (which is an absolute disaster, i know, but i am learning, hehe)


Objs = $

for obj in Objs do
(
	faces = obj.selectedFaces

	for face in faces do
	(	
		-- selectedFaces.index
		select face
		faceString = polyop.getFaceSelection $ as string
		faceString = substring faceString 3 -1
		faceString = substring faceString 1 (faceString.count-1)
		faceInt = faceString as integer

		faceNormal = polyop.getFaceNormal obj faceInt
			
		bitFaceSel = obj.editNormals.GetSelection 
		obj.editNormals.ConvertFaceSelection bitFaceSel faceNormals
		print faceNormals	   
)  
	select faces
	print faces
)

thx a lot

6 Replies

editnormals is a modifier, if the object deosn’t have an Edit Normals modifier then it will return undefined. Make sure you actually apply the modifier first on the object or in the code somewhere first.

-Eric

i already have the modifier on the object, but would be also interesting how to add it via script.

1 Reply
 eek
(@eek)
Joined: 1 year ago

Posts: 0

addModifier obj (edit_normals()) before:int

thx

hmm i dont get all of this, (coming from maya, mel) it all seems so complicated… hehe

would be really great if someone could give me a hint on this

i want:
get faceselection to get the facenormal
convert it to a normalselection to set those normals to the facenormal

should be easy, but i just dont get maxscript… seems like it will take a while to understand it… hehe

thx

 eek

I dont get what your trying to do?

get a face selection, get the normals of those faces then set the normals of those faces to the same normals?

if you want to just print the face normals of bunch of selected faces its simple (this is for an edit mesh NOT poly)

for f = 1 to selection[1].selectedFaces do
(
print (getFaceNormal selection[1] selection[1].selectedFaces[f].index)
)

havent tested this.

thx, for writing back

so here is what i want to do:

i want to select certain polys, they got a specific face normal (perpendicular to the plane which is made out of all vertices of the poly)
then i want all the vertexnormals which are from this face or poly, then i want to set those vertexnormals to be the same as the facenormals

so if i have a some smoothing groups applied on a, lets say a bevel-cube so that the bevel is smooth, the normals are pointing 45° outwards or something, and i want them to be perpendicular to the “main-face” so pointing up

hope you understand now…

thx a lot