一.自定义UI界面代码录制
使用ui样式编辑器自定义设计ui界面

设计完界面退出后会保存生成ui代码.cs类和一个.dlx数据库文件

生成的文件如下:

1.UI界面绘制类.cs文件
如BlockStyler001.cs,这个文件主要是ug录制的我们自定义设计的ui界面,它描述了界面长什么样,就是将一幅画转成代码写进这个类
2.dlx数据文件
负责这个界面有参数的选项的数据储存,使用,例如选择的矢量参数等等
二.在入口主程序中的调用
1.将ui类添加进项目中
using NXOpen;
using NXOpen.BlockStyler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UG_Sketsh
{
public class BlockStyler001
{
//class members
private static Session theSession = null;
private static UI theUI = null;
private string theDlxFileName;
private NXOpen.BlockStyler.BlockDialog theDialog;
private NXOpen.BlockStyler.Label label0;//标签
private NXOpen.BlockStyler.SpecifyPlane plane0;// Block type: 指定平面
private NXOpen.BlockStyler.Separator separator0;// Block type: 分割线
private NXOpen.BlockStyler.Label label01;// 标签
private NXOpen.BlockStyler.SpecifyVector vector0;// Block type: 指定矢量
private NXOpen.BlockStyler.Separator separator01;// Block type: 分割线
private NXOpen.BlockStyler.Label label02;// Block type:标签
private NXOpen.BlockStyler.Separator separator02;// Block type: 分割线
private NXOpen.BlockStyler.SpecifyPoint point0;// Block type: 指定点
private NXOpen.BlockStyler.ScrolledWindow scrolledWindow;// Block type: 滚动窗口
public static readonly int SnapPointTypesOnByDefault_UserDefined = (1 << 0);
public static readonly int SnapPointTypesOnByDefault_Inferred = (1 << 1);
public static readonly int SnapPointTypesOnByDefault_ScreenPosition = (1 << 2);
public static readonly int SnapPointTypesOnByDefault_EndPoint = (1 << 3);
public static readonly int SnapPointTypesOnByDefault_MidPoint = (1 << 4);
public static readonly int SnapPointTypesOnByDefault_ControlPoint = (1 << 5);
public static readonly int SnapPointTypesOnByDefault_Intersection = (1 << 6);
public static readonly int SnapPointTypesOnByDefault_ArcCenter = (1 << 7);
public static readonly int SnapPointTypesOnByDefault_QuadrantPoint = (1 << 8);
public static readonly int SnapPointTypesOnByDefault_ExistingPoint = (1 << 9);
public static readonly int SnapPointTypesOnByDefault_PointonCurve = (1 << 10);
public static readonly int SnapPointTypesOnByDefault_PointonSurface = (1 << 11);
public static readonly int SnapPointTypesOnByDefault_PointConstructor = (1 << 12);
public static readonly int SnapPointTypesOnByDefault_TwocurveIntersection = (1 << 13);
public static readonly int SnapPointTypesOnByDefault_TangentPoint = (1 << 14);
public static readonly int SnapPointTypesOnByDefault_Poles = (1 << 15);
public static readonly int SnapPointTypesOnByDefault_BoundedGridPoint = (1 << 16);
public static readonly int SnapPointTypesOnByDefault_FacetVertexPoint = (1 << 17);
public static readonly int SnapPointTypesOnByDefault_DefiningPoint = (1 << 18);
//------------------------------------------------------------------------------
//Bit Option for Property: SnapPointTypesEnabl


325

被折叠的 条评论
为什么被折叠?



