/*****************************************************************************\ FILE : UgModelDelete.c PURPOSE : Pro/TOOLKIT User Guide Example - delete a model from a drawing HISTORY.. DATE BUILD AUTHOR MODIFICATIONS 04-Dec-97 H-02-02 Philippe $$1 Created \*****************************************************************************/ /*-------------------------- Pro/Develop includes ---------------------------*/ #include #include /*-------------------------- Pro/Toolkit includes ---------------------------*/ #include #include #include /*-------------------------- Application includes ---------------------------*/ #include /*================================================================*\ FUNCTION : UserModelDelete PURPOSE : Deletes a model from the current drawing-type object. \*================================================================*/ int UserModelDelete () { int status; ProCharLine astr; ProName wname; ProMdlType type; ProMdl p_draw, p_model; Pro_object_info model_info; ProCharName name; ProFileName WMSGFIL = {'m','s','g','_','u','g','d','w','g','.','t','x','t','\0'}; /*------------------------------------------------------------*\ Get the current model \*------------------------------------------------------------*/ status = ProMdlCurrentGet(&p_draw); ERROR_CHECK("UserModelDelete","ProMdlCurrentGet",status); if (status != PRO_TK_NO_ERROR) return(status); /*------------------------------------------------------------*\ Get the name and type of the model to add. \*------------------------------------------------------------*/ status = UserUtilNameTypeGet(WMSGFIL, wname, &type ); ERROR_CHECK("UserModelDelete","UserUtilNameTypeGet",status); if (status != PRO_TK_NO_ERROR) return(status); /*------------------------------------------------------------*\ Retrieve the specified object into memory. \*------------------------------------------------------------*/ status = ProMdlRetrieve(wname, type, (&p_model)); ERROR_CHECK("UserModelDelete","ProMdlRetrieve",status); if (status != PRO_TK_NO_ERROR) return(status); /*------------------------------------------------------------*\ Delete the model from the current drawing-type object. \*------------------------------------------------------------*/ status = prodrw_delete_drawing_model ((Prohandle)p_draw, (Prohandle)p_model); ERROR_CHECK("UserModelDelete","prodrw_delete_drawing_model", (status !=PRODRW_DEL_MODEL_SUCCESS)); /*------------------------------------------------------------*\ Print a message in the message window \*------------------------------------------------------------*/ if (status == PRODRW_DEL_MODEL_SUCCESS) { ProWstringToString(name, wname); sprintf(astr, "Model %s has been deleted from drawing", name); status = ProMessageDisplay (WMSGFIL,"USER %0s", astr); ERROR_CHECK("UserModelDelete","ProMessageDisplay",status); return (PRO_TK_NO_ERROR); } else { sprintf(astr, "Error %d in UserModelDelete", status); status = ProMessageDisplay (WMSGFIL,"USER %0s", astr); ERROR_CHECK("UserModelDelete","ProMessageDisplay",status); return (PRO_TK_GENERAL_ERROR); } }