首页 > 编程语言 >open for java 创建圆弧

open for java 创建圆弧

时间:2022-12-20 13:45:15浏览次数:48  
标签:theAskArcData ufArc java writeListingWindow theUFSession ui 圆弧 arcCenter open

//徐华进2022/12/20
///*==================================================================================================

            Copyright (c) 2004 UGS PLM Solutions.
                   Unpublished - All rights reserved

====================================================================================================
File description:
Example to show how to create Arc.
 
*/

import nxopen.*;
import nxopen.uf.*;

import java.io.PrintWriter;
import java.io.StringWriter;


public class CreateArc {

    public static void main(String[] args) throws Exception {
        Session theSession = null;
        UFSession theUFSession = null;

        try {
            theSession = (Session) SessionFactory.get("Session");
            theUFSession = (UFSession) SessionFactory.get("UFSession");
//            theUFSession.ui().openListingWindow();
//            theUFSession.ui().writeListingWindow("Session and UFSession are created");
            UFCurve ufCurve = theUFSession.curve();
            UFCurve.Arc ufArc = new UFCurve.Arc();
            //UFPart ufPart = theUFSession.part();
            UFCsys ufCsys = theUFSession.csys();
            //Part part1 = theSession.parts().newDisplay("CreateArc", Part.Units.INCHES);

            /* Fill out the data structure */
            ufArc.startAngle = 0.0;
            ufArc.endAngle = 3.0;
            ufArc.arcCenter = new double[3];
            ufArc.arcCenter[0] = 0.0;
            ufArc.arcCenter[1] = 0.0;
            ufArc.arcCenter[2] = 1.0;
            ufArc.radius = 2.0;

            Tag wcsData = ufCsys.askWcs();
            ufArc.matrixTag = ufCsys.askMatrixOfObject(wcsData);
            Tag arcData = ufCurve.createArc(ufArc);
            UFCurve.Arc theAskArcData = ufCurve.askArcData(arcData);
//            theUFSession.ui().writeListingWindow("\nX Coordinate: "+theAskArcData.arcCenter[0]+"\n");
//            theUFSession.ui().writeListingWindow("Y Coordinate: "+theAskArcData.arcCenter[1]+"\n");
//            theUFSession.ui().writeListingWindow("Z Coordinate: "+theAskArcData.arcCenter[2]+"\n");
//            theUFSession.ui().writeListingWindow("Start Angle: "+theAskArcData.startAngle+"\n");
//            theUFSession.ui().writeListingWindow("End Angle: "+theAskArcData.endAngle+"\n");
//            theUFSession.ui().writeListingWindow("arcRadius: "+theAskArcData.radius);
//            theUFSession.ui().writeListingWindow("\nCreated successfully");

        } catch (Exception ex) {
            if (theUFSession != null) {
                StringWriter s = new StringWriter();
                PrintWriter p = new PrintWriter(s);
                p.println("Caught exception " + ex);
                ex.printStackTrace(p);
                theUFSession.ui().writeListingWindow("\nFailed");
                //theUFSession.ui().writeListingWindow("\n"+ex.getMessage());
                theUFSession.ui().writeListingWindow("\n" + s.getBuffer().toString());
            }


        }
    }

    public static int getUnloadOption() {
        return BaseSession.LibraryUnloadOption.IMMEDIATELY;
    }
}

//徐华进2022/12/20

 

标签:theAskArcData,ufArc,java,writeListingWindow,theUFSession,ui,圆弧,arcCenter,open
From: https://www.cnblogs.com/xuds/p/16993999.html

相关文章

  • PYTHON - openpyxl (四)
    1.1字体Font类型:openpyxl.styles.fonts.Fontsheet["a1"].font=Font(name='字体',size=字号,...)name字体,中文字体前面加usize字号大小bold=True/False粗......
  • Java序列化与反序列化三连问:是什么?为什么要?如何做?
    Java序列化与反序列化是什么?Java序列化是指把Java对象转换为字节序列的过程,而Java反序列化是指把字节序列恢复为Java对象的过程:序列化:对象序列化的最主要的用处就是在......
  • 为什么Java线程没有Running状态?
    Java虚拟机层面所暴露给我们的状态,与操作系统底层的线程状态是两个不同层面的事。具体而言,这里说的Java线程状态均来自于Thread类下的State这一内部枚举类中所定义的......
  • 解析Java框架中entity层,mapper层,service层,controller各层作用
    转载自:https://blog.csdn.net/u011095110/article/details/86088976一、entity层别名:model层,domain层用途:实体层,用于存放我们的实体类,与数据库中的属性值基本......
  • 4.Java程序初识
    4.Java程序初识4.1HelloWorld程序以Hello.java为例,java应用程序的执行入口是main()方法,其有固定格式:/***类文件,一个源文件最多只能有一个public类,且与文件名称一......
  • Xml转Java实体类对象 xml转Javabena 对象 且多级嵌套 复杂嵌套
    最近在做企微开发,遇到了一个比较复杂的xml然后要去我将xml转成实体类xml如下<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[sys]]></Fro......
  • java的final关键字
    本文主要讲述java的final关键字和相关细节。老韩知识介绍:示例代码如下:1publicclassFinalTest{2publicstaticvoidmain(String[]args){3......
  • Java Selenium封装--RemoteWebElement
    packagecom.selenium.driver;importjava.sql.SQLException;importjava.util.List;importorg.json.JSONException;importorg.openqa.selenium.By;importorg.openqa.sel......
  • java jackson库各对象之间转换
    java对象到json字符串Modelmodel=newModel();model.setAge(25);List<Model>models=newArrayList<Model>();models.add(models);ObjectMappermapper=newObject......
  • javasript利用jquery发送请求的各种方法
    Jquery发送ajax请求的方法有很多,其中最基本的是$.ajax方法,在其之上封装的方法有$.get,$post,$.put,$.ajaxForm,$fileUpload等。而在这些上层的方法中,后两个为jquery的......