iCAx开思网

标题: 如何调用UG中的点构造器啊(point construct) [打印本页]

作者: orangecard    时间: 2005-5-21 22:20
标题: 如何调用UG中的点构造器啊(point construct)
我写了一段程序想调用点构造器功能,程序编译都没问题,可是就是不能执行功能,不知哪位高手指点一下。谢了!
  
char *cue="调用点构造器”;
UF_UI_POINT_base_method_t base_method;
tag_t point_tag;
double base_pt[3];
int *response;
int status;
  
status = UF_UI_point_construct(cue, [$base_method, &point_tag, base_pt, response)]
  
if(status == 0)
{
UF_UI_open_listing_window();
UF_UI_write_listing_window("successfully run the function!");
}
if(status != 0)
{
UF_UI_open_listing_window();
UF_UI_write_listing_window("Failed to run the function!");
}
编译运行后系统显示“Failed to run the function!也就是说status返回的值非0,但是不知程序哪个地方出问题了,还请高手指点。
使用uc1616()调用的代码:
char *cp1="point construct";
int *ia2=0;
int ip3,status;
double rr4[3];
  
status = uc1616(cp1, ia2, ip3, rr4);
if(status == 0)
{
UF_UI_open_listing_window();
UF_UI_write_listing_window("successfully run the function!");
}
if(status != 0)
{
UF_UI_open_listing_window();
UF_UI_write_listing_window("Failed to run the function!");
}
运行结果同上,也不知哪出了问题。
作者: 深夜摔键盘    时间: 2005-5-22 01:19
base_method没赋初值。
作者: orangecard    时间: 2005-5-22 13:03
一定要赋初值么,我想通过用户自选取点方式来选取点,如果赋了初值岂不是只能用一种选点的方法了?
作者: 深夜摔键盘    时间: 2005-5-22 13:05
点构造器实际上是一个对话框面板,上面有许多工具,你赋的初值是作为默认值来对待的。
作者: orangecard    时间: 2005-5-22 16:58
键盘哥:程序已经调通,万分感谢。还有一点,在调入点构造器后发现X,Y,Z坐标输入框中的值都为-92559631349317831.0000虽然没什么大的影响但总是看着不爽,不知键盘兄能否指点一二将这些值全调为0?再次感谢!!!!
作者: 深夜摔键盘    时间: 2005-5-22 21:10
试试把double base_pt[3] 赋上初值看一看。
  
另外点构造器最后一个参数,不要给它指针,可以取局部变量的地址来做参数。要给指针也可以,但必须在API之外为这个指针分配内存,还要记着释放,因为API不会为你的指针分配空间的。虽然这个程序能运行,但是存在隐患。
作者: dasanlang    时间: 2005-5-24 13:35
/****************************************************************************
Main entry point for the associated point constructor dialog -
Create a smart point.  If you do not wish to create smart point, use uc1616.
  
Environment: Internal
  
See Also:  UF_UI_point_options_p_t
  uc1616
  UF_SO_set_visibility_option
  
History: Originally added in v19.0
****************************************************************************/
extern UGOPENINTEXPORT int UF_UI_point_construct(
char *cue , /* <I>
            Displays a message in the cue line.
             */
UF_UI_POINT_base_method_t *base_method, /* <I/O>
                                       Use this method as the default method.
                                       Returns the method used to create the
                                       point.
                                        */
tag_t *point_tag,  /* <O>
                   Constructed point.  This will be a SO point and will
                   be invisible by default.  Use UF_SO_set_visibility_option to
                   make it visible.
                   Use functions in uf_so.h to ask the parents.
                   (NULL_TAG if user terminated dialog).
                    */
double base_pt[3], /* <O>
                   Result point, in absolute coordinates.
                    */
int *response      /* <O>
                   One of the following:
                   UF_UI_PICK_RESPONSE
                   UF_UI_OK
                   UF_UI_BACK
                   UF_UI_CANCEL.
                    */
);
作者: dasanlang    时间: 2005-5-24 13:39
/* enum for UF_UI_point_construct */
typedef enum UF_UI_point_base_method_e
{
    UF_UI_POINT_INFERRED = 0,
    UF_UI_POINT_CURSOR_POS,
    UF_UI_POINT_EXISTING_PT,
    UF_UI_POINT_END_PT,
    UF_UI_POINT_CONTROL_PT,
    UF_UI_POINT_INTERSECT_PT,
    UF_UI_POINT_CENTER_PT,
    UF_UI_POINT_ANGLE_PT,
    UF_UI_POINT_QUADRANT_PT,
    UF_UI_POINT_ON_CURVE_PT,
    UF_UI_POINT_ON_SURFACE_PT,
    UF_UI_POINT_OFFSET_CSYS_PT,
    UF_UI_POINT_DIALOG,
    UF_UI_POINT_NO_METHOD,
    UF_UI_POINT_APPLICATION_METHOD  
} UF_UI_POINT_base_method_t, *UF_UI_POINT_base_method_p_t;
作者: dasanlang    时间: 2005-5-24 13:42
/******************************************************************************
Display a user message and return a point from the Point
Subfunction in Absolute Coordinates of the current Work Part.
  
Note when using this function in a member view, the view needs to be expanded.
  
Return:
         Response Returned
        1 = Back
        2 = Cancel
        5 = Position Returned
        7 = No Active Part
        8 = Disallowed state, unable to bring up dialog
  
Environment: Internal
  
See Also:
  
History: The ia2[0] parameter was modified in V13.0 to
         return a value of 12 for a quadrant point.
  *****************************************************************************/
extern UGOPENINTEXPORT int uc1616(
char * cp1 ,/* <I>
            User Message (40 char max)
            */
int * ia2 ,/* <I/O>
           On input the default selection type and offset mode.  On output
           the selection type and offset mode used.
           [0] Selection Type
               0 = Show Menu For User Selection
               1 = Screen Position
               2 =  This value is ignored.
               3 =  This value is ignored.
               4 = Existing Point
               5 = End Point
               6 = Control Point
               7 = Intersection Point
               8 = Arc Center
               9 = Pos On Arc
               12 = Quadrant Point
           [1] Offset Mode
               0 = No Offset
               1 = Rect Abs
               2 = This value is ignored.
               3 = Cylindrical
               4 = Spherical
               5 = 3D Vector
               6 = 3D Vector
           */
int ip3 ,/* <I>
         Temporary Point Display
         0 =     Display Temporary Points
         1 =     Do Not Display Temporary
               &nbspoints
         */
double * rr4  /* <O>
             &nbspoint Picked (x,y,z).  This is only returned if the return
              code is 5.
              */
);
作者: dasanlang    时间: 2005-5-24 13:45
以上是我查找到的UF_UI_point_construct,以及uc1616的函数原型,我想问这个UF_UI_point_construct中创建smart point是个什么含义?
作者: nihai0711501129    时间: 2011-11-17 09:29
上面的代码怎么看不见啊




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3