PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

2018-7-6 16:14:08 3108 0

admin 发表于 2018-7-6 16:14:08 |阅读模式

admin 楼主

2018-7-6 16:14:08

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

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

x
【Aras Innovator 二次开发入门】5 创建对象Document! Q( t6 `1 j% K7 c! p% q

* e9 |+ y: B6 n8 Z& _$ a
& n4 ]$ K% s* i0 H
使用代码创建对象:
5 [8 P* h! T8 M% o$ h可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!0 M9 Y9 Q; P/ r3 t  ]/ B

: j% S+ H. }* M. Z7 l0 O9 w) }
2 ?' n, P" V/ d8 F1 J
Console.WriteLine("4 =============Add a item  ======================");
" C9 d" O# m+ Z, S4 X& D            //we select the information from sql
. f  E( A& D1 f3 C+ m            //select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT8 {  n/ C* D# o  f
            //ITEM_NUMBER        NAME        CLASSIFICATION        AUTHORING_TOOL        EFFECTIVE_DATE+ N3 M0 N" _4 t! J
            // testDoc NULL    Process Text Editor 2018 - 07 - 05 02:25:27.000) {+ O" T, q( e: d
            Item newDocItem = newInnovator.newItem("Document", "add");2 A9 A" F$ }  O
            newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
: ?! c3 X1 N. g- N* a2 K3 M" G. _            newDocItem.setProperty("name", "plmhomeDocument");/ |3 y* E( [, ^' ^8 A4 i
            newDocItem.setProperty("classification", "Process");
1 O+ k8 ^7 u0 w1 O& U            newDocItem.setProperty("authoring_tool", "Text_Editor");6 f" J3 C5 g3 W: q
            newDocItem.setProperty("effective_date", "2018-07-06");/ @! L2 |+ ?& k: `) Z8 o

3 w" `9 L8 j& A& l: B

7 a0 k4 R& j( {& Z; q            newDocItem.apply();  o. ^7 r! M% W$ C
            if (newDocItem.isError())
3 A) f$ c& g- y3 F. j5 |+ u            {
5 T! B4 s1 [2 L$ |( ~                Console.WriteLine("Create error !");
/ Y+ y) X+ q( `! k            }2 q9 u4 w% H1 z% a
            else1 \6 r( Z" E8 ?  J; g
            {
. s  P6 b: _6 H* z- x% b$ j                Console.WriteLine("works fine to create the docuement");
: W% J  w1 |1 e5 R" ~8 n" B            }
4 o: I  `8 C7 |* B9 A- z
/ [! C* b$ x) [3 k/ M) @/ V' y7 F/ y& p. P0 ]! q: c9 I- O
% F3 V) S, u2 v: l% f1 X; R
555.PNG
" ^2 j0 C) s# G( \6 E
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了