Hallo alle zusammen,
hab jetzt den c-code gefunden:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_part.h>
#include <uf_csys.h>
#include <uf_assem.h>
static void ask_wcs_info(double origin[3], double axes[9])
{
tag_t
wcs,
wcs_mx;
UF_CALL(UF_CSYS_ask_wcs(&wcs));
UF_CALL(UF_CSYS_ask_csys_info(wcs, &wcs_mx, origin));
UF_CALL(UF_CSYS_ask_matrix_values(wcs_mx, axes));
}
static void do_it(void)
{
int
resp;
tag_t
grp,
disp_part = UF_PART_ask_display_part(),
work_part = UF_ASSEM_ask_work_part();
char
*dir_name,
filter[MAX_FSPEC_SIZE+1],
fspec[MAX_FSPEC_SIZE+1] = { "" };
double
dest_csys[9],
dest_pnt[3];
UF_import_part_modes_t
modes = { 0, 1, 0, 0, 0, FALSE, 0 };
ask_wcs_info(dest_pnt, dest_csys);
if (work_part != disp_part)
UF_CALL(UF_CSYS_map_point(UF_CSYS_ROOT_COORDS, dest_pnt,
UF_CSYS_WORK_COORDS, dest_pnt));
UF_CALL(UF_UI_ask_dialog_directory(UF_UI_IMPORT_DIR, &dir_name));
if (!strcmp(dir_name, ""))
strcpy(filter, getenv("PWD"));
else
strcpy(filter, dir_name);
UF_free(dir_name);
if (filter[strlen(filter) - 1] != '/') strcat(filter, "/");
strcat(filter, "*.prt");
while (!UF_UI_create_filebox("Choose part to import", "Import Part",
filter, "", fspec, &resp) && (resp != UF_UI_CANCEL))
UF_CALL(UF_PART_import(fspec, &modes, dest_csys, dest_pnt, 1.0, &grp));
}
jetz habe ich versucht diesen code ins vb.net zu übersetzen, aber es klappt nicht so richtig ist jemand da der mir vielleicht helfen könnte.
hier der vb.net code:
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Dim nxopenSession As NXOpen.UF.UFSession
Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim session As session = session.GetSession()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim modes As ImportPartModes
Dim file_name As String = "C:\start\pfeil.prt"
Dim dest_csys() As Double = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
Dim dest_point() As Double = {0, 0, 0}
Dim scale As Double = 1.0
Dim group As NXOpen.Tag
nxopenSession.Part.Import(file_name, modes, dest_csys, dest_point, scale, group)
End Sub
danke in voraus (bin für jede hilfe dankbar)
l.pesch
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP