Notifications
Clear all

[Closed] How to generate quads meshes?

Hi there!

I want to generate a quad mesh, but I only can do it with triangles. Is there any function to do it with maxscript?

Thanks in advance.

5 Replies

create 2 triangles side by side and hide the intervening edges and voila a quad.

Thanks for your reply Klvnk, but how I can hide the intervening edge? I mean, what instruction I should use for do this?

plugin simpleObject simplequad
	name:"quad"
	classID:#(0x680719e7, 0x127ffe63)
	category:"Scripted"
(
	parameters main rollout:params
	(
		width			type:#float  	default:25.0 	ui:ui_width;
		height			type:#float  	default:25.0 	ui:ui_height;
	)	
	
	rollout params "Params"
	(
		local updating = on
		spinner ui_width   "Width:" range:[0, 1e9, 0] fieldwidth:64 type:#float align:#right;
		spinner ui_height  "Height:" range:[0, 1e9, 0] fieldwidth:64 type:#float align:#right;
	)	

	tool create
	(
 		on mousePoint click do case click of
 		(
 			1: 
 			(
 				nodeTM.translation = gridPoint
				width = height = 0.01;
 			)
 			3: #stop
 		)
 		on mouseMove click do case click of
 		(
 			2: width = gridDist.x
			3: height = gridDist.y;
 		)
	)

	fn doBuildMesh =
	(
		nverts = 4;
		nfaces = 2;
		
		setNumVerts mesh nverts;
		setNumFaces mesh nfaces;
		
		setvert mesh 1 [-width * 0.5, -height * 0.5, 0.0];
		setvert mesh 2 [width * 0.5, -height * 0.5, 0.0];
		setvert mesh 3 [width * 0.5, height * 0.5, 0.0];
		setvert mesh 4 [-width * 0.5, height * 0.5, 0.0];
	
		setface mesh 1 [1,2,3];
		setEdgeVis mesh 1 1 true;
		setEdgeVis mesh 1 2 true;
		setEdgeVis mesh 1 3 false;
		
		setface mesh 2 [3,4,1];
		setEdgeVis mesh 2 1 true;
		setEdgeVis mesh 2 2 true;
		setEdgeVis mesh 2 3 false;
		
		update mesh;
	)
	
	on buildmesh do doBuildMesh();
	on update do doBuildMesh();
)

Thanks Klvnk! setEdgeVis has solved my problem.

After dealing with setEdgeVis, this isn’t the command I’m looking for. This hide the specified vertexs, but doesn’t convert two triangles into a quad