EKL脚本语言基础代码示例

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

本文主要记录了一些EKL脚本语言的基础代码示例。


一、什么是EKL?

EKL(Enterprise Knowledge Language) 3DEXPERIENCE中提供的基础脚本语言。
▪主要是作为一种胶水语言,将CATIA 提供的各种知识工程的接口“粘合”在一起。通过简单的语法提供基础的编程的功能。

二、练习案例

1.创建物理产品和3D Part

代码如下:

let productRef(VPMReference)
productRef = new("VPMReference","myProductRef",NULL)
let productIns(VPMInstance)
productIns = new("VPMInstance","myProductIns",rootProduct,productRef)

Let createdInstance1(VPMInstance)
createdInstance1 = new("3DPart", "MyNewRef3DPart",productRef)

2.遍历查询

代码如下:

Let childrenList1,childrenList2,childrenList3,childrenList4,childrenList5(List)
childrenList1 = ProductOcc.Children
//Message("No of Children = ", childrenList1.Size())
Notify("list",childrenList1)
childrenList2=ProductOcc.Reference.Query("AdvisorAction","")
Notify("list",childrenList2)
childrenList3=ProductOcc.Reference.Query("VPMReference","")
Notify("list",childrenList3)
childrenList4=ProductOcc.Query("ProductOccurrence","x.Name==\"MyNewRef3DPart.2\"")
Notify("list",childrenList4)
childrenList5=ProductOcc.Query("ProductOccurrence","x.Name like\"*MyNewRef3DPart*\"")
Notify("list",childrenList5)

3.创建几何图形集

代码如下:(这里有一个问题,3D Shape的节点是PartFeature类型,但是选择的时候却不能选择3D Shape节点,而是选择了其下面的特征节点)

let createdOpenBodyFeature(OpenBodyFeature)
let Body1(BodyFeature)
createdOpenBodyFeature=new("OpenBodyFeature","几何图形集",parentRepInstance)
Body1=new("BodyFeature","立柱",parentRepInstance,"")

4.文件交互

1、读写excel文件,使用CreateSheet()来打开Excel,如果想要打开具体的页,就用CreateSheet([strFileName]SheetNumber),想要写入Excel,要用SetCell(),读取用CellAsBoolean()、CellAsString()、CellAsReal()。但是要注意,SetCell()的行数计数是从1开始的,而CellAsString()这些都是从0开始计数的。

Let strFileName(String)
Let oXLSheet(DTSheetType)
Let indx(Integer)
Let noOfRows(Integer)
Let strColorName(String)
Let rValue(Real)
Let gValue(Real)
Let bValue(Real)
Let strRowValue(String)

strFileName = "C:\\Users\\Atz\\Desktop\\input.xlsx"
Set oXLSheet = CreateSheet(strFileName)
noOfRows = oXLSheet.RowsNb//获取行数
indx = 1
oXLSheet.SetCell(6,2,666)
Notify(oXLSheet.CellAsString(5, 2))
For indx while indx < noOfRows
{
	strColorName = oXLSheet.CellAsString(indx, 1)
	rValue = oXLSheet.CellAsReal(indx, 2)
	gValue = oXLSheet.CellAsReal(indx, 3)
	bValue = oXLSheet.CellAsReal(indx, 4)
	Notify(strColorName," ",rValue," ",gValue," ",bValue)
}

2、读写txt文件,OpenTextFile的时候,"r"表示读,"w"表示写,"a"表示在结尾往后写,

Let file (TextFile)
Let buffer (String)
Set file = OpenTextFile("C:\\Users\\Atz\\Desktop\\input.txt","r")
buffer = file->Read()
Set file = OpenTextFile("C:\\Users\\Atz\\Desktop\\input2.txt","a")
file->Write(buffer)
file->Close()

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在Docker中安装Elasticsearch、Kibana和Logstash(EKL)堆栈,您可以按照以下步骤进行操作: 1. 首先,确保您已经安装了Docker和Docker Compose。您可以根据您的操作系统找到适合您的安装方法。 2. 创建一个新的目录来存放您的EKL配置文件和数据。例如,您可以创建一个名为`ekl`的目录。 3. 在`ekl`目录中创建一个名为`docker-compose.yml`的文件,并使用以下内容填充它: ```yaml version: '3' services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0 container_name: elasticsearch environment: - discovery.type=single-node ports: - 9200:9200 volumes: - esdata:/usr/share/elasticsearch/data kibana: image: docker.elastic.co/kibana/kibana:7.15.0 container_name: kibana ports: - 5601:5601 environment: - ELASTICSEARCH_HOSTS=http://elasticsearch:9200 logstash: image: docker.elastic.co/logstash/logstash:7.15.0 container_name: logstash volumes: - ./logstash/config/:/usr/share/logstash/pipeline/ ports: - 5044:5044 volumes: esdata: ``` 4. 在`ekl`目录中创建一个名为`logstash`的子目录,并在其中创建一个名为`config`的子目录。 5. 在`config`目录中创建一个名为`logstash.conf`的文件,并使用以下内容填充它: ``` input { beats { port => 5044 } } output { elasticsearch { hosts => "elasticsearch:9200" index => "logs-%{+YYYY.MM.dd}" } } ``` 6. 确保您在`ekl`目录中打开一个终端或命令提示符窗口,并运行以下命令来启动EKL堆栈: ``` docker-compose up ``` 这将下载所需的Docker镜像并启动Elasticsearch、Kibana和Logstash容器。 7. 在浏览器中访问`http://localhost:5601`以打开Kibana控制台。您可以使用Kibana来管理和可视化您的日志数据。 请注意,以上步骤提供了一个基本的配置,并且默认情况下没有进行任何安全性配置。在生产环境中,您应该根据需要进行进一步的配置和安全性硬化。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值