ScriptSpot

Forum topic · General Scripting

Selecting face by axis

By Goonda · 2012-08-16

Description

How can i select and delete all the faces of a mesh which lies say in +x or -x axis....that is how can i access polygons on the basis of axis??

Comments (5)

( local deg = 46 /* defines

Graph · 2012-08-17


(
	local deg = 46  /* defines the max angleDifferential to straight up for deletion */
	
	--------------------------------------------------------------------------
	--------------------------------------------------------------------------
	
	with undo on
	(
		for Obj in selection as array where isValidNode Obj AND superclassOf Obj == geometryClass do
		(
			convertToPoly Obj
			
			polyop.deleteFaces Obj  ((for f = 1 to Obj.numFaces collect if acos (dot (polyOp.getFaceNormal Obj f node:Obj) [-1,0,0]) < deg then f else 1) as bitArray) delIsoVerts:true
		)
	)
	completeRedraw()
)--END local

don't have access to max atm but that should do it

Graph · 2012-08-16

check the Code page of my website got 2 snippets there that'll show you how to do it

Goonda · 2012-08-16

Thanks Graph.....This is exactly what i need...but I want to delete faces left/right half....not the top/botoom ones, I have tried some of them....it is deleting the faces in Z zxis....but then crashing max if I try something else!!

Goonda · 2012-08-16

Ok...got it.....Thanks a lot Graph....its working now!!!:)

Goonda · 2012-08-17

It is not working on a box...as the script is based on angle of normals!! Is there any way to delete the faces purely based on the location of there normals (not angle)?? So that I can delete all faces whose normals are situated in -X axis (global)?