admin 发表于 2015-8-25 16:26:32

UG NX二次开发源码分享:实现CAM加工后处理功能

通过用户选择Operation,完成后处理!



static void do_it(void)
{

    tag_t   *objects;
    tag_t setup_tag;

    int   i,
          entity_count,
          object_count, err_code, type, subtype,response;


    char    msg;
    char errorstrg;


logicalis_initialized;
logical is_generated;


if (UF_CALL(UF_CAM_is_session_initialized(&is_initialized)) || (is_initialized == FALSE))return;   


      /* Get the highlighted/selected objects from Navigation Tool. */
      UF_UI_ONT_ask_selected_nodes( &object_count, &objects );

      if (object_count > 0)
      {
      UF_CALL( UF_OBJ_ask_type_and_subtype (objects,&type,&subtype));

      sprintf(msg,"type is %d subtype is %d",type,subtype);
      WRITE_S(msg);

      if (type == 121 && subtype == 160 )
       {
            UF_CALL(UF_SETUP_ask_setup(&setup_tag ));
            UF_CALL(UF_SETUP_generate_program (setup_tag,objects,"MILL_3_AXIS","C:\\my_test.ptp",2));

       }
       else
       {
         sprintf(msg,"object type is not 121 and subtype is not 160");
         WRITE_S(msg);
      }
         UF_free(objects);
    }
    else
    {
      UF_CALL(UF_UI_open_listing_window( ));
      sprintf(msg,"objects selected in ONT is not equal to 1");
      UF_CALL(UF_UI_write_listing_window(msg));
    }

    return;
}


wu150060 发表于 2016-9-17 10:13:14

学习一下,顶( }

enricyx 发表于 2017-6-11 23:21:37

这个是什么意思?是生成UG自带的后置处理吗????求解
页: [1]
查看完整版本: UG NX二次开发源码分享:实现CAM加工后处理功能