青华模具培训学校

用户名  找回密码
 注册

QQ登录

只需一步,快速开始

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

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

[复制链接]
发表于 2015-10-18 22:05 | 显示全部楼层 |阅读模式
/**0 c3 E! ?* a: {( B- L
* CNXObject.java:所有开发的ug/Java主程序类的基类;
; \; x! w: c+ S5 B: K  B1 I */
7 J0 \9 j7 M. A* l0 H! d) A- R5 U
2 g% x( O5 _0 I' [% s% b. N//package com.hunix.UGjava.nxopen;
- t/ P6 X5 u' k7 N
1 h4 {- m: w3 \! O! x  @import nxopen.*;
  ~; `' O; Z& Pimport nxopen.uf.*;( N' d/ C# ~( |, u; D, u% C, W5 F) _
import nxopen.features.*;
( N& o+ c* [8 P5 G  D2 fimport java.io.*;
( d% ^% P' o& P. h. w1 iimport java.net.*;. z) I# I7 W" S5 u3 m/ q7 r
import java.rmi.*;4 p$ ^  y% s  ^) H: ]2 @4 Q
import java.rmi.registry.*;& G- D# C2 X7 t! K0 O
public abstract class CNXObject {
% z$ M4 I$ O/ U* o* B1 ?! A- M8 l
4 D5 d. T0 L3 X9 ]$ r    public CNXObject() throws NXException,RemoteException{
( h9 O; W' J/ d* f& I        theSession = (Session)SessionFactory.get("Session");) d4 e2 e* X; ]7 W# {, }! Q# q
        theUFSession = (UFSession)SessionFactory.get("UFSession");, |. X1 B2 ^1 t; _4 @
        theUI = (UI)SessionFactory.get("UI");6 X8 I0 r8 O$ P0 [: z: c  g- m
    }- @5 S% T9 N" T$ _- C2 O" A
    public void writeListingWindow(String content)throws NXException,RemoteException{2 w6 b) a5 k; T. ~& K3 |5 U7 W
        if(theUFSession==null){
, @, f6 P, ~, |: |            return;% w' ]& s# m5 S+ i9 c) W  z
        }
' q. Z# h: g; K  S# g; P/ s        if(!theUFSession.ui().isListingWindowOpen()){
) X# [  X/ f8 M; [# m$ ^            theUFSession.ui().openListingWindow();" m: ~1 A1 T# S, |6 |4 D
        }0 _3 H' A% n- I
        theUFSession.ui().writeListingWindow(content);* W5 k. ~* _  A
    }
3 h6 Q: N& J9 m6 S% g/ W  {! L    public void closeListingWindow()throws NXException,RemoteException{
5 K3 m% S! e+ Y% m        if(theUFSession==null){  [. b" j9 G* E4 B/ d
            return;) L9 Q! C' t, N
        }
: o' i/ a$ R: d! v% Y  p  j        theUFSession.ui().closeListingWindow();8 Z: `( \9 e8 \0 M, j
    }% ]/ U4 s2 N, v. m) [0 M) a
    public Session getSession(){; O. F- l4 X* F! M1 P- R4 q
        return theSession;
" t0 B0 N" p7 r! \  |    }0 O% d) K7 P' f0 j, g
    public UFSession getUFSession(){
1 k' s- @% y4 C1 Y/ W& Z        return theUFSession;! a% x! t- f2 B# s" K2 g' s
    }$ |1 _( N+ R4 r
    public UI getUI(){' i! n7 Q: Y, ?6 b4 ]# a# s& u
        return theUI;9 s; a* P( K* g; T% [1 k: P" h
    }
- c/ c0 b4 _- t* a  v& c    public static final int getUnloadOption() {
" i% ?% E6 M; Y4 x0 |" O6 V        return BaseSession.LibraryUnloadOption.IMMEDIATELY; 2 w+ J9 ]) x( `/ O8 Y
    }
* d6 |, T) h: I2 w9 {   
" p4 U0 V" l* [* K7 {6 r. O    public abstract String toString();7 Y" B0 ~! u: k, q$ O, Q8 Z0 N% s
    0 t! X. ~& y4 T' @. J7 y6 X
    Session theSession=null ;/ j! Y. ^5 ~" G/ S; J/ C8 t/ ^) @
    UFSession theUFSession=null ;9 E: f# L4 j$ m  x' k0 P) `2 b
    UI theUI=null;
! C$ B# N1 V6 A% N% X}
# q6 O9 c2 _2 l, s8 S  y9 F- c; Y
发表于 2018-4-23 14:01 | 显示全部楼层
楼主QQ多少,想加个朋友讨论下JAVA
回复 支持 反对

使用道具 举报

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-3-8 12:01 , Processed in 0.082865 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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