点击查看详细介绍

使用后置处理API函数查找项目以获取当前刀具 UF_MOM_ask_mom UF_MOM_ask_string

nxopen 5年前 3918 22

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


C header: NXOpenDLL.h

#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
 
double dec2rad(double dNumber);
double rad2dec(double dNumber);
double GetBaseDia(double dDiameter, double dHeight, double dAngle);
 
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
 
static int report_error(char *file, int line, char *call, int irc)
{
 if (irc)
 {
  char err[133], msg[133];
 
  sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ", irc, line, file);
  UF_get_fail_message(irc, err);
 
  UF_print_syslog(msg, FALSE);
  UF_print_syslog(err, FALSE);
  UF_print_syslog("\n", FALSE);
  UF_print_syslog(call, FALSE);
  UF_print_syslog(";\n", FALSE);
 
  if (!UF_UI_open_listing_window())
  {
   UF_UI_write_listing_window(msg);
   UF_UI_write_listing_window(err);
   UF_UI_write_listing_window("\n");
   UF_UI_write_listing_window(call);
   UF_UI_write_listing_window(";\n");
  }
 }
 
 return (irc);
}


C source: NXOpenDLL.c

#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_ui.h>
#include "NXOpenDLL.h"
#include <uf_mom.h>
#include <uf_cutter.h>
#include <uf_ncgroup.h>
#include <uf_setup.h>
#include <math.h>
 
 /*****************************************************************************
 **  Activation Methods
 *****************************************************************************/
 /*  Explicit Activation
  **      This entry point is used to activate the application explicitly, as in
  **      "File->Execute UG/Open->User Function..." */
extern DllExport void ufusr(char *parm, int *returnCode, int rlen)
{
 int iStackCount, iSections, iCounter;
 char cToolName[UF_OBJ_NAME_LEN + 1], cIndex[10];
 const char *pcToolName;
 
 tag_t tNCRoot = NULL_TAG, tTool = NULL_TAG, tSetup = NULL_TAG;
 
 UF_MOM_id_t tMOMid;
 UF_CUTTER_holder_section_t **tStackDataArray;
 
 /* Initialize the API environment */
 if (UF_CALL(UF_initialize()))
 {
  /* Failed to initialize */
  return;
 }
 
 UF_print_syslog("Executing Holder Info DLL ...\n", FALSE);
 
 UF_CALL(UF_MOM_ask_mom(parm, &tMOMid));
 
 UF_CALL(UF_MOM_ask_string(tMOMid, "tool_name", &pcToolName));
 strcpy(cToolName, pcToolName);
 
 UF_CALL(UF_SETUP_ask_setup(&tSetup));
 
 UF_CALL(UF_SETUP_ask_mct_root(tSetup, &tNCRoot));

●●●请先 登陆注册 后查看●●●


TCL code:

global mom_JH_stack_count mom_JH_holder_diameter mom_JH_holder_angle mom_JH_holder_hight

MOM_run_user_function "[MOM_ask_env_var UGII_INITIAL_UFUN_DIR]GetToolHolderInfo.dll" ufusr




1

最新回复 (22)
  • qwerty VIP会员 5年前
    1

    GOOD ,THANK YOU

  • 沉默的兔子 VIP会员 5年前
    2

    GOOD ,THANK YOU

  • tianmu1972 VIP会员 5年前
    3

    很有启发,谢谢!

  • liang VIP会员 5年前
    4

    GOOD ,THANK YOU

  • 王牌飞行员 VIP会员 5年前
    5

    学习一下,学习一下

  • guo172960885 VIP会员 5年前
    6

    谢谢分享,学习一下

  • bootwilly VIP会员 5年前
    7

    謝謝分享~~學習了~~

  • joe_wang VIP会员 5年前
    8

    学习了,谢谢。。。

  • 编程刘工 VIP会员 5年前
    9

    谢谢分享,学习一下

  • 熊武强 VIP会员 5年前
    10

    谢谢分享,学习一下

  • hedg VIP会员 4年前
    11

    很有启发,谢谢!

  • wguitar VIP会员 4年前
    12

    谢谢分享,学习一下

  • fthj0537 4年前
    13

    GOOD ,THANK YOU

  • pangyeyi VIP会员 4年前
    14

    GOOD ,THANK YOU

  • hu1576612022 VIP会员 4年前
    15

    GOOD ,THANK YOU

请登录后发表新帖