009.UG二次开发,自定义UI界面及挂载使用

一.自定义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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值