Bbox Border plane and attach all mesh

Hi !
I looking for to create a little script who makes planes around my bounding box : like this picture ...

http://img15.hostingpics.net/pics/230428bboxplane.jpg

I don't need the top and bottom plane.

And I need too another script can attach all mesh together without lost Texture Information.

Someone know how I can do this?

Regards

Kasimashi

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

One of the textures can be

One of the textures can be saved. You have tochoos which one.

Kasimashi's picture

:)

Works perfectly thanks you :)

But what about Attach all mesh ?

miauu's picture

How exactly do you want to

How exactly do you want to preserve the textures? If you have a Box and in the diffuse slot you have bitmap with texture - "forest.jpg",and you have a Sphere with the bitmap with texture -"rain.jpg" in the diffuse slot, when you attach the Box and the Sphere w\ich of the bitmaps should be assigned to the diffuse slot of the new object?

Kasimashi's picture

Ok !!!!!

Ok That why the initial texture is lost !!! :D ok ! :D

Thanks you !!! :D

Have a nice day :)

Regards

Kasimashi

miauu's picture

Try this:

A better method to detect the plane width and length can be added, but I don't have time right now.

(
	fn planesOverFaces obj orient = 
	(	
		local planeArr = #()
		local ev = polyop.getEdgeVerts
		local gv = polyop.getvert
		local gfe = polyop.getFaceEdges
		local gfsc = polyop.getSafeFaceCenter
		local gfn = polyop.getFaceNormal
		local allFaces = (obj.Faces as bitarray) as array
		for f in allFaces do
		(
			getEdges = gfe obj f
			local sizeArr = #()
			for i in getEdges do
			(
				append sizeArr (distance (gv obj (ev obj i)[2]) (gv obj (ev obj i)[1]))
			)
			if orient == 0 then
			(w = amin sizeArr ; l = amax sizeArr)
			else
			(l = amin sizeArr ; w = amax sizeArr)
			fc = gfsc obj f
			nf = gfn obj f
			xv = normalize (cross nf [0,0,1])
			yv = normalize (cross nf xv)
			thePlane = plane length:l width:w lengthsegs:1 widthsegs:1 name:(uniquename "FacePlane")\
			isSelected:on wirecolor:(random black white) transform:(matrix3 xv yv nf fc)
			append planeArr thePlane
		)
		select planeArr
	)
 
	fn createBoxAsCage obj = if isValidNode obj do
	(
		local bb = in coordsys local nodeLocalBoundingBox obj
		local wX = abs((bb[1]-bb[2]).x) , lY = abs((bb[1]-bb[2]).y) , hZ = abs((bb[1]-bb[2]).z)
		local cage = convertToPoly (box width:wX length:lY height:hZ mapcoords:on name:"Cage" wirecolor:black)
		CenterPivot cage
		local tm = obj.transform
		tm.row4 = obj.center
		cage.transform = tm
		polyop.deleteFaces cage #{1,2}
		planesOverFaces cage (if wX < hZ then 0 else 1)
                delete cage
	)
	createBoxAsCage selection[1]
)
miauu's picture

As planes:

(
	selObj = selection[1]
	theWidthX = abs (selObj.max.x - selObj.min.x)
	theLengthY = abs (selObj.max.y - selObj.min.y)
	theHeightZ = abs (selObj.max.z - selObj.min.z)
	boxAsCage = box width:theWidthX length:theLengthY height:theHeightZ --boxMode:true
	CenterPivot boxAsCage
	boxAsCage.pos = selObj.center
	boxAsCage.pivot = selObj.pivot
	convertToPoly boxAsCage
	polyop.deleteFaces boxAsCage #{1..2}
 
	for f = polyop.getNumFaces boxAsCage to 1 by -1 do
		polyop.detachFaces boxAsCage #{f} delete:true asNode:true  node:boxAsCage
)
Kasimashi's picture

:p

Thanks ! but last thing :) It's standard primitive plane not a editable poly :)

Regards Friend !

barigazy's picture

...

Hey dude you are not serious. Next time be more specific. On this forum I already write snippet for plane aligment. You need to find this by yourself.

barigazy

Kasimashi's picture

I'm really Sorry

I'm really Sorry :(

Yes but don't work correctly, the plane have not exactly the same dimension than face :(

look : http://img15.hostingpics.net/pics/217522exempledontwork.png

(green : default box with you script you have been write)
(yellow : the script wrote before a few month ago )

Regards

Kasimashi

barigazy's picture

Hey Kostadin,

you left over one dead geometry using detach method, because after detaching all four faces main object stay dead. :)

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.