查看: 3286|回复: 0

【Aras Innovator 二次开发入门】5 创建对象Document

[复制链接]

4

主题

3

回帖

40

积分

管理员

积分
40
发表于 2018-7-6 16:14:08 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
【Aras Innovator 二次开发入门】5 创建对象Document( n4 }! k! x4 z! ]

" w' W4 C, A3 n" W  W& H$ s8 [

" h9 u( H; o5 V3 s4 Z4 \使用代码创建对象:1 ~9 N$ G" j1 a4 J  v" s, I* i3 B
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!! \3 a9 m/ [( d" D
# t5 G7 G3 [4 |+ N3 H

0 n: K5 a, D6 N8 K. W Console.WriteLine("4 =============Add a item  ======================");4 q0 C5 D: P: f+ u
            //we select the information from sql 4 q; d. b: e1 z$ K( N1 h
            //select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT
9 @" @& j5 m2 f  r) {9 d# `1 i            //ITEM_NUMBER        NAME        CLASSIFICATION        AUTHORING_TOOL        EFFECTIVE_DATE- ^& K( C- O% ^# G# E
            // testDoc NULL    Process Text Editor 2018 - 07 - 05 02:25:27.000
5 n! V: d. F% E4 J1 I            Item newDocItem = newInnovator.newItem("Document", "add");9 A# U# h2 l6 b! O
            newDocItem.setProperty("item_number", "plmhomeTestDoc2222");: w4 d# Q: n: n' A: W8 D
            newDocItem.setProperty("name", "plmhomeDocument");" K- v% K! Z6 x4 j* a. t
            newDocItem.setProperty("classification", "Process");
( m* P( W* I3 ]- w1 e, N2 F            newDocItem.setProperty("authoring_tool", "Text_Editor");% B/ w5 b* l, H% @- H7 t
            newDocItem.setProperty("effective_date", "2018-07-06");4 i0 g& A, r8 t* R: K; R

7 ~* K* [; N4 s9 r7 n

9 {, A2 I  _. n( F* y# _            newDocItem.apply();
$ C4 U0 Z- @( H/ L. P; {            if (newDocItem.isError()): J) Y: A6 s+ @9 {6 l! b, A5 F$ w0 w
            {
8 _0 }4 e5 [) }* p; g1 F* b6 s- K% i                Console.WriteLine("Create error !");
6 w6 S' q. e& W$ f- `1 u7 \6 J            }' P( z/ m6 U# Y* \5 {, L
            else+ W" \' H5 G$ `9 y* q
            {: |3 k; V; t2 R; t& n6 N: t
                Console.WriteLine("works fine to create the docuement");
7 n* L' A/ b; x, ], }            }
; s+ |7 l% A' G  y5 L0 |
2 n& k& x% Y: ]; l8 k/ B7 d
* x9 G4 i+ D0 K: U' J

- M. `# c6 u6 ?! W" z, t' L, q 555.PNG $ L+ n4 j2 r/ m$ I/ X, k6 L8 f
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部