How to access verticles or faces in a object

How to access verticles or faces in a object

Anonymous
Not applicable
645 Views
2 Replies
Message 1 of 3

How to access verticles or faces in a object

Anonymous
Not applicable

Hello everybody,

i'm a C/C++ developer and a newbie on 3DS max programming.

I'm writing a sample plugin for 3Ds max 2014.

I want to access to verts or faces of a scence object to calculate bound rect of them.

I know, i can access them through a mesh of the object if the object is TriObject or SimpleObject base.

 

I don't know how to do that for another scence object.

 

For any ideas I would be grateful.

0 Likes
646 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

To get render mesh:

const ObjectState& obj = inode->EvalWorldState(time);
tempMesh = ((GeomObject*)obj.obj)->GetRenderMesh(time, inode, view, needDelete);

or to get a display mesh:

TriObject* Utils::GetTriObjectFromNode(INode *node, bool& deleteIt, const TimeValue time) {
    deleteIt = false;
    ::Object *obj = node->EvalWorldState(time).obj;

    if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) {
        TriObject *tri = (TriObject *) obj->ConvertToType(time, Class_ID(TRIOBJ_CLASS_ID, 0));
        // Note that the TriObject should only be deleted
        // if the pointer to it is not equal to the object
        // pointer that called ConvertToType()
        if (obj != tri) {
            deleteIt = true;
        }
        return tri;
    } else {
        return NULL;
    }
}

 

PS: are you aware of Object::GetWorldBoundBox()?

 

Message 3 of 3

Anonymous
Not applicable

Thanks alot for your detailed guidance.

Because i not only calculate the bound rect of the object but also get bound rect of selected faces or vertices of the object.

 

i will try to get selected faces using your suggestion.

Like : tempMesh->FaceSel() or triObj.mesh.FaceSel().

 

if there is any better way, please show me!

0 Likes