|
用C#做的一个EXE程序,重复调用的时候出错了:
不解啊!
一下是源代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NXOpen;
using NXOpen.Utilities;
using NXOpen.UF;
using NXOpenUI;
namespace test1
{
public partial class Form毛坯创建工具 : Form
{
public Form毛坯创建工具()
{
InitializeComponent();
}
private string x;
private string y;
private string z;
private void button创建_Click(object sender, EventArgs e)
{
Session thesession = Session.GetSession();
try
{
Part thepart = thesession.Parts.Work;
NXOpen.Features.Feature block = null;
NXOpen.Features.BlockFeatureBuilder thebuilder = thepart.Features.CreateBlockFeatureBuilder(block);
x = textBoxX.Text;
double x1 = Convert.ToDouble(x);
y = textBoxY.Text;
double y1 = Convert.ToDouble(y);
z = textBoxZ.Text;
double z1 = Convert.ToDouble(z);
NXOpen.Point3d basepoint = new Point3d(x1, y1, z1);
thebuilder.SetOriginAndLengths(basepoint ,textBoxΔX.Text ,textBoxΔY .Text ,textBoxΔZ.Text);
thebuilder.Commit();
MessageBox.Show("毛坯建造完毕!");
}
catch (NXException ex)
{
MessageBox.Show("ERROR!");
}
}
private void button退出_Click(object sender, EventArgs e)
{
Close();
}
}
}
请高手多多赐教! |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|