Notifications
Clear all

[Closed] BuildMesh plugin

Hi everybody,

i want to create a plugin for architecture elements.

i call my referance vertex points from file than re-orient them

for example; i have vertex array, than i put it on Z=0, and copy vertexs array, re-orient X axis to tan45 and add them “Custom Z” from mouse point than put that values to Z axis for 45 degree and mirror that X and away from that point to “Custom X”, re copy first vectors and add them “Custom X”
basicly i create a frame by vertex points.

now i have a two problems.

first one is “faces” code, i think it’s not smart. do you have a more smart ideas?

and i want to make a new mesh inside of mesh, like sub-mesh, for painting or something, ofcourse users see one mesh, but i want to “named” to sub mesh for oriantation, how can do it?

on buildMesh do (

		
		local verticles =#()
		local faces = #()
		local firstverticles = #()
		local secondverticles = #()
		local thirdverticles = #()
		local fourthverticles = #()
		
		local edge_vis = #()
		
		local profile_start = GetFileforCoordinate "DoorFrame/frame_1_1.txt"
		local profile_end = GetFileforCoordinate "DoorFrame/frame_1_2.txt"
		
		for i = 1 to profile_start.count do (
			append firstverticles (profile_start[i] + [0, Custom_Y/2,0])
		)
		for i = 1 to profile_end.count do (
			append firstverticles (profile_end[i] + [0, -Custom_Y/2,0])
		)
		local presecondverticles = ConvertVertexCorner firstverticles
		local maxZ = findMaxZ presecondverticles
		
		for i = 1 to presecondverticles.count do (
			append secondverticles (presecondverticles[i] + [0, 0, Custom_Z] + [0,0,maxZ])
		)
		local prethirdverticles = ConvertVertexMirror presecondverticles
		for i = 1 to prethirdverticles.count do (
			append thirdverticles (prethirdverticles[i] + [Custom_X, 0, Custom_Z] + [0,0,maxZ])
		)
		local prefourthverticles = ConvertVertexMirror firstverticles
		for i = 1 to prefourthverticles.count do (
			append fourthverticles (prefourthverticles[i] + [Custom_X, 0,0])
		)
		
		local verticles = firstverticles + secondverticles + thirdverticles + fourthverticles
		
		
		
		
		

		
		for i = 1 to verticles.count/2 do (
         	if i < verticles.count/4 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			if i == verticles.count/4 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			
			if i > verticles.count/4 and i != verticles.count/2 do (
				append faces ([((i - verticles.count/4)+1),0+i,1+i])
			)
			if i == verticles.count/2 do (
			)
			
		)
		
		for i = verticles.count/4 + 1 to verticles.count * 3/4 do (
			if i < verticles.count/2 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			if i == verticles.count/2 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			if i > verticles.count/2 and i != verticles.count * 3/4 do (
				append faces ([((i - verticles.count/4)+1),0+i,1+i])
			)
			if i == verticles.count * 3/4 do (
			)
		)
		
		for i = verticles.count/2 + 1 to verticles.count do (
			if i < verticles.count * 3/4 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			if i == verticles.count * 3/4 do (
				append faces ([(verticles.count/4)+i,1+i,0+i])
			)
			if i > verticles.count * 3/4 and i != verticles.count do(
				append faces ([((i - verticles.count/4)+1),0+i,1+i])
			)
			if i == verticles.count * 3/4 do (
			)
		)
		
		
		
		
		setMesh mesh verts:verticles faces:faces
		
		
		for i = 1 to faces.count do (
			setEdgeVis mesh i 1 false
		)
	)