Перейти к публикации

Получить свойство средствами NX


ochelot

Рекомендованные сообщения

Добрый день!

 

Подскажите, как получить значение времени (симуляции обработки), не знаю, свойство это или атрибут и где он хранится? 

 

p.s. А какая версия VC необходима для сборки с/с++ плагина под NX9?

 

post-48598-0-79658700-1435751427.png

Ссылка на сообщение
Поделиться на других сайтах


По-моему: mom_machine_time. В "Генераторе постпроцессоров" зайдите в "утилиты-просмотр мом-переменных" и наберите там в поиске time. Есть ещё несколько переменных для определения времени обработки.

Ссылка на сообщение
Поделиться на других сайтах

А как можно получить значение этой переменной?

 

Средствами Java пробую:

 

Session theSession = (Session)SessionFactory.get("Session");
Part workPart = theSession.parts().work();
// Выдает Exception что атрибут не найден
workPart.getIntegerAttribute("mom_machine_time");
Ссылка на сообщение
Поделиться на других сайтах

А как можно получить значение этой переменной?

 

Средствами Java пробую:

 

 

Session theSession = (Session)SessionFactory.get("Session");
Part workPart = theSession.parts().work();
// Выдает Exception что атрибут не найден
workPart.getIntegerAttribute("mom_machine_time");

Я конечно не знаком с явой, но этот параметр не интежер, а real

 

может вам этот код поможет?

/*HEAD UF_MOM_ADD_UFUN_TCLEXTS CCC UFUN*/
/*=============================================================================
                   Copyright (c)  1993 Electronic Data Systems
                        Unpublished - All Rights Reserved
=============================================================================*/
/*****************************************************************************
 * File Name: uf_mom_add_ufun_tclexts.c
 *
 * File Description: 
 * This file contains the implementation for adding TCL extension to execute 
 * the User Function routines.
 *
 * Revision History
 *   Revision      Date       Who         Reason
 *      00       07may99      satya       Original Release
 *
 *$HISTORY$
 ******************************************************************************/


/********************************* Includes ***********************************/

#include <stdlib.h>
#include <uf.h>
#include <uf_obj.h>
#include <uf_attr.h>
#include <uf_mom.h>
#include "uf_mom_add_ufun_tclexts.h"
#include "mom_post_dh.h"


/* ARGSUSED */
extern void  ufusr 
(
  char *param, 
  int *len, 
  int     param_len
)
{
  UF_MOM_id_t   mom = ( UF_MOM_id_t ) param ;
  void *interp = NULL ;
  int error ;


  /* Initialize user function */

  UF_initialize() ;

  /* Get the TCL interpreter id from the ufusr param */

  (void)UF_MOM_ask_interp_from_param ( param, &interp ) ; 

  /* Get the MOM id from the ufusr param */

  /* UF_MOM_ask_mom (param, &mom) ; */

  /*-------------------------------------------------------------------- 
   * Now extend the TCL interpreter with the following functions 
   * The following TCL exetensions will be added 
   *  - MOM_load_kinematics
   *  - MOM_convert_point
   *  - MOM_get_tool_attribute <name of the attribute>
  ---------------------------------------------------------------------*/

  /* Adding MOM_load_kinematics TCL extension */

  error = UF_MOM_extend_xlator
          (
             mom,
             "MOM_load_kinematics",
             mom_load_kinematics
          ) ;

  /* Adding MOM_convert_point TCL extension */

  error = UF_MOM_extend_xlator
          (
             mom,
             "MOM_convert_point",
             mom_convert_point
          ) ;

  /* Adding MOM_load_kinematics TCL extension */

  error = UF_MOM_extend_xlator (
                                 mom ,
                                 "MOM_get_tool_attribute",
                                 mom_get_tool_attribute
                               ) ;

  /* Adding MOM_rotate_mach_csys TCL extension */

  error = UF_MOM_extend_xlator (
                                  mom,
                                  "MOM_rotate_mach_csys",
                                  mom_rotate_mach_csys
                               ) ;

  /* Adding MOM_map_to_rotated_csys TCL extension */

  error = UF_MOM_extend_xlator (
                                  mom,
                                  "MOM_map_to_rotated_csys",
                                  mom_map_to_rotated_csys
                               ) ;


  if ( error )
  {
     printf ( " ERROR Extending the translator \n " ) ;
  }

  mom_obj = mom ;
  *len = 0 ;

  /* Terminating User Function */

  UF_terminate() ;
}


