PDA

View Full Version : HELP. I can't delete faces or attach object.


mustan9
02-12-2007, 09:22 PM
This should be so simple, but I'm having trouble.

I want a very simple script that will do the following, but it keeps throwing errors.

I just want to do the following.

1) Object "b" is the selected object
2) Pick an object in the scene as "m"
3) Add an "Edit_Mesh" to "b"
4) Select all the faces in the Edit_Mesh and delete them.
5) Attach object "m" to the Edit_Mesh

That's it. I get as far as selecting the faces, but it keeps throwing an error when I try to delete them. I also couldn't get the meshop.attach command to work.

I'm doing something wrong?

b = $selection[1]
m = pickObject message:"Pick low-poly mesh" rubberBand:b.pos
if m == undefined then return()
em = Edit_Mesh()
addModifier b em
max modify mode
subobjectLevel = 3
f = for i = 1 to getNumFaces b collect i
setFaceSelection b f
meshOps.delete b.modifiers[1]

Fabiomussarela
02-13-2007, 11:34 PM
Hi Mathew, Iīve tried something similar here at home and it seems some edit mesh commands doesnīt work with the edit_mesh modifier! I donīt know if it is a Bug or if thereīs a workaround.

You can try to convert the mesh to editablePoly, do the delete and attach stuff and convert to editMesh again. just an idea!

I hope someone could bring us some light!

:)

MerlinEl
02-14-2007, 08:11 AM
This script is maded for repairing some object witch is causing crash in 3DsMax.

script steps:
1)collape stack for you selected object (mesh or poly)
2)backup name and pivot position from selected object
3)create a basic object (sphere) and convet to e-poly
4)attach both togather
5)delete sphere faces
6)reset x-form
7)restore name and pivot position
8)collapse stack again



(
local n, p, s, oldSel = $selection as array, newSel = #()
for o in oldSel do
(
if validModifier o Edit_Mesh and not superClassOf o == shape do
try
(
CollapseStack o
n=o.name
p=o.pivot
s=sphere()

convertTo s PolyMeshObject
polyOp.attach s o
polyOp.deleteFaces s (polyOp.getElementsUsingFace s 1)

s.name=n ; s.pivot=p ; ResetXForm s; newSel+= s

CollapseStack s
)
catch ()
)
select newSel
)

CGTalk Moderation
02-14-2007, 08:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.