青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 1247|回复: 2

[原创] UG Java二次开发的主程序框架

[复制链接]
发表于 2015-10-18 22:05 | 显示全部楼层 |阅读模式
/**
7 C9 X* d. l9 M( A6 \ * CNXObject.java:所有开发的ug/Java主程序类的基类;6 r0 u2 u/ p! N  U8 G1 i
*/3 H8 ?6 M8 _' R3 S: u
  r# `! m7 {$ ]
//package com.hunix.UGjava.nxopen;
' @0 v2 r* I! V' T) m
; k8 v" q7 m# M7 ?6 ^8 Z' himport nxopen.*;) q5 F, `! \  p5 b# Y" K$ Y" f
import nxopen.uf.*;
1 u& ^2 P- j' W( M& v4 A  @9 q' H6 Pimport nxopen.features.*;
9 i9 A/ j: u: C- j* g3 Simport java.io.*;
9 t- u4 q$ J! G6 vimport java.net.*;
  M  ^3 f- J% W8 `import java.rmi.*;
8 W$ L% E! v  K1 cimport java.rmi.registry.*;
8 z- g  p# O, y% Ppublic abstract class CNXObject {
! f3 R# r! z0 v5 D+ t6 b
0 p; r; p0 a, u& n  {9 u    public CNXObject() throws NXException,RemoteException{
' h  {: M; l2 \2 f5 R        theSession = (Session)SessionFactory.get("Session");, G" f8 v# |! j% R. L
        theUFSession = (UFSession)SessionFactory.get("UFSession");$ L7 ^4 C0 E  |. H
        theUI = (UI)SessionFactory.get("UI");
2 M6 U  ?! M; O2 c' _( V    }
3 P" i& R8 x* l" v    public void writeListingWindow(String content)throws NXException,RemoteException{% ]6 b& `7 \1 J- X" O
        if(theUFSession==null){
8 e& ^3 {) i# i4 Z% `, ?3 M+ Q            return;4 w% ?( b" u% [* X: p$ T9 d
        }" i/ M$ Z( }  X& x* |
        if(!theUFSession.ui().isListingWindowOpen()){
  u' A2 I9 m$ {4 `; Y            theUFSession.ui().openListingWindow();
1 j# }" F9 L4 q( X. w/ e        }" e* F/ Z! p3 S2 {  w4 T
        theUFSession.ui().writeListingWindow(content);
- \. n( z# q& H. s3 S    }/ |4 A$ V7 l( R
    public void closeListingWindow()throws NXException,RemoteException{
! W& c" a+ a7 k. C        if(theUFSession==null){
- s5 Z4 I& G7 E1 g+ r; ]) S3 R8 r% M            return;% i( V+ t0 l; w2 o. {8 Q% I  }
        }3 y' ]: N) a3 R! I
        theUFSession.ui().closeListingWindow();8 b8 e2 p5 `/ i  e
    }
" H; |, w# E" O" P- N# [4 N7 F. B    public Session getSession(){
) a/ c8 H; V; Y        return theSession;
# d& O& U  [- c9 z) @0 F    }
# ^, R+ [) A* T; O. U$ t* x    public UFSession getUFSession(){, E% t; ?! R" \
        return theUFSession;- T) A" ]# ^8 ~
    }
  {5 f  `7 r0 I8 g# @& |    public UI getUI(){. `$ s$ F* W% o4 T! C
        return theUI;
4 M" x8 K2 A- _8 b    }; a9 O# f9 w7 I
    public static final int getUnloadOption() { $ ~5 G# [; j5 Q) v
        return BaseSession.LibraryUnloadOption.IMMEDIATELY;
' j* b1 |& ]* u! v    }
1 I9 Z9 \, L9 Q4 s! T   
1 e8 X, K+ @2 a4 P& }% G4 B    public abstract String toString();- s* g. n4 ]$ V- m( q5 @, M
   
; t# m7 S  P3 |0 b) j) D    Session theSession=null ;
7 T0 b; b* k/ A    UFSession theUFSession=null ;2 s0 N1 D; w1 \1 o! c
    UI theUI=null;
& ?" |6 w4 D- O0 @" \, \}
# S! M* N( f: m+ P6 I
发表于 2018-4-23 14:01 | 显示全部楼层
楼主QQ多少,想加个朋友讨论下JAVA
回复 支持 反对

使用道具 举报

发表于 2018-4-23 14:07 | 显示全部楼层
加我QQ609719845
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2025-4-8 20:09 , Processed in 0.084461 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表