/*-----------------------------------------------------------------------
 * Function Name: mom_get_tool_attribute
 *
 -----------------------------------------------------------------------*/

static int mom_get_tool_attribute
(
  void *client_data,    /* This is the mom object */
  void *interp,         /* Pointer to the TCL interpreter */
  int  argc,            /* Count of the numnber of arguments */
  char **argv           /* Array of arguments where the
                           argv[0] - The TCL extension */
)
{
  int             error ;
  const char      *mom_value ;
  char            error_message[512] ;
  char            tool_name[MAX_LINE_SIZE+1] ;
  char            curr_tool_name[UF_OBJ_NAME_LEN+1] ;
  char            attribute_title[UF_ATTR_MAX_TITLE_LEN+1] ;
  char            attribute_value[UF_ATTR_MAX_STRING_LEN+1];
  char            tcl_variable[MAX_LINE_SIZE+1] ;
  char            default_attribute_value[MAX_LINE_SIZE+1] ;
  tag_t           tool_object_tag = NULL_TAG ;
  UF_ATTR_value_t value ;
  UF_MOM_id_t     mom_id = ( UF_MOM_id_t ) client_data ;

  strcpy ( default_attribute_value , "   " ) ;
  strcpy ( tcl_variable , "tool_attribute_text" ) ;
  strcpy ( tool_name , "tool_name" ) ;

  if ( argc != 2)
  {
/*
     UF_MOM_set_string ( mom_id , "tool_attribute",
                         "Failed. Wrong number of arguments" ) ;
*/
     strcpy ( error_message , "Invalid number of arguments" ) ;
     printf ( " ERROR : %s \n " , error_message ) ;
     return (1) ;
  }

  /* Get the tool name for which the attribute is required */

  error = UF_MOM_ask_string ( mom_id ,
                              tool_name ,
                              &mom_value ) ;


  if ( error )
  {
     strcpy ( error_message , "No Tool Name obtained from UGPost" ) ;
     printf ( " ERROR : %s \n " , error_message ) ;
     return (1) ;
  }

  strcpy ( curr_tool_name , mom_value ) ;

  /* Get the tool tag for the tool defined in mom_tool_name by UGPost */

  strcpy( attribute_title , argv[1] ) ;

  error = UF_OBJ_cycle_by_name (
                                  curr_tool_name,
                                  &tool_object_tag
                               ) ;
  if ( error )
  {
      printf ( " UF_OBJ_cycle_by_name could not get the tool_object_tag \n" );
      return (1) ;
  }

  /* Read the tool attribute string for the tool */

  if (tool_object_tag != 0)
  {
    value.value.string = attribute_value;
    error = UF_ATTR_read_value (
                                 tool_object_tag,
                                 attribute_title,
                                 UF_ATTR_string,
                                 &value
                               ) ;

    if ( error )
    {
        printf ( " UF_ATTR_read_value could not return tool string \n" );
        return (1) ;
    }

    /* Set the default value if reading of the arributre fails */

    if ( value.type != UF_ATTR_string )
    {
       strcpy ( attribute_value , default_attribute_value ) ;
    }
  }
  else
  {
    strcpy ( attribute_value , default_attribute_value ) ;
  }

  /* Return the the tool attribute string to tcl and set in the tcl variable
     mom_tool_attribute_text */

  UF_MOM_set_string (
                      mom_id ,
                      tcl_variable,
                      attribute_value
                    ) ;
  return ( 0 ) ;
}

Я часть кода не привел, оставил только одно процедуру

Ссылка на сообщение
Поделиться на других сайтах

Присоединяйтесь к обсуждению

Вы можете опубликовать сообщение сейчас, а зарегистрироваться позже. Если у вас есть аккаунт, войдите в него для написания от своего имени.
Примечание: вашему сообщению потребуется утверждение модератора, прежде чем оно станет доступным.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.




×
×
  • Создать...