iCAx开思工具箱

标题: 【求助】关于 UF_MODL_create_smbend的用法? [打印本页]

作者: spline    时间: 2003-6-13 16:37
标题: 【求助】关于 UF_MODL_create_smbend的用法?
请各位大虾赐教
作者: spline    时间: 2003-6-13 16:44
这是代码,要出错的。 
//////////////////////////////////////////////////////////////////////////////
//
//  CreateSMB.cpp
//
//  Description:
//      Contains Unigraphics entry points for the application.
//
//////////////////////////////////////////////////////////////////////////////
  
//  Include files
#include <uf.h>
#include <uf_exit.h>
#include <uf_ui.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
#  include <strstream>
#   include <iostream>
  using std:strstream;
  using std::endl;  
  using std::ends;
  using std::cerr;
#else
#  include <strstream.h>
#   include <iostream.h>
#endif
#include "CreateSMB.h"
  
#include "UF_MODL.h"
#include "uf_modl_smd.h"
#include "UF_vec.h"
#include "uf_object_types.h"
#include <uf_smd.h>
  
#include <windows.h>
  
static int init_proc(
    UF_UI_selection_p_t select,
    void* user_data)
{
    int num_triples = 1;
    UF_UI_mask_t mask_triples[] = {
         UF_face_type, UF_bounded_plane_subtype, 0 };
    // enable only Feature  
    int RetCode = UF_UI_set_sel_mask(select,
            UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
            num_triples, mask_triples);   
    if( 0 == RetCode )
    {         
        return (UF_UI_SEL_SUCCESS);
    }
    else
    {
        return (UF_UI_SEL_FAILURE);
    }
}
  
tag_t SelectBendSheet( )
{
    char cue[] = "?????????ì?é-?????¤??";
    char title[] = "??????????????????";
  
    printf( "%s\n", cue );
  
    int response;
    tag_t object = NULL_TAG, view;
    double cursor[3];
  
    UF_MODL_features_p_t *features_node;
    int count = 0;
    bool bGetSMBend = false;
  
    do
    {
        object = NULL_TAG;
        int RetCode = UF_UI_select_with_single_dialog(cue,title,
                   UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
                   [$response, &object, cursor, &view)]
        bGetSMBend = false;
        if(!(RetCode))
        {
            if (response == UF_UI_OBJECT_SELECTED ||
                response == UF_UI_OBJECT_SELECTED_BY_NAME)
            {
                printf("object tag = %d\n", object);
                if (response == UF_UI_OBJECT_SELECTED)
                {
                    printf("view = %d\n", view);
                    printf("cursor position = %f %f %f\n",
                            cursor[0], cursor[1], cursor[2]);
                    return object;
                }            
                /* unhighlight selected object */
                //UF_DISP_set_highlight(object,0);
            }
        }
        else  
        { // Selection error            
            return NULL_TAG;
        }
    }
    while( (!object)||(!bGetSMBend) );     
  
    return object;
    
}
//----------------------------------------------------------------------------
//  Activation Methods
//----------------------------------------------------------------------------
  
//  Unigraphics Startup
//      This entry point activates the application at Unigraphics startup
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
    int errorCode = UF_initialize();
    int RetCode = 0;
  
    FILE *fp;
    AllocConsole();
    // reopen stdout on conout$ for fprintf and printf  
    fp = freopen("conout$", "w", stdout);
    fprintf( stdout, "%s\n", "Begin of program" );
  
    if ( 0 == errorCode )
    {
        // ???¨SMB??????
        tag_t BendTag;
        UF_MODL_smbend_data_t UserData;
        double mAxisOrigin[3] = {0.0, 0.0, 0.0 };
        double mAxisVector[3] = {0.0, 100.0, 0.0 };
    
        // select face
        UserData.base_face = SelectBendSheet();
        // ???¨App Curve.
        tag_t AppCurve = 0;
        UF_CURVE_line_t LineCoords;
        UF_VEC3_copy ( mAxisOrigin, LineCoords.start_point );
        UF_VEC3_add(  
             mAxisOrigin,  
             mAxisVector,  
            LineCoords.end_point );
        RetCode = UF_CURVE_create_line( [$LineCoords, &AppCurve )]
        printf( "app curve tag: %d\n", AppCurve );
  
        UserData.app_curve = AppCurve;
  
        UserData.app_curve_type = UF_SMBEND_BEND_CENTERLINE;
        sprintf ( UserData.angle, "90.0" );
        UserData.angle_type = UF_SMBEND_BEND_ANGLE;
        sprintf ( UserData.radius, "5.0");
        UserData.radius_type = UF_SMBEND_OUTER_RADIUS;
        UserData.bend_dir  = UF_SMBEND_BEND_DIR_OPPPOSITE_SIDE;
        UserData.stat_side = UF_SMBEND_STAT_SIDE_OPPOSITE_SIDE;   
        sprintf( UserData.baf, "(Radius+(Thickness*0.44))*rad(Angle)" );
        // ?è???ê±????ú??
        RetCode = UF_MODL_create_smbend ( [$UserData, &BendTag)]
       &nbsprintErrorMessage( RetCode );
  
    }
        
    errorCode = UF_terminate();
  
    /* Print out any error messages */
   &nbsprintErrorMessage( errorCode );
}
  
//----------------------------------------------------------------------------
//  Utilities
//----------------------------------------------------------------------------
  
// Unload Handler
//     This function specifies when to unload your application from Unigraphics.
//     If your application registers a callback (from a MenuScript item or a
//     User Defined Object for example), this function MUST return
//     "UF_UNLOAD_UG_TERMINATE".
extern "C" int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_UG_TERMINATE );
}
  
/* PrintErrorMessage
**
**     Prints error messages to standard error and the Unigraphics status
**     line. */
static void PrintErrorMessage( int errorCode )
{
    if ( 0 != errorCode )
    {
        /* Retrieve the associated error message */
        char message[133];
        UF_get_fail_message( errorCode, message );
        printf( message );
        /* Print out the message */
        UF_UI_set_status( message );
  
        // Construct a buffer to hold the text.
        ostrstream error_message;
  
        // Initialize the buffer with the required text.
        error_message << endl
                      << "Error:" << endl
                      << message
                      << endl << endl << ends;
  
      // Write the message to standard error
        cerr << error_message.str();
    }
}
作者: spline    时间: 2003-6-13 16:57
错误码:580009
内容:A dimension subscript for an array attribute was out of range or invalid
作者: spline    时间: 2003-6-15 11:06
绝望了
作者: spline    时间: 2003-6-15 11:23
zzz有什么高招?
作者: zzz    时间: 2003-6-15 12:28
UG的smbend是有问题。
作者: spline    时间: 2003-6-16 12:21
如何在能解决这个问题呢?以我们的能力可以吗?
EDS会有什么好的解决办法吗?
如果不行,那我就彻底绝望了!




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3