Index online operation的过程 zt

在create index online, alter index rebuild online时,oracle是怎么工作的?


http://www.oracle.com/technology/deploy/availability/htdocs/online_ops.html

Online Index Operations

Oracle provides the capability to perform online index creation. During an online index create operation, concurrent queries and updates are allowed on the base table. During an online index creation operation, changes are recorded in a temporary journal table. At the end of index creation, the journal is merged into the new index. There are three phases in an online index create operation:

Prepare phase: locks are acquired on the table briefly to create the index structure and place entries in the data dictionary.

Build phase: most work is done in this phase where the index is populated. While the build phase occurs, changes to the table are placed in the journal table. The journal table is automatically created and structured as a B-tree so that multiple operations on the same table data can be easily detected and resolved to the latest change.

Merge phase: rows in the journal table are iterratively merged into the index. Most of the merge operation occurs while the table is still online. As journal rows are merged, they are deleted if they are not locked. During the merge phase, edits to the base table will continue to be tracked in the journal table. If changes to the journal continue to occur before the merge process can complete, Oracle will make additional passes through the journal. If after a few passes, the merge is still not complete, Oracle will lock the table briefly and apply the remainder of the journal. The entire process is transparent to the users and upon completion, the new index is brought online.

Index Rebuild (Move)

Oracle supports online index rebuilding. During an online index rebuild operation, concurrent queries and updates are allowed on the base table. The index rebuild operation requires additional disk space during the build process for the newly created index, but the resulting rebuilt index may be more space efficient. Hence the operation is likely to free up additional disk space.

The algorithm for online index rebuild is similar to that of online index creation, and the same basic phases are executed. During an online index rebuild operation, changes are recorded in a temporary journal table. At the end of index rebuild, the journal is merged into the new rebuilt index.

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/82387/viewspace-1016306/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/82387/viewspace-1016306/

代码开发 1)先调用smartform函数获取OTF格式数据 2)后调用函数CONVERT_OTF转换成PDF格式数据 3)再调用GUI_DOWNLOAD函数下载并邮件发送给采购员 ,涉及表 *&---------------------------------------------------------------------* *& 包含 ZNMMX037FA *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form FRM_GET_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_GET_DATA . *modify by songjiaru 20200519 SQL 性能优化 及 更改收件人邮箱取数逻辑 这里默认的是一个PO 只会存在一个工厂的数据 *不然没办法按照采购部的供应商+采购组织+工厂取ZNMMT037A来取数了 SELECT EKKO~EBELN , EKKO~BEDAT , EKKO~EKGRP , EKKO~LIFNR , EKKO~BUKRS , NAST~SPRAS , EKKO~EKORG , EKPO~WERKS INTO CORRESPONDING FIELDS OF TABLE @GT_DATA FROM EKKO INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN JOIN NAST ON NAST~OBJKY = EKKO~EBELN WHERE EKKO~EBELN IN @S_EBELN AND EKKO~LIFNR IN @S_LIFNR AND EKKO~EKORG IN @S_EKORG AND EKKO~EKGRP IN @S_EKGRP AND EKKO~BSART IN @S_BSART AND EKKO~BEDAT IN @S_BEDAT AND EKPO~WERKS IN @S_WERKS1 AND EKKO~FRGKE = '7' AND NAST~SPRAS IN @S_SPRAS. SORT GT_DATA BY EBELN. DELETE ADJACENT DUPLICATES FROM GT_DATA COMPARING EBELN. * LOOP AT GT_DATA INTO GS_DATA . * SELECT SINGLE * FROM ZNMMT037 * WHERE EBELN = GS_DATA-EBELN. * IF SY-SUBRC = 0. * IF CK_WFS = 'X'. * DELETE GT_DATA. * CONTINUE. * ENDIF. * GS_DATA-ICON = '@08@'. * GS_DATA-MESSAGE = '已有发送记录'. * GS_DATA-ERDAT = ZNMMT037-ERDAT. * ENDIF. * * SELECT SINGLE NAME1 MCOD1 ADRNR * INTO (GS_DATA-NAME1,GS_DATA-MCOD1,GS_DATA-ADRNR) * FROM LFA1 * WHERE LIFNR = GS_DATA-LIFNR. * * READ TABLE GT_MAIL INTO GS_MAIL WITH KEY ADRNR = GS_DATA-ADRNR BINARY SEARCH. * IF SY-SUBRC NE 0. * SELECT ADDRNUMBER SMTP_ADDR APPENDING TABLE GT_MAIL * FROM ADR6 * WHERE ADDRNUMBER = GS_DATA-ADRNR. * SORT GT_MAIL BY ADRNR. * ENDIF. * * LOOP AT GT_MAIL INTO GS_MAIL WHERE ADRNR = GS_DATA-ADRNR. * IF GS_DATA-SMTP_ADDR IS INITIAL. * GS_DATA-SMTP_ADDR = GS_MAIL-SMTP_ADDR. * ELSE. * GS_DATA-SMTP_ADDR = GS_DATA-SMTP_ADDR && ';' && GS_MAIL-SMTP_ADDR. * ENDIF. * ENDLOOP. * * MODIFY GT_DATA FROM GS_DATA. * ENDLOOP. DATA : LV_TABIX LIKE SY-TABIX. IF GT_DATA IS INITIAL. MESSAGE S322(ZMM) DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING. ENDIF. SELECT * FROM ZNMMT037 FOR ALL ENTRIES IN @GT_DATA WHERE ZNMMT037~EBELN = @GT_DATA-EBELN INTO TABLE @DATA(LT_ZNMMT037). SORT LT_ZNMMT037 BY EBELN. DATA : LS_ZNMMT037 LIKE LINE OF LT_ZNMMT037. SELECT LFA1~LIFNR , LFA1~NAME1 , LFA1~MCOD1 FROM LFA1 WHERE LFA1~LIFNR IN @S_LIFNR INTO TABLE @DATA(LT_LFA1). SORT LT_LFA1 BY LIFNR. DATA : LS_LFA1 LIKE LINE OF LT_LFA1. SELECT ZNMMT037A~LIFNR , ZNMMT037A~EKORG , ZNMMT037A~WERKS ,ZNMMT037A~EKGRP,ZNMMT037A~EMAIL FROM ZNMMT037A FOR ALL ENTRIES IN @GT_DATA WHERE ZNMMT037A~LIFNR = @GT_DATA-LIFNR AND ZNMMT037A~EKORG = @GT_DATA-EKORG INTO TABLE @DATA(LT_ZNMMT037A) . SORT LT_ZNMMT037A BY LIFNR EKORG WERKS EKGRP . DATA : LS_ZNMMT037A LIKE LINE OF LT_ZNMMT037A. LOOP AT GT_DATA ASSIGNING FIELD-SYMBOL(<LFS_DATA>). *------------填充发送记录---------------* CLEAR LS_ZNMMT037. READ TABLE LT_ZNMMT037 INTO LS_ZNMMT037 WITH KEY EBELN = <LFS_DATA>-EBELN BINARY SEARCH. IF SY-SUBRC = 0. IF CK_WFS = 'X'. <LFS_DATA>-FLAG = 'X'. CONTINUE. ENDIF. <LFS_DATA>-ICON = '@08@'. <LFS_DATA>-MESSAGE = TEXT-002. <LFS_DATA>-ERDAT = LS_ZNMMT037-ERDAT. ENDIF. *-----------填充供应商信息名字等等--------* CLEAR LS_LFA1. READ TABLE LT_LFA1 INTO LS_LFA1 WITH KEY LIFNR = <LFS_DATA>-LIFNR BINARY SEARCH. IF SY-SUBRC = 0. <LFS_DATA>-NAME1 = LS_LFA1-NAME1. <LFS_DATA>-MCOD1 = LS_LFA1-MCOD1. ENDIF. *--------填充供应商对应的邮件地址---------* *先根据供应商采购组织工厂采购员找,再根据供应商采购组织工厂找,如果找不到,就根据供应商采购组织找 CLEAR LS_ZNMMT037A. READ TABLE LT_ZNMMT037A INTO LS_ZNMMT037A WITH KEY LIFNR = <LFS_DATA>-LIFNR EKORG = <LFS_DATA>-EKORG WERKS = <LFS_DATA>-WERKS EKGRP = <LFS_DATA>-EKGRP BINARY SEARCH. IF SY-SUBRC = 0. LOOP AT LT_ZNMMT037A INTO LS_ZNMMT037A FROM SY-TABIX. IF LS_ZNMMT037A-LIFNR = <LFS_DATA>-LIFNR AND LS_ZNMMT037A-EKORG = <LFS_DATA>-EKORG AND LS_ZNMMT037A-WERKS = <LFS_DATA>-WERKS AND LS_ZNMMT037A-EKGRP = <LFS_DATA>-EKGRP. IF <LFS_DATA>-SMTP_ADDR IS INITIAL. <LFS_DATA>-SMTP_ADDR = LS_ZNMMT037A-EMAIL && '/'. ELSE. CONCATENATE <LFS_DATA>-SMTP_ADDR LS_ZNMMT037A-EMAIL '/' INTO <LFS_DATA>-SMTP_ADDR. ENDIF. ELSE. EXIT. ENDIF. ENDLOOP. ELSE. READ TABLE LT_ZNMMT037A INTO LS_ZNMMT037A WITH KEY LIFNR = <LFS_DATA>-LIFNR EKORG = <LFS_DATA>-EKORG WERKS = <LFS_DATA>-WERKS BINARY SEARCH. IF SY-SUBRC = 0. LOOP AT LT_ZNMMT037A INTO LS_ZNMMT037A FROM SY-TABIX. IF LS_ZNMMT037A-LIFNR = <LFS_DATA>-LIFNR AND LS_ZNMMT037A-EKORG = <LFS_DATA>-EKORG AND LS_ZNMMT037A-WERKS = <LFS_DATA>-WERKS. IF <LFS_DATA>-SMTP_ADDR IS INITIAL. <LFS_DATA>-SMTP_ADDR = LS_ZNMMT037A-EMAIL && '/'. ELSE. CONCATENATE <LFS_DATA>-SMTP_ADDR LS_ZNMMT037A-EMAIL '/' INTO <LFS_DATA>-SMTP_ADDR. ENDIF. ELSE. EXIT. ENDIF. ENDLOOP. ELSE. CLEAR LS_ZNMMT037A. READ TABLE LT_ZNMMT037A INTO LS_ZNMMT037A WITH KEY LIFNR = <LFS_DATA>-LIFNR EKORG = <LFS_DATA>-EKORG WERKS = '' BINARY SEARCH. IF SY-SUBRC = 0. LOOP AT LT_ZNMMT037A INTO LS_ZNMMT037A FROM SY-TABIX. IF LS_ZNMMT037A-LIFNR = <LFS_DATA>-LIFNR AND LS_ZNMMT037A-EKORG = <LFS_DATA>-EKORG AND LS_ZNMMT037A-WERKS = ''. IF <LFS_DATA>-SMTP_ADDR IS INITIAL. <LFS_DATA>-SMTP_ADDR = LS_ZNMMT037A-EMAIL && '/'. ELSE. CONCATENATE <LFS_DATA>-SMTP_ADDR LS_ZNMMT037A-EMAIL '/' INTO <LFS_DATA>-SMTP_ADDR. ENDIF. ELSE. EXIT. ENDIF. ENDLOOP. ENDIF. ENDIF. ENDIF. ENDLOOP. *end modify ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_OUTPUT_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_OUTPUT_DATA . DEFINE MAC_FCAT. CLEAR gs_fcat. gs_fcat-fieldname = &1. gs_fcat-coltext = &2. gs_fcat-key = &3. gs_fcat-ref_field = &4. gs_fcat-ref_table = &5. gs_fcat-just = &6. * IF &6 = 'R'. * gs_fcat-no_zero = 'X'. * ENDIF. if &1 = 'ICON'. gs_fcat-icon = 'X'. endif. APPEND gs_fcat TO gt_fcat. END-OF-DEFINITION. CLEAR GT_FCAT. IF SY-LANGU EQ '1'. MAC_FCAT 'EBELN' '采购订单号' '' 'EBELN' 'EKKO' ''. MAC_FCAT 'LIFNR' '供应商' '' 'LIFNR' 'LFA1' ''.. MAC_FCAT 'NAME1' '供应商名称' '' '' '' ''.. MAC_FCAT 'BEDAT' '凭证日期' ' ' '' '' ''. MAC_FCAT 'EKGRP' '采购组' ' ' '' '' ''. MAC_FCAT 'MCOD1' '简称' ' ' '' '' ''. MAC_FCAT 'SPRAS' '语言' ' ' 'SPRAS' 'NAST' ''. MAC_FCAT 'SMTP_ADDR' '供应商邮件' ' ' '' '' ''. MAC_FCAT 'ICON' '发送状态' ' ' '' '' ''. MAC_FCAT 'ERDAT' '发送日期' ' ' '' '' ''. MAC_FCAT 'MESSAGE' '消息' ' ' '' '' ''. ELSE. MAC_FCAT 'EBELN' 'PO' '' 'EBELN' 'EKKO' ''. MAC_FCAT 'LIFNR' 'Supplier' '' 'LIFNR' 'LFA1' ''.. MAC_FCAT 'NAME1' 'Supplier Name' '' '' '' ''.. MAC_FCAT 'BEDAT' 'Date' ' ' '' '' ''. MAC_FCAT 'EKGRP' 'Purchase Group' ' ' '' '' ''. MAC_FCAT 'MCOD1' 'Name For Short' ' ' '' '' ''. MAC_FCAT 'SPRAS' 'Language' ' ' 'SPRAS' 'NAST' ''. MAC_FCAT 'SMTP_ADDR' 'Email' ' ' '' '' ''. MAC_FCAT 'ICON' 'Status' ' ' '' '' ''. MAC_FCAT 'ERDAT' 'Send Date' ' ' '' '' ''. MAC_FCAT 'MESSAGE' 'Message' ' ' '' '' ''. ENDIF. GS_LAYOUT-ZEBRA = 'X'. GS_LAYOUT-CWIDTH_OPT = 'X'. GS_LAYOUT-BOX_FNAME = 'BOX'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING I_CALLBACK_PROGRAM = SY-REPID IS_LAYOUT_LVC = GS_LAYOUT IT_FIELDCAT_LVC = GT_FCAT I_SAVE = 'U' I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS' I_CALLBACK_USER_COMMAND = 'FRM_USER_COMMAND' TABLES T_OUTTAB = GT_DATA EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_USER_COMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM FRM_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD. DATA:LV_ANSWER TYPE C. DATA LR_GRID TYPE REF TO CL_GUI_ALV_GRID. DATA : LV_CLSS TYPE C . "X 代表发送给供应商和采购员 ''代表发送给采购员 CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' " IMPORTING E_GRID = LR_GRID. CALL METHOD LR_GRID->CHECK_CHANGED_DATA. CASE R_UCOMM. WHEN 'EMAIL'. "保存事件 LV_CLSS = 'X'. LOOP AT GT_DATA INTO GS_DATA WHERE BOX = 'X' AND ICON NE '@08@'. IF GS_DATA-SMTP_ADDR IS NOT INITIAL. PERFORM FRM_SEND_MAIL USING GS_DATA-EBELN GS_DATA-SPRAS GS_DATA-EKGRP GS_DATA-MCOD1 GS_DATA-BUKRS GS_DATA-SMTP_ADDR LV_CLSS CHANGING GS_DATA-ICON GS_DATA-MESSAGE GS_DATA-ERDAT. ELSE. GS_DATA-ICON = '@0A@'. GS_DATA-MESSAGE = TEXT-003 ." ENDIF. MODIFY GT_DATA FROM GS_DATA. ENDLOOP. *ADD BY SONGJIARU 20200519 增加只发送给采购员 WHEN 'EMAIL1'. LV_CLSS = ''. LOOP AT GT_DATA INTO GS_DATA WHERE BOX = 'X' AND ICON NE '@08@'. * IF GS_DATA-SMTP_ADDR IS NOT INITIAL. PERFORM FRM_SEND_MAIL USING GS_DATA-EBELN GS_DATA-SPRAS GS_DATA-EKGRP GS_DATA-MCOD1 * GS_DATA-ADRNR GS_DATA-BUKRS GS_DATA-SMTP_ADDR LV_CLSS CHANGING GS_DATA-ICON GS_DATA-MESSAGE GS_DATA-ERDAT. * ELSE. * GS_DATA-ICON = '@0A@'. * GS_DATA-MESSAGE = '邮件为空,不能发送' ." * ENDIF. MODIFY GT_DATA FROM GS_DATA. ENDLOOP. WHEN 'DOWN'. LOOP AT GT_DATA INTO GS_DATA WHERE BOX = 'X'. PERFORM FRM_DOWN_PDF USING GS_DATA-EBELN GS_DATA-SPRAS. ENDLOOP. WHEN '&IC1'. IF RS_SELFIELD-FIELDNAME = 'EBELN'. READ TABLE GT_DATA INTO GS_DATA INDEX RS_SELFIELD-TABINDEX. IF SY-SUBRC = 0. SET PARAMETER ID 'BES' FIELD GS_DATA-EBELN. CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN. ENDIF. ENDIF. WHEN OTHERS. ENDCASE. RS_SELFIELD-REFRESH = 'X'."刷新ALV报表 RS_SELFIELD-COL_STABLE = 'X'. RS_SELFIELD-ROW_STABLE = 'X'. ENDFORM. "FRM_USER_COMMAND *&---------------------------------------------------------------------* *& Form frm_set_pf_status2 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->RT_EXTAB text *----------------------------------------------------------------------* FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS 'PF_STATUS'. ENDFORM. "FRM_SET_PF_STATUS *&---------------------------------------------------------------------* *& Form FRM_SEND_MAIL *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> GS_DATA_EBELN *& --> GS_DATA_SPRAS *& <-- GS_DATA_ICON *& <-- GS_DATA_MESSAGE *& <-- ELSE *&---------------------------------------------------------------------* FORM FRM_SEND_MAIL USING P_EBELN P_SPRAS P_EKGRP P_MCOD1 P_BUKRS P_EMAIL P_CLSS CHANGING P_ICON P_MESSAGE P_ERDAT. DATA:LS_ZT37 LIKE ZNMMT037. DATA:LV_BUTXT LIKE T001-BUTXT. DATA:LT_CONTENT_BIN TYPE SOLIX_TAB. DATA: CL_SEND_REQUEST TYPE REF TO CL_BCS, CL_DOCUMENT TYPE REF TO CL_DOCUMENT_BCS, CL_BCS_EXCEPTION TYPE REF TO CX_BCS, CL_SENDER TYPE REF TO IF_SENDER_BCS, CL_RECIPIENT TYPE REF TO IF_RECIPIENT_BCS. DATA: LT_MAIN_TEXT TYPE BCSY_TEXT, LS_MAIN_TEXT LIKE LINE OF LT_MAIN_TEXT, LV_TITLE TYPE SO_OBJ_DES, LV_BOOL TYPE OS_BOOLEAN. DATA:LV_PATH TYPE STRING. DATA:LT_BIN TYPE TABLE OF TBL1024. DATA LV_CONTENT TYPE XSTRING. DATA LV_VLINE TYPE I. DATA : BEGIN OF LS_RECIEVE, EMAIL TYPE AD_SMTPADR, END OF LS_RECIEVE. DATA : LT_RECIEVE LIKE TABLE OF LS_RECIEVE. DATA : LV_INDEX1 TYPE I. DATA : LV_INDEX2 TYPE I. DATA : LV_INDEX3 TYPE I. LV_PATH = 'C:\PO\' && P_EBELN && '_' && SY-UZEIT && '.PDF'. PERFORM FRM_GET_PDF USING P_EBELN P_SPRAS LV_PATH CHANGING P_ICON P_MESSAGE. IF P_ICON IS INITIAL. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = LV_PATH FILETYPE = 'BIN' IMPORTING FILELENGTH = LV_VLINE TABLES DATA_TAB = LT_BIN[]. CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' EXPORTING INPUT_LENGTH = LV_VLINE IMPORTING BUFFER = LV_CONTENT TABLES BINARY_TAB = LT_BIN EXCEPTIONS FAILED = 1 OTHERS = 2. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING BUFFER = LV_CONTENT IMPORTING OUTPUT_LENGTH = LV_VLINE TABLES BINARY_TAB = LT_CONTENT_BIN. TRY. * 创建发送请求 CL_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ). SELECT SINGLE BUTXT INTO LV_BUTXT FROM T001 WHERE BUKRS = P_BUKRS. **处理标题头内容 CONCATENATE LV_BUTXT P_EBELN P_MCOD1 P_EKGRP INTO LV_TITLE SEPARATED BY SPACE. **处理邮件内容 *DG01 要求加上客制化描述 * IF P_BUKRS EQ 'DG01'. * IF SY-LANGU EQ '1'. * LS_MAIN_TEXT = * '附件是东莞长城开发新订单,请收到订单后邮件回复确认给采购员,并于3个工作日内在供应商平台上确认订单交期。供应商平台网址:https://sp.kaifa.cn '. * ELSE. * DATA(LV_STR) = 'The attachment is the new PO of Dongguan Kaifa Technology Co.,Ltd,' * && 'Please reply to the buyer after receiving the PO, and confirm the order delivery date on the supplier portal within 3 working days.' * && 'Supplier portal website(URL): https://sp.kaifa.cn '. * LS_MAIN_TEXT = LV_STR. * ENDIF. * APPEND LS_MAIN_TEXT TO LT_MAIN_TEXT. * ENDIF. * 创建整理发送内容 CL_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT( I_TYPE = 'RAW' I_TEXT = LT_MAIN_TEXT I_SUBJECT = LV_TITLE ). * 添加附件 DATA:L_OBJTP TYPE SOODK-OBJTP. DATA:L_OBJDES TYPE SOOD-OBJDES. L_OBJTP = 'PDF'. * l_objdes = p_ebeln && p_mcod1. CONCATENATE LV_BUTXT P_EBELN P_MCOD1 P_EKGRP INTO L_OBJDES SEPARATED BY SPACE. CALL METHOD CL_DOCUMENT->ADD_ATTACHMENT EXPORTING I_ATTACHMENT_TYPE = L_OBJTP I_ATTACHMENT_SUBJECT = L_OBJDES I_ATT_CONTENT_HEX = LT_CONTENT_BIN. * 添加邮件内容到发送请求 CL_SEND_REQUEST->SET_DOCUMENT( CL_DOCUMENT ). * 指定邮件发件人为采购员邮箱 * data:lv_sendtype type SX_ADDRTYP value '*', * lv_address_string type string value 'yuli@kaifa.cn', * lv_address_name type string value 'Yuli'. * cl_sender->ADDRESS_TYPE( lv_sendtype ). * cl_sender->ADDRESS_STRING( EXPORTING result = lv_address_string ). * cl_sender->ADDRESS_NAME( EXPORTING result = lv_address_name ). * cl_send_request->set_sender( cl_sender ). * data: sender type ref to cl_sapuser_bcs, * lv_uname type sy-uname value 'DTANG.IS'. * sender = cl_sapuser_bcs=>create( lv_uname ). * call method cl_send_request->set_sender * exporting * i_sender = sender. *modify by songjiaru 20200519 *----------------指定发件人----------------------------* CLEAR GS_MAIL-SMTP_ADDR. SELECT SINGLE SMTP_ADDR INTO GS_MAIL-SMTP_ADDR FROM T024 WHERE EKGRP = P_EKGRP. DATA(LO_SENDER) = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( I_ADDRESS_STRING = GS_MAIL-SMTP_ADDR I_ADDRESS_NAME = GS_MAIL-SMTP_ADDR ). CALL METHOD CL_SEND_REQUEST->SET_SENDER EXPORTING I_SENDER = LO_SENDER. * "指定邮件接收人 * LOOP AT GT_MAIL INTO GS_MAIL WHERE ADRNR = P_ADRNR. * CL_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( GS_MAIL-SMTP_ADDR ). * CL_SEND_REQUEST->ADD_RECIPIENT( CL_RECIPIENT ). * ENDLOOP. IF GS_MAIL-SMTP_ADDR IS NOT INITIAL. CL_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( GS_MAIL-SMTP_ADDR ). CL_SEND_REQUEST->ADD_RECIPIENT( CL_RECIPIENT ). ENDIF. IF P_CLSS = 'X'. * CLEAR GS_MAIL-SMTP_ADDR. * SELECT SINGLE SMTP_ADDR INTO GS_MAIL-SMTP_ADDR * FROM T024 * WHERE EKGRP = P_EKGRP. LV_INDEX1 = 0. LV_INDEX2 = 0. LV_INDEX3 = 1. CLEAR LT_RECIEVE. WHILE ( LV_INDEX3 <= STRLEN( P_EMAIL ) ). LV_INDEX2 = LV_INDEX2 + 1. LV_INDEX3 = LV_INDEX3 + 1. IF P_EMAIL+LV_INDEX1(LV_INDEX2) CA '/'. LV_INDEX2 = LV_INDEX2 - 1 . LS_RECIEVE-EMAIL = P_EMAIL+LV_INDEX1(LV_INDEX2). APPEND LS_RECIEVE TO LT_RECIEVE. CLEAR LS_RECIEVE. LV_INDEX1 = LV_INDEX3 - 1. LV_INDEX2 = 0. ENDIF. ENDWHILE. LOOP AT LT_RECIEVE INTO LS_RECIEVE. CL_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( LS_RECIEVE-EMAIL ). CL_SEND_REQUEST->ADD_RECIPIENT( CL_RECIPIENT ). ENDLOOP. ENDIF. ** 正式发送并提交作业 CLEAR LV_BOOL. "将邮件置于发件箱,可以在工作台outbox查看邮件的发送状态及内容 CL_SEND_REQUEST->SEND_REQUEST->SET_LINK_TO_OUTBOX( 'X' ). CALL METHOD CL_SEND_REQUEST->SEND_REQUEST->SETU_REQUESTED_STATUS EXPORTING I_REQUESTED_STATUS = 'N'. CALL METHOD CL_SEND_REQUEST->SEND_REQUEST->SETU_STATUS_MAIL EXPORTING I_STATUS_MAIL = 'A'. CL_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ). LV_BOOL = CL_SEND_REQUEST->SEND( I_WITH_ERROR_SCREEN = 'X'). IF LV_BOOL = 'X'. COMMIT WORK. * submit rsconn01 with mode = 'INT' and return. IF LT_CONTENT_BIN IS INITIAL. P_ICON = '@0A@'. P_MESSAGE = TEXT-004. "默认导入成功 ELSE. P_ICON = '@08@'. P_MESSAGE = TEXT-005. "默认导入成功 P_ERDAT = SY-DATUM. CLEAR LS_ZT37. LS_ZT37-EBELN = P_EBELN. LS_ZT37-ERDAT = SY-DATUM. LS_ZT37-ERTIM = SY-UZEIT. LS_ZT37-ERNAM = SY-UNAME. MODIFY ZNMMT037 FROM LS_ZT37. ENDIF. ELSE. P_ICON = '@0A@'. P_MESSAGE = TEXT-006. "默认导入成功 ROLLBACK WORK. ENDIF. CATCH CX_BCS INTO CL_BCS_EXCEPTION. P_ICON = '@0A@'. P_MESSAGE = TEXT-006 && CL_BCS_EXCEPTION->ERROR_TYPE.. "默认导入成功 ENDTRY. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_DOWN_PDF *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> GS_DATA_EBELN *& --> GS_DATA_SPRAS *& --> GS_DATA_TDSPOOLID *&---------------------------------------------------------------------* FORM FRM_DOWN_PDF USING P_EBELN P_SPRAS. DATA:LV_ICON TYPE ICON-NAME, LV_MESSAGE TYPE C LENGTH 120. PERFORM FRM_GET_PDF USING P_EBELN P_SPRAS '' CHANGING LV_ICON LV_MESSAGE. IF LV_ICON NE ''. LV_MESSAGE = P_EBELN && LV_MESSAGE. MESSAGE LV_MESSAGE TYPE 'E' . ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_GET_PDF *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> P_EBELN *& --> P_SPRAS *& <-- P_ICON *& <-- P_MESSAGE *&---------------------------------------------------------------------* FORM FRM_GET_PDF USING P_EBELN P_SPRAS P_PATH CHANGING P_ICON P_MESSAGE. DATA:LT_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE, LS_PDF LIKE TLINE. DATA:LS_NAST LIKE NAST, LV_SUBRC TYPE SY-SUBRC, LV_VLINE TYPE I, LV_SMARTFORM_NAME TYPE RS38L_FNAM VALUE 'ZPO_FORM', " 请替换为实际的Smart Form名称 LV_TEMPLATE TYPE STXH-TDNAME VALUE 'ZPO_FORM'. " 请替换为实际的模板名称 FIELD-SYMBOLS <FS_VALUE> TYPE ITCPP. SELECT SINGLE * INTO LS_NAST FROM NAST WHERE OBJKY = P_EBELN AND SPRAS = P_SPRAS. CALL FUNCTION 'WFMC_MESSAGE_SINGLE' EXPORTING PI_NAST = LS_NAST IMPORTING PE_RCODE = LV_SUBRC. IF LV_SUBRC = 0. ASSIGN ('(SAPLMEDRUCK)RESULT') TO <FS_VALUE>. IF <FS_VALUE>-TDSPOOLID IS NOT INITIAL. CLEAR LT_PDF. " 使用Smart Forms函数替代原函数 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = ZPO_FORM IMPORTING FM_NAME = LV_FM_NAME EXCEPTIONS NO_FORM = 1 NO_FUNCTION_MODULE = 2 OTHERS = 3. IF SY-SUBRC <> 0. P_ICON = '@0A@'. P_MESSAGE = '获取Smart Forms函数失败'. EXIT. ENDIF. " 动态调用Smart Forms函数 CALL FUNCTION LV_FM_NAME EXPORTING EXPORTING = 'X' TEMPLATE = LV_TEMPLATE OUTPUT_OPTIONS = LS_OUTPUT_OPTIONS IMPORTING JOB_OUTPUT_INFO = LS_JOB_OUTPUT_INFO TABLES LINES = LT_PDF EXCEPTIONS FORMATTING_ERROR = 1 INTERNAL_ERROR = 2 SEND_ERROR = 3 USER_CANCELED = 4 OTHERS = 5. IF SY-SUBRC <> 0. P_ICON = '@0A@'. P_MESSAGE = '执行ZPO_FORM函数失败'. EXIT. ENDIF. " 计算PDF字节数 LV_VLINE = LINES( LT_PDF ). IF LT_PDF[] IS NOT INITIAL. "先下载到本地,再上载做为附件 IF P_PATH IS NOT INITIAL. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING BIN_FILESIZE = LV_VLINE FILENAME = P_PATH FILETYPE = 'BIN' TABLES DATA_TAB = LT_PDF EXCEPTIONS FILE_WRITE_ERROR = 1 NO_BATCH = 2 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6. ELSE. DATA:LV_FILE TYPE STRING. PERFORM FRM_GET_PATH USING LV_FILE. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING BIN_FILESIZE = LV_VLINE FILENAME = LV_FILE FILETYPE = 'BIN' TABLES DATA_TAB = LT_PDF EXCEPTIONS FILE_WRITE_ERROR = 1 NO_BATCH = 2 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6. ENDIF. ELSE. P_ICON = '@0A@'. P_MESSAGE = TEXT-007. "默认导入成功 ENDIF. ELSE. P_ICON = '@0A@'. P_MESSAGE = TEXT-008. "默认导入成功 ENDIF. ELSE. P_ICON = '@0A@'. P_MESSAGE = TEXT-009. "默认导入成功 ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_GET_PATH *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> LV_PATH *&---------------------------------------------------------------------* FORM FRM_GET_PATH USING P_FILE. DATA: L_V_FILE_FILTER TYPE STRING. DATA: L_V_FILETABLE TYPE FILE_TABLE, L_T_FILETABLE TYPE FILETABLE. DATA: L_V_RC TYPE I. DATA: L_V_USER_ACTION TYPE I. * l_v_file_filter = '(*.xlsx;*.xls)|*.xlsx;*.xls|'. L_V_FILE_FILTER = '(*.PDF)|*.PDF|'. CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG( EXPORTING WINDOW_TITLE = '选择文件' FILE_FILTER = L_V_FILE_FILTER CHANGING FILE_TABLE = L_T_FILETABLE RC = L_V_RC USER_ACTION = L_V_USER_ACTION ). CHECK L_V_USER_ACTION EQ 0. CHECK L_T_FILETABLE[] IS NOT INITIAL. READ TABLE L_T_FILETABLE INTO L_V_FILETABLE INDEX 1. P_FILE = L_V_FILETABLE-FILENAME. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_MOD_SCREEN *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_MOD_SCREEN . LOOP AT SCREEN. IF SCREEN-GROUP1 = 'M1'. IF R1 = 'X'. SCREEN-ACTIVE = 1. ELSE. SCREEN-ACTIVE = 0. ENDIF. ENDIF. IF SCREEN-GROUP1 = 'M2'. IF R2 = 'X'. SCREEN-ACTIVE = 1. ELSE. SCREEN-ACTIVE = 0. ENDIF. ENDIF. IF SCREEN-GROUP1 = 'M3'. IF R3 = 'X'. SCREEN-ACTIVE = 1. ELSE. SCREEN-ACTIVE = 0. ENDIF. ENDIF. MODIFY SCREEN. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_DOWN_TEMPLATE *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_DOWN_TEMPLATE . CREATE OBJECT V_EXCEL 'EXCEL.APPLICATION'. SET PROPERTY OF V_EXCEL 'VISIBLE' = 1. CALL METHOD OF V_EXCEL 'WORKBOOKS' = V_BOOK . CALL METHOD OF V_BOOK 'ADD'. IF SY-LANGU EQ '1'. PERFORM FRM_FILL_CELL USING: 1 1 '供应商代码(必填)' 40 0 10, "行号,列号,值,单元格颜色,是否加粗,字体尺寸" 1 2 '采购组织(必填)' 40 0 10, "行号,列号,值,单元格颜色,是否加粗,字体尺寸" 1 3 '工厂(选填)' 40 0 10, 1 4 '采购员(选填)' 40 0 10, 1 5 '订单发送邮箱(必填)' 40 0 10. ELSE. PERFORM FRM_FILL_CELL USING: 1 1 'Vendor Code(Required)' 40 0 10, "行号,列号,值,单元格颜色,是否加粗,字体尺寸" 1 2 'Purchase Organization(Required)' 40 0 10, "行号,列号,值,单元格颜色,是否加粗,字体尺寸" 1 3 'Plant' 40 0 10, 1 4 'Buyer.Code' 40 0 10, " add buyer code 20210413 wahkenlee 1 5 'Email' 40 0 10. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_FILL_CELL *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> P_1 *& --> P_1 *& --> P_ *& --> P_40 *& --> P_0 *& --> P_10 *&---------------------------------------------------------------------* FORM FRM_FILL_CELL USING FU_ROW FU_COLUMN FU_VALUE FU_COLOR FU_BOLD FU_SIZE. DATA: L_CELL TYPE OLE2_OBJECT, L_COLOR TYPE OLE2_OBJECT, L_BOLD TYPE OLE2_OBJECT, L_COLUMN TYPE OLE2_OBJECT. CALL METHOD OF V_EXCEL 'CELLS' = L_CELL EXPORTING #1 = FU_ROW #2 = FU_COLUMN. SET PROPERTY OF L_CELL 'Value' = FU_VALUE. "赋值。" * call method of L_CELL 'INTERIOR' = int. GET PROPERTY OF L_CELL 'Interior' = L_COLOR. SET PROPERTY OF L_COLOR 'ColorIndex' = FU_COLOR. "根据值 显示对应的颜色。 GET PROPERTY OF L_CELL 'Font' = L_BOLD. SET PROPERTY OF L_BOLD 'Bold' = FU_BOLD. "1是加粗,0是不加粗" SET PROPERTY OF L_BOLD 'SIZE' = FU_SIZE. "设置字体大小。" CALL METHOD OF V_EXCEL 'Columns' = L_COLUMN " 选定列 EXPORTING #1 = FU_COLUMN . SET PROPERTY OF L_COLUMN 'ColumnWidth' = 20. " 定义列宽 SET PROPERTY OF L_COLUMN 'rowheight' = 24. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_MAINTAIN_EMAIL *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_MAINTAIN_EMAIL . PERFORM FRM_CHECK_AUTH. PERFORM FRM_UPLOAD_DATA. PERFORM FRM_CHECK_DATA. PERFORM FRM_UPDATE_DATA. PERFORM FRM_ALV. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_UPLOAD_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_UPLOAD_DATA . CLEAR : GS_ITEM ,GT_ITEM. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING FILENAME = GV_FILE I_BEGIN_COL = 1 I_BEGIN_ROW = 2 I_END_COL = 5 I_END_ROW = 65535 TABLES INTERN = GT_ALSM EXCEPTIONS INCONSISTENT_PARAMETERS = 1 UPLOAD_OLE = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE S000(ZMM) WITH TEXT-010 DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING. ENDIF. * 转换数据 LOOP AT GT_ALSM. ASSIGN COMPONENT GT_ALSM-COL OF STRUCTURE GS_ITEM TO <GFS_DATA>. TRANSLATE GT_ALSM-VALUE TO UPPER CASE. <GFS_DATA> = GT_ALSM-VALUE. AT END OF ROW. APPEND GS_ITEM TO GT_ITEM. CLEAR GS_ITEM. ENDAT. ENDLOOP. LOOP AT GT_ITEM ASSIGNING FIELD-SYMBOL(<LFS_ITEM>). CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = <LFS_ITEM>-LIFNR IMPORTING OUTPUT = <LFS_ITEM>-LIFNR. ENDLOOP. IF GT_ITEM IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-011 DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_CHECK_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_CHECK_DATA . DATA LV_NAME TYPE STRING . data:ls_email_stru type SX_ADDRESS, ls_email_stru_out type SX_ADDRESS. *前面已经判断过gt_item 不为空 SELECT LFA1~LIFNR , LFA1~NAME1 INTO TABLE @GT_LFA1 FROM LFA1 FOR ALL ENTRIES IN @GT_ITEM WHERE LFA1~LIFNR = @GT_ITEM-LIFNR. SORT GT_LFA1 BY LIFNR . SELECT T024E~EKORG , T001K~BWKEY FROM T024E INNER JOIN T001K ON T024E~BUKRS = T001K~BUKRS FOR ALL ENTRIES IN @GT_ITEM WHERE T024E~EKORG = @GT_ITEM-EKORG INTO TABLE @DATA(LT_T024E). SELECT T024~EKGRP FROM T024 FOR ALL ENTRIES IN @GT_ITEM WHERE T024~EKGRP = @GT_ITEM-EKGRP INTO TABLE @DATA(LT_T024). SORT LT_T024E BY EKORG BWKEY. SORT LT_T024 BY EKGRP. DATA LS_T024E LIKE LINE OF LT_T024E. DATA LS_T024 LIKE LINE OF LT_T024. LOOP AT GT_ITEM INTO GS_ITEM. MOVE-CORRESPONDING GS_ITEM TO GS_MESSAGE. CLEAR GS_LFA1. READ TABLE GT_LFA1 INTO GS_LFA1 WITH KEY LIFNR = GS_ITEM-LIFNR BINARY SEARCH . IF SY-SUBRC <> 0. GS_MESSAGE-MESSAGE = TEXT-012. GS_MESSAGE-FLAG = 'X'. ELSE. GS_MESSAGE-NAME1 = GS_LFA1-NAME1. ENDIF. IF GS_ITEM-EKORG IS INITIAL. CONCATENATE GS_MESSAGE-MESSAGE TEXT-013 INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. ENDIF. IF GS_ITEM-WERKS IS NOT INITIAL AND GS_ITEM-EKORG IS NOT INITIAL. CLEAR LS_T024E. READ TABLE LT_T024E INTO LS_T024E WITH KEY EKORG = GS_ITEM-EKORG BWKEY = GS_ITEM-WERKS BINARY SEARCH. IF SY-SUBRC <> 0. CONCATENATE GS_MESSAGE-MESSAGE TEXT-014 INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. ENDIF. ENDIF. IF GS_ITEM-EMAIL IS INITIAL. CONCATENATE GS_MESSAGE-MESSAGE '' INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. ELSE. "校验导入邮箱的格式 ls_email_stru-type = 'INT'. ls_email_stru-address = gs_item-email. CALL FUNCTION 'SX_INTERNET_ADDRESS_TO_NORMAL' EXPORTING ADDRESS_UNSTRUCT = ls_email_stru IMPORTING ADDRESS_NORMAL = ls_email_stru_out EXCEPTIONS ERROR_ADDRESS_TYPE = 1 ERROR_ADDRESS = 2 ERROR_GROUP_ADDRESS = 3 OTHERS = 4. if ls_email_stru is INITIAL. CONCATENATE GS_MESSAGE-MESSAGE TEXT-025 INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. endif. ENDIF. CALL FUNCTION 'ZMM_GET_DOMAIN' IMPORTING DOMAIN_NAME = LV_NAME. IF LV_NAME IS INITIAL. CONCATENATE GS_MESSAGE-MESSAGE TEXT-016 INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. ELSE. GS_MESSAGE-UNAME = LV_NAME. ENDIF. IF GS_ITEM-EKGRP IS NOT INITIAL. CLEAR:LS_T024. READ TABLE LT_T024 INTO LS_T024 WITH KEY EKGRP = GS_ITEM-EKGRP. IF SY-SUBRC <> 0. CONCATENATE GS_MESSAGE-MESSAGE TEXT-024 INTO GS_MESSAGE-MESSAGE. GS_MESSAGE-FLAG = 'X'. ENDIF. ENDIF. IF GS_MESSAGE-FLAG <> 'X'. CONCATENATE TEXT-017 SY-DATUM+0(4) '/' SY-DATUM+4(2) '/' SY-DATUM+6(2) TEXT-018 SYST-UZEIT+0(2) ':' SYST-UZEIT+2(2) ':' SYST-UZEIT+4(2) INTO GS_MESSAGE-MESSAGE. ENDIF. APPEND GS_MESSAGE TO GT_MESSAGE. CLEAR GS_MESSAGE. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_UPDATE_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_UPDATE_DATA . DATA : LT_ZNMMT037A TYPE TABLE OF ZNMMT037A. DATA : LS_ZNMMT037A LIKE LINE OF LT_ZNMMT037A. LOOP AT GT_MESSAGE INTO GS_MESSAGE WHERE FLAG <> 'X'. MOVE-CORRESPONDING GS_MESSAGE TO LS_ZNMMT037A. APPEND LS_ZNMMT037A TO LT_ZNMMT037A. CLEAR LS_ZNMMT037A. ENDLOOP. IF LT_ZNMMT037A IS NOT INITIAL. MODIFY ZNMMT037A FROM TABLE LT_ZNMMT037A. IF SY-DBCNT <> 0. COMMIT WORK. ENDIF. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_ALV *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_ALV . CLEAR GT_FIELDCAT. CLEAR GS_FIELDCAT. CLEAR GT_EVENTS. CLEAR GS_EVENTS. CLEAR GS_LAYOUT1. MOVE-CORRESPONDING GT_MESSAGE TO GT_EMAIL_ALV. IF SY-LANGU EQ '1'. GMRC_INITIAL_FIELD '供应商代码' 'LIFNR' 'X'. GMRC_INITIAL_FIELD '供应商名称' 'NAME1' 'X'. GMRC_INITIAL_FIELD '采购组织' 'EKORG' 'X'. GMRC_INITIAL_FIELD '工厂' 'WERKS' 'X'. GMRC_INITIAL_FIELD '采购员' 'EKGRP' 'X'. GMRC_INITIAL_FIELD '订单发送邮箱' 'EMAIL' 'X'. GMRC_INITIAL_FIELD '用户域名' 'UNAME' 'X'. GMRC_INITIAL_FIELD '信息' 'MESSAGE' ''. ELSE. GMRC_INITIAL_FIELD 'Supplier Code' 'LIFNR' 'X'. GMRC_INITIAL_FIELD 'Supplier Name' 'NAME1' 'X'. GMRC_INITIAL_FIELD 'Purchase Organization' 'EKORG' 'X'. GMRC_INITIAL_FIELD 'Plant' 'WERKS' 'X'. GMRC_INITIAL_FIELD 'Buyer.Code' 'EKGRP' 'X'. GMRC_INITIAL_FIELD 'Email' 'EMAIL' 'X'. GMRC_INITIAL_FIELD 'Domain' 'UNAME' 'X'. GMRC_INITIAL_FIELD 'Message' 'MESSAGE' ''. ENDIF. GS_LAYOUT1-COLWIDTH_OPTIMIZE = 'X'. GS_LAYOUT1-ZEBRA = 'X'. MOVE 'PF_STATUS_SET' TO GS_EVENTS-NAME. MOVE 'FRM_SET_PF_STATUS1' TO GS_EVENTS-FORM. APPEND GS_EVENTS TO GT_EVENTS. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = SY-REPID * I_CALLBACK_PF_STATUS_SET = '' I_CALLBACK_USER_COMMAND = 'FRM_USER_COMMAND2' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = IS_LAYOUT = GS_LAYOUT1 IT_FIELDCAT = GT_FIELDCAT * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = I_DEFAULT = 'X' * I_SAVE = 'A ' * IS_VARIANT = IT_EVENTS = GT_EVENTS * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * O_PREVIOUS_SRAL_HANDLER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = GT_EMAIL_ALV EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. FORM FRM_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS'0100' . ENDFORM. FORM FRM_SET_PF_STATUS1 USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS'0200' . ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_QUERY *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_QUERY . CLEAR : GT_QUERY_ALV. CLEAR : GS_QUERY_ALV. CLEAR GT_FIELDCAT. CLEAR GS_FIELDCAT. CLEAR GT_EVENTS. CLEAR GS_EVENTS. CLEAR GS_LAYOUT1. SELECT ZNMMT037A~LIFNR , ZNMMT037A~NAME1 , ZNMMT037A~EKORG , ZNMMT037A~WERKS , ZNMMT037A~EMAIL , ZNMMT037A~UNAME , ZNMMT037A~MESSAGE , ZNMMT037A~EKGRP FROM ZNMMT037A WHERE ZNMMT037A~LIFNR IN @S_LIFNR1 AND ZNMMT037A~EKORG IN @S_EKORG1 AND ZNMMT037A~WERKS IN @S_WERKS INTO TABLE @DATA(LT_ZNMMT037A) . MOVE-CORRESPONDING LT_ZNMMT037A TO GT_QUERY_ALV. IF SY-LANGU EQ '1'. GMRC_INITIAL_FIELD '供应商代码' 'LIFNR' 'X'. GMRC_INITIAL_FIELD '供应商名称' 'NAME1' 'X'. GMRC_INITIAL_FIELD '采购组织' 'EKORG' 'X'. GMRC_INITIAL_FIELD '工厂' 'WERKS' 'X'. GMRC_INITIAL_FIELD '采购员' 'EKGRP' 'X'. GMRC_INITIAL_FIELD '订单发送邮箱' 'EMAIL' 'X'. GMRC_INITIAL_FIELD '用户域名' 'UNAME' 'X'. GMRC_INITIAL_FIELD '信息' 'MESSAGE' ''. ELSE. GMRC_INITIAL_FIELD 'Supplier Code' 'LIFNR' 'X'. GMRC_INITIAL_FIELD 'Supplier Name' 'NAME1' 'X'. GMRC_INITIAL_FIELD 'Purchase Organization' 'EKORG' 'X'. GMRC_INITIAL_FIELD 'Plant' 'WERKS' 'X'. GMRC_INITIAL_FIELD 'Buyer.Code' 'EKGRP' 'X'. GMRC_INITIAL_FIELD 'Email' 'EMAIL' 'X'. GMRC_INITIAL_FIELD 'DOMAIN_NAME' 'UNAME' 'X'. GMRC_INITIAL_FIELD 'Message' 'MESSAGE' ''. ENDIF. GS_LAYOUT1-COLWIDTH_OPTIMIZE = 'X'. GS_LAYOUT1-ZEBRA = 'X'. GS_LAYOUT1-BOX_FIELDNAME = 'BOX'. MOVE 'PF_STATUS_SET' TO GS_EVENTS-NAME. MOVE 'FRM_SET_PF_STATUS' TO GS_EVENTS-FORM. APPEND GS_EVENTS TO GT_EVENTS. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = SY-REPID * I_CALLBACK_PF_STATUS_SET = '' I_CALLBACK_USER_COMMAND = 'FRM_USER_COMMAND1' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = IS_LAYOUT = GS_LAYOUT1 IT_FIELDCAT = GT_FIELDCAT * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = I_DEFAULT = 'X' * I_SAVE = 'A ' * IS_VARIANT = IT_EVENTS = GT_EVENTS * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * O_PREVIOUS_SRAL_HANDLER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = GT_QUERY_ALV EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. FORM FRM_USER_COMMAND1 USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD. CASE R_UCOMM. WHEN 'BACK' OR 'CANCEL' OR 'EXIT'. DATA : LV_SELTAB TYPE TABLE OF RSPARAMS. CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS' "获取当前的选择屏幕元素 EXPORTING CURR_REPORT = SY-REPID * IMPORTING * SP = TABLES SELECTION_TABLE = LV_SELTAB * SELECTION_TABLE_255 = EXCEPTIONS NOT_FOUND = 1 NO_REPORT = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. "使用获取到的屏幕元素跳转初始界面 SUBMIT ZNMMR037 WITH SELECTION-TABLE LV_SELTAB VIA SELECTION-SCREEN. WHEN 'DELETE'. IF R2 = 'X'. PERFORM FRM_DELETE_DATA. ENDIF. WHEN OTHERS. ENDCASE. ENDFORM. FORM FRM_USER_COMMAND2 USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD. CASE R_UCOMM. WHEN 'BACK' OR 'CANCEL' OR 'EXIT'. LEAVE TO SCREEN 0. WHEN OTHERS. ENDCASE. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_DELETE_DATA *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_DELETE_DATA . DATA : LS_COUNT TYPE I VALUE 0."删除记录的条数 DATA : LT_ZNMMT037A TYPE TABLE OF ZNMMT037A. DATA : LS_ZNMMT037A TYPE ZNMMT037A. DATA : LT_ALV LIKE GT_QUERY_ALV. DATA : LS_ALV LIKE LINE OF LT_ALV. CLEAR : LT_ZNMMT037A, LS_ZNMMT037A, LT_ALV, LS_ALV. LOOP AT GT_QUERY_ALV INTO GS_QUERY_ALV. IF GS_QUERY_ALV-BOX EQ 'X'. MOVE-CORRESPONDING GS_QUERY_ALV TO LS_ALV. APPEND LS_ALV TO LT_ALV. CLEAR LS_ALV. LS_ZNMMT037A-LIFNR = GS_QUERY_ALV-LIFNR. LS_ZNMMT037A-EKORG = GS_QUERY_ALV-EKORG. LS_ZNMMT037A-WERKS = GS_QUERY_ALV-WERKS. LS_ZNMMT037A-EMAIL = GS_QUERY_ALV-EMAIL. LS_ZNMMT037A-EKGRP = GS_QUERY_ALV-EKGRP. APPEND LS_ZNMMT037A TO LT_ZNMMT037A. CLEAR LS_ZNMMT037A. ENDIF. ENDLOOP. IF LT_ZNMMT037A IS INITIAL. MESSAGE E322(ZMM) DISPLAY LIKE 'W'. ENDIF. DELETE ZNMMT037A FROM TABLE LT_ZNMMT037A. IF SY-SUBRC EQ 0. COMMIT WORK AND WAIT. LOOP AT LT_ALV INTO LS_ALV. DELETE TABLE GT_QUERY_ALV FROM LS_ALV. LS_COUNT = LS_COUNT + 1. ENDLOOP. MESSAGE S104(ZMM) WITH LS_COUNT. DATA: LV_REF_GRID TYPE REF TO CL_GUI_ALV_GRID, LV_VALID TYPE C. IF LV_REF_GRID IS INITIAL. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING E_GRID = LV_REF_GRID. ENDIF. IF NOT LV_REF_GRID IS INITIAL. LV_REF_GRID->CHECK_CHANGED_DATA( IMPORTING E_VALID = LV_VALID ). ENDIF. IF LV_VALID IS NOT INITIAL. LV_REF_GRID->REFRESH_TABLE_DISPLAY( ) . ENDIF. ELSE. ROLLBACK WORK. MESSAGE E105(ZMM). ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_CHECK_AUTH *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_CHECK_AUTH . DATA LV_NAME TYPE STRING . CALL FUNCTION 'ZMM_GET_DOMAIN' IMPORTING DOMAIN_NAME = LV_NAME. SELECT SINGLE ZNMMT037B~DOMAIN_USER INTO @DATA(LV_DOMAIN) FROM ZNMMT037B WHERE ZPROGRAM = 'ZNMMR037' AND DOMAIN_USER = @LV_NAME. SELECT SINGLE ZNMMT037B~UNAME INTO @DATA(LV_UNAME) FROM ZNMMT037B WHERE ZPROGRAM = 'ZNMMR037' AND UNAME = @SY-UNAME. IF LV_DOMAIN IS INITIAL AND LV_UNAME IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-019 DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_CHECK *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM FRM_CHECK . DATA: LV_STRING TYPE STRING. DATA : LV_NAME TYPE STRING. FIELD-SYMBOLS : <LFS_WERKS> LIKE GS_WERKS. CLEAR GT_WERKS. CLEAR GS_WERKS. IF S_WERKS1[] IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-023. LEAVE LIST-PROCESSING. ELSE. CALL FUNCTION 'ZMM_GET_DOMAIN' IMPORTING DOMAIN_NAME = LV_NAME. SELECT ZME2M_PLANT~UNAME , ZME2M_PLANT~USER_DOMAIN ,ZME2M_PLANT~WERKS_LIST FROM ZME2M_PLANT WHERE ZME2M_PLANT~USER_DOMAIN = @LV_NAME INTO TABLE @DATA(LT_PLANT). SORT LT_PLANT BY WERKS_LIST. SELECT T001W~WERKS FROM T001W WHERE T001W~WERKS IN @S_WERKS1 INTO CORRESPONDING FIELDS OF TABLE @GT_WERKS. SORT GT_WERKS BY WERKS. IF GT_WERKS IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-022 DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING. ENDIF. IF LT_PLANT IS NOT INITIAL."在单点登录权限里面的用户在需要检查,不在里面的不需要检查 LOOP AT LT_PLANT INTO DATA(LS_PLANT). READ TABLE GT_WERKS WITH KEY WERKS = LS_PLANT-WERKS_LIST TRANSPORTING NO FIELDS BINARY SEARCH. IF SY-SUBRC <> 0. DELETE GT_WERKS WHERE WERKS = LS_PLANT-WERKS_LIST. ENDIF. ENDLOOP. ENDIF. IF GT_WERKS IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-021. LEAVE LIST-PROCESSING . ENDIF. LOOP AT GT_WERKS ASSIGNING <LFS_WERKS> . AUTHORITY-CHECK OBJECT 'M_BEST_WRK' ID 'ACTVT' FIELD '03' ID 'WERKS' FIELD <LFS_WERKS>-WERKS. IF SY-SUBRC <> 0. <LFS_WERKS>-FLAG = 'X'. ENDIF. ENDLOOP. DELETE GT_WERKS WHERE FLAG = 'X'. IF GT_WERKS IS INITIAL. MESSAGE S000(ZMM) WITH TEXT-020 DISPLAY LIKE 'W'. LEAVE LIST-PROCESSING . ENDIF. ENDIF. CLEAR S_WERKS1[]. CLEAR S_WERKS1. LOOP AT GT_WERKS INTO GS_WERKS. S_WERKS1-SIGN = 'I'. S_WERKS1-OPTION = 'EQ'. S_WERKS1-LOW = GS_WERKS-WERKS. APPEND S_WERKS1. CLEAR S_WERKS1. ENDLOOP. ENDFORM.
05-16
/** @file zwapi_entity.h @copyright (C) Copyright 2024, ZWSOFT CO., LTD. (Guangzhou) All Rights Reserved. @note THE HEADER FILE FOR THE ZW3D Entity API */ #pragma once #ifndef ZW_API_ENTITY_H /* this ifndef surrounds entire header */ #define ZW_API_ENTITY_H #include “zwapi_util.h” #include “zwapi_entity_data.h” #include “zwapi_matrix_data.h” #ifdef __cplusplus extern “C” { #endif /* __cplusplus */ //==================================================================================================================== /** @name Entity Create */ //==================================================================================================================== /** @ingroup ZwEntity Outputs the id of the last entity of the specified type created since the specified operation of the current transaction. @see cvxOpCount @see ZwEntityCreateListGet @see ZwEntityCreateGetAll @param [in] operation starting operation number ( >= 0 ) @param [in] type entity type @param [out] entity entity handle @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_OBJ_TYPE_ERROR @code int op = cvxOpCount(); ... szwEntityHandle entity = {}; ezwErrors ret = ZwEntityCreateGet(op, ZW_ENTITY_SHAPE, &entity); ... // free memory of handle ZwEntityHandleFree(&entity); @endcode */ ZW_API_C ezwErrors ZwEntityCreateGet(int operation, ezwEntityType type, szwEntityHandle *entity); /** @ingroup ZwEntity Outputs a list of the handles of the entities on the feature tree of the specified type created since the specified operation of the current transaction. @see cvxOpCount @see ZwEntityCreateGet @see ZwEntityCreateGetAll @param [in] operation starting operation number ( >= 0) @param [in] type entity type @param [out] count number of new entities @param [out] entityList list of new entity handles, the caller must free memory of the variable using ZwEntityHandleListFree @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_OBJ_DATA_GET_ERROR - ZW_API_MEMORY_ERROR - ZW_API_OBJ_TYPE_ERROR @code int op = cvxOpCount(); ... int count = 0; szwEntityHandle* entityList = nullptr; ezwErrors ret = ZwEntityCreateListGet(op, ZW_ENTITY_SHAPE, &count, &entityList); ... // free memory of handle ZwEntityHandleListFree(count, &entityList); @endcode */ ZW_API_C ezwErrors ZwEntityCreateListGet(int operation, ezwEntityType type, int *count, szwEntityHandle **entityList); /** @ingroup ZwEntity Outputs a list of the handles of the entities of the specified type created since the specified operation of the current transaction. the function will output all newly generated entities, including entities that are not on the feature tree, such as backup entities. @see cvxOpCount @see ZwEntityCreateGet @see ZwEntityCreateListGet @param [in] operation starting operation number ( >= 0) @param [in] type entity type @param [out] count number of new entities @param [out] entityList list of new entity handles, the caller must free memory of the variable using ZwEntityHandleListFree @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR - ZW_API_OBJ_TYPE_ERROR @code int op = cvxOpCount(); ... int count = 0; szwEntityHandle* entityList = nullptr; ezwErrors ret = ZwEntityCreateGetAll(op, ZW_ENTITY_SHAPE, &count, &entityList); ... // free memory of handle ZwEntityHandleListFree(count, &entityList); @endcode */ ZW_API_C ezwErrors ZwEntityCreateGetAll(int operation, ezwEntityType type, int *count, szwEntityHandle **entityList); //==================================================================================================================== /** @name Entity Get */ //==================================================================================================================== /** @ingroup ZwEntity Displays the specified "prompt" and waits for the user to pick an entity whose handle is output via "handle". @note The caller is responsible to free the handle by using ZwEntityHandleFree(). @param [in] prompt text prompt @param [in] option entity input option @param [in] emptyOk 1 if <middle-click> without input is okay; else 0 @param [out] handle entity handle (0 if undefined) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR : error or user-escape - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityGetByPick(const char *prompt, ezwEntityInputOption option, int emptyOk, szwEntityHandle *handle); /** @ingroup ZwEntity Displays the specified "prompt" and waits for the user to pick an entity whose handle is output via "handle" with a list of ezwEntityInputOption. @note The caller is responsible to free the handle by using ZwEntityHandleFree(). @param [in] prompt text prompt @param [in] option entity input option count @param [in] option entity input option list @param [in] emptyOk 1 if <middle-click> without input is okay; else 0 @param [out] handle entity handle (0 if undefined) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR : error or user-escape - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityGetByPickWithMultipleFilter(const char *prompt, int optionCount, ezwEntityInputOption *optionList, int emptyOk, szwEntityHandle *handle); /** @ingroup ZwEntity Displays the specified "prompt" and waits for the user to pick a list of entities, which is output via "handleList". @note The caller is responsible to free the handle by using ZwEntityHandleListFree(). @param [in] prompt text prompt @param [in] option entity input option @param [in] emptyOk 1 if <middle-click> without input is okay; else 0 @param [out] count number of entity picks @param [out] handleList list of entity id's @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR : error or user-escape - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityListGetByPick(const char *prompt, ezwEntityInputOption option, int emptyOk, int *count, szwEntityHandle **handleList); /** @ingroup ZwEntity Displays the specified "prompt" and waits for the user to pick a list of entities with a list of ezwEntityInputOption, which is output via "handleList". @note The caller is responsible to free the handle by using ZwEntityHandleListFree(). @param [in] prompt text prompt @param [in] option entity input option count @param [in] option entity input option list @param [in] emptyOk 1 if <middle-click> without input is okay; else 0 @param [out] count number of entity picks @param [out] handleList list of entity handles @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityListGetByPickWithMultipleFilter(const char *prompt, int optionCount, ezwEntityInputOption *optionList, int emptyOk, int *count, szwEntityHandle **handleList); /** @ingroup ZwEntity Finds the closest entity of the specified type to "referencePoint" and outputs its index via "entityHandle" (NULL is output if no entity is found). If "point" is not NULL, the coordinates of "referencePoint" projected onto the entity are output via "point". If "distance" is not NULL, the shortest distance between the entity and "referencePoint" is output via "distance". @param [in] entityType type of entity to search for @param [in] referencePoint reference point @param [out] entityHandle entity Handle (NULL if undefined) @param [out] point point on entity (or NULL to ignore) @param [out] distance distance (mm) from referencePoint (NULL to ignore) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_MEMORY_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL @code ezwEntityFind entityType=...; szwPoint referencePoint=...; szwEntityHandle entityHandle{}; szwPoint point{}; double distance=0; ZwEntityGetByPoint(entityType,referencePoint,&entityHandle,&point,&distance); ... //remember to free the handle you get. ZwEntityHandleFree(&entityHandle); @endcode */ ZW_API_C ezwErrors ZwEntityGetByPoint(ezwEntityFind entityType, szwPoint referencePoint, szwEntityHandle *entityHandle, szwPoint *point, double *distance); /** @ingroup ZwEntity Searches for the entity with the specified name and type in active file. @note If it is found, its handle is output via "entityHandle". If it is not found, innerData in entityHandle returns nullptr, but return no error. In this function, the entity handle will be allocated memory, so remember to deallocate it by ZwEntityHandleFree(). @param [in] name entity name @param [in] type entity type, ZW_ENTITY_ALL to search all type of entity, may find duplicate entity @param [out] entityHandle entity handle @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_GENERAL_ERROR - ZW_API_INVALID_NAME - ZW_API_INVALID_OUTPUT - ZW_API_OBJ_TYPE_ERROR @code //fill name zwString32 name={"..."}; //fill type ezwEntityType type=ezwEntityType::...; //prepare handle szwEntityHandle entityHandle{}; //get handle ZwEntityGetByNameAndType(name,type,&entityHandle); //free handle ZwEntityHandleFree(&entityHandle); @endcode */ ZW_API_C ezwErrors ZwEntityGetByNameAndType(const zwString32 name, ezwEntityType type, szwEntityHandle *entityHandle); /** @ingroup ZwEntity Gets all the entities displayed in the current view area. The function filters the entities using platform-activated filters. @note The caller is responsible to free the entityList by using ZwEntityHandleListFree(). @param [in] crossBoundary whether to get the entities that intersect the view boundary (1: yes; 0: no) @param [out] count number of entities @param [out] entityList list of entity handles @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MEMORY_ERROR */ ZW_API_C ezwErrors ZwEntityGetByCurrentView(int crossBoundary, int *count, szwEntityHandle **entityList); /** @ingroup ZwEntity Gets the current active entity.(part, sketch or drawing). When you activate an component in assembly, this API will get the component handle. When you in drawing, this API will get the drawing handle(not sheet handle). If you want to get sheet handle in drawing, please see ZwDrawingSheetListGet(). @note The caller is responsible to free the entityHandle by using ZwEntityHandleFree(). @param [out] entityHandle current active entity @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_ENT_PATH_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR - ZW_API_GENERAL_ERROR */ ZW_API_C ezwErrors ZwEntityActiveGet(szwEntityHandle *entityHandle); //==================================================================================================================== /** @name Entity Operate */ //==================================================================================================================== /** @ingroup ZwEntity Activates the target of the handle (newHandle) and outputs the handle of the original target object (oldHandle). If "oldHandle" is input as a NULL point, the original target handle is not output. If "updateGUI" is non-zero, this function updates the GUI menus to reflect a change in the target object. Otherwise, not update the GUI menus. @note The caller is responsible to free the oldHandle by using ZwEntityHandleFree(). This api only support to activate sketch, 3d sketch, block in sketch, Sheet Border in drawing and Title Block in drawing. @param [in] newHandle new target object handle @param [in] updateGUI 1 to update GUI, else 0 @param [out] oldHandle old entity handle(input NULL to ignore) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_ENT_PATH_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_INPUT - ZW_API_MEMORY_ERROR - ZW_API_GENERAL_ERROR - ZW_API_OBJ_TYPE_ERROR @code szwEntityHandle newHandle=...; int updateGUI=...; szwEntityHandle oldHandle{}; ZwEntityActivate(newHandle, updateGUI, &oldHandle); ... // remember to revert the environment after doing something. ZwEntityActivate(oldHandle, updateGUI, NULL); //free the handle you get ZwEntityHandleFree(&oldHandle); @endcode */ ZW_API_C ezwErrors ZwEntityActivate(szwEntityHandle newHandle, int updateGUI, szwEntityHandle *oldHandle); /** @ingroup ZwEntity Deletes specified entities in the active root object. @param [in] entityHandle entity handle to erase @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_PATH - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OBJ - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMM_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityDelete(szwEntityHandle entityHandle); /** @ingroup ZwEntity Erases the specified entity in the active root object(part, sketch, 3d sketch or drawing sheet). Notice that it will create erase feature in part file if you try to erase a shape. You can not erase a feature by this function. @param [in] entityHandle entity handle to erase @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_PATH - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OBJ - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMM_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityErase(szwEntityHandle entityHandle); /** @ingroup ZwEntity Deletes specified entities in the active root object. @note The entities in entityList must have the same type. @param [in] count the count of entity handles to delete @param [in] entityList entity handles to delete @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_PATH - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OUT_OF_RANGE - ZW_API_INVALID_OBJ - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMM_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityListDelete(int count, const szwEntityHandle *entityList); /** @ingroup ZwEntity Erases specified entities in the active root object(part, sketch, 3d sketch or drawing sheet). Notice that it will create erase feature in part file if you try to erase a shape. You can not erase feature by this function. @note The entities in entityList must have the same type. @param [in] count the count of entity handles to delete @param [in] entityList entity handles to delete @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_PATH - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OUT_OF_RANGE - ZW_API_INVALID_OBJ - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMM_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityListErase(int count, const szwEntityHandle *entityList); //==================================================================================================================== /** @name Entity State */ //==================================================================================================================== /** @ingroup ZwEntity Blanks or unblanks the specified entities. Besides, input "count" as a negative number can prevent a blank/unblank operation from being logged to the history in the case that this function is being applied to a part entity. @see ZwEntityBlankGet @param [in] count number of entities @param [in] entityList list of new entity handles @param [in] blank blank state (1: blank entities; 0: unblank entities) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_MEMORY_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_CMMD_EXEC_ERROR - ZW_API_INPUT_ERROR @code int count = 0; szwEntityHandle* entityList = nullptr; // some code to get the data of entity handles ... int blank = 1; ezwErrors ret = ZwEntityBlankSet(count, entityList, blank); ... // free memory of handle ZwEntityHandleListFree(count, &entityList); @endcode Call this function during echoing will not log any blank/unblank operation to the history, for example: @code cvxEchoStart(); cvxEntBlank(1, nEntity, &idEntity); cvxEchoEnd(); @endcode */ ZW_API_C ezwErrors ZwEntityBlankSet(int count, const szwEntityHandle *entityList, int blank); /** @ingroup ZwEntity Determines whether the specific entity is blanked. @see ZwEntityBlankSet @param [in] entity handle of entity @param [out] blanked blank state of entity (1: blanked; 0: visible) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL @code szwEntityHandle entity = {}; // some code to get the data of entity ... int blank = 0; ezwErrors ret = ZwEntityBlankGet(entity, &blank); ... // free memory of handle ZwEntityHandleFree(&entity); @endcode */ ZW_API_C ezwErrors ZwEntityBlankGet(szwEntityHandle entity, int *blanked); /** @ingroup ZwEntity Determines whether a valid entity with the specified type exists in the active root. @param [in] entity handle of entity @param [in] type entity type @param [out] exist entity existence (1: exist; 0: not found) @note Some of ezwEntityType(ZW_ENTITY_BREP, ZW_ENTITY_HISTORY, ZW_ENTITY_POINT, ZW_ENTITY_WIRE) are banned in this function. @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_TYPE_ERROR @code szwEntityHandle entity = {}; // some code to get the data of entity ... int exist = 0; ezwErrors ret = ZwEntityExistenceCheck(entity, ZW_ENTITY_SHAPE, &exist); ... // free memory of handle ZwEntityHandleFree(&entity); @endcode */ ZW_API_C ezwErrors ZwEntityExistenceCheck(szwEntityHandle entity, ezwEntityType type, int *exist); /** @ingroup ZwEntity Outputs the suppress state of specified entity(feature or component). @note You can not use this function to get suppress state of a solid entity. @param [in] handle entity handle @param [out] suppress the entity suppress state, 1-suppressed 0-unsuppressed. @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_INPUT_TYPE_ERROR */ ZW_API_C ezwErrors ZwEntitySuppressGet(szwEntityHandle handle, int *suppress); /** @ingroup ZwEntity Sets the status of turning front picking. If "isFrontPickOn" == 1, the front pick state is on. If "isFrontPickOn" == 0, the front pick state is off. When the button is turned on, it will ignore sheltered entities. @note This interface can only be used in part, assembly, cam, motion, sketch environments. @param [in] isFrontPickOn set the Front Pick button on or off @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_WRONG_ROOT_ENV @code int i = -1; ZwEntityFrontPickStateGet(&i); ZwEntityFrontPickStateSet(1); @endcode */ ZW_API_C ezwErrors ZwEntityFrontPickStateSet(int isFrontPickOn); /** @ingroup ZwEntity Gets the status of turning front picking. If "isFrontPickOn" == 1, the front pick state is on. If "isFrontPickOn" == 0, the front pick state is off. When the button is turned on, it will ignore sheltered entities. @note This interface can only be used in part, assembly, cam, motion, sketch environments. @param [out] isFrontPickOn whether the Front Pick button is on or off @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_OUTPUT - ZW_API_WRONG_ROOT_ENV @code int isFrontPickOn = -1; ZwEntityFrontPickStateGet(&isFrontPickOn); ZwEntityFrontPickStateSet(1); @endcode */ ZW_API_C ezwErrors ZwEntityFrontPickStateGet(int *isFrontPickOn); /** @ingroup ZwEntity Outputs a list of the entities picked in the active field of the active command. @param [out] count number of entities @param [out] entityList list of entity handles, the caller must free memory of the variable using ZwEntityHandleListFree() @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR @code int count = 0; szwEntityHandle* entityList = nullptr; ezwErrors ret = ZwEntityPickListGet(&count, &entityList); ... // free memory of handle ZwEntityHandleListFree(count, &entityList); @endcode */ ZW_API_C ezwErrors ZwEntityPickListGet(int *count, szwEntityHandle **entityList); /** @ingroup ZwEntity Unpicks the entity list in active field. @retval succeeds - ZW_API_NO_ERROR */ ZW_API_C ezwErrors ZwEntityUnPickAll(); /** @ingroup ZwEntity Unpicks the last entity in active field. @retval succeeds - ZW_API_NO_ERROR */ ZW_API_C ezwErrors ZwEntityUnPickLast(); /** @ingroup ZwEntity Unpicks the entity in active field. @param [in] entityHandle entity handle @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityUnPick(szwEntityHandle entityHandle); /** @ingroup ZwEntity Adds the specified entities to the pick list. @param [in] entityCount count of entities to pick @param [in] entityList handle list of entities @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MEMORY_ERROR */ ZW_API_C ezwErrors ZwEntityPickListAdd(int entityCount, const szwEntityHandle *entityList); //==================================================================================================================== /** @name Entity Attribute */ //==================================================================================================================== /** @ingroup ZwEntity Gets the standard color number assigned to "entityHandle". @see ZwEntityColorRgbGet @param [in] entityHandle entity handle (in active file) @param [out] color entity color @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityColorGet(szwEntityHandle entityHandle, ezwColor *color); /** @ingroup ZwEntity Assigns the specified color to the specified entities in the active file. @see ZwEntityColorRgbSet @param [in] color entity color @param [in] count number of entity handles @param [in] entityHandleList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMMD_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityColorSet(ezwColor color, int count, const szwEntityHandle *entityHandleList); /** @ingroup ZwEntity Gets the color assigned to "entityHandle" in RGB format. @see ZwEntityColorGet @param [in] entityHandle entity handle (in active file) @param [out] color entity RGB color @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityColorRgbGet(szwEntityHandle entityHandle, szwColor *color); /** @ingroup ZwEntity Assigns the specified RGB color to the specified entities in the active object. Presently, only face entities support true RGB color. For other entities, the specified RGB color is mapped to the closest standard color (ezwColor). @see ZwEntityColorSet @param [in] color entity RGB color @param [in] count number of entity handle @param [in] entityHandleList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMMD_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityColorRgbSet(szwColor color, int count, const szwEntityHandle *entityHandleList); /** @ingroup ZwEntity Same as ZwEntityColorRgbSet() except that no display attribute created, which means the color you set will expire after regen. @param [in] color entity RGB color @param [in] count number of entity handle @param [in] entityHandleList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_SET_ERROR */ ZW_API_C ezwErrors ZwEntityTemporaryColorRgbSet(szwColor color, int count, szwEntityHandle *entityHandleList); /** @ingroup ZwEntity Assigns the specified transparency to the specified entities in the active file. If the input transparency value exceeds 0-100, this function will fail. @param [in] transparency Entity transparency value, from 0 to 100, both ends included @param [in] count number of entity handle @param [in] entityHandleList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMMD_EXEC_ERROR - ZW_API_OBJ_TYPE_ERROR */ ZW_API_C ezwErrors ZwEntityTransparencySet(int transparency, int count, const szwEntityHandle *entityHandleList); /** @ingroup ZwEntity Gets the specified transparency to the specified entity in the active file. @param [in] entityHandle entity handle @param [out] transparency entity transparency value, from 0 to 100, both ends included @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_OBJ - ZW_API_INVALID_INPUT */ ZW_API_C evxErrors ZwEntityTransparencyGet(szwEntityHandle entityHandle, int *transparency); /** @ingroup ZwEntity Highlights the specified entity in the active root object with color. @param [in] entity handle data of entity @param [in] color color of object to display (NULL to use default) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_ENT_PATH - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_WRONG_ROOT_ENV */ ZW_API_C ezwErrors ZwEntityHighlightWithColor(szwEntityHandle entity, const szwColor *color); /** @ingroup ZwEntity Un-highlights all entities. @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_CMMD_INIT_ERROR - ZW_API_CMMD_EXEC_ERROR */ ZW_API_C ezwErrors ZwEntityUnhighlightAll(); /** @ingroup ZwEntity Highlights the specified entity in the active root object. @param [in] entityHandle entity handle(in active file) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityHighlight(szwEntityHandle entityHandle); /** @ingroup ZwEntity Un-highlights the specified entity in the active root object. @param [in] entityHandle entity handle(in active file) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityUnHighlight(szwEntityHandle entityHandle); /** @ingroup ZwEntity Gets the attributes of specified line. @param [in] lineHandle line handle @param [out] attribute line attribute @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR - ZW_API_OBJ_TYPE_ERROR */ ZW_API_C ezwErrors ZwLineAttributeGet(szwEntityHandle lineHandle, szwLineAttribute *attribute); /** @ingroup ZwEntity Sets the attributes of specified lines. If you only need to update some of the attributes, you can first get the original attributes through ZwLineAttributeGet(). @param [in] attribute line attribute @param [in] count number of entity handle @param [in] entityHandleList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_OBJ_TYPE_ERROR - ZW_API_CMMD_EXEC_ERROR */ ZW_API_C ezwErrors ZwLineAttributeSet(szwLineAttribute attribute, int count, const szwEntityHandle *entityHandleList); //==================================================================================================================== /** @name Entity Query */ //==================================================================================================================== /** @ingroup ZwEntity This function is to determine whether the point is the critical point of the 2D curve with curveHandle in Drawing Sheet. Meaning of critical point is the point with start, end, middle or center position of the curve. @param [in] curveHandle index of 2D curve @param [in] point point @param [out] isCritical whether the point is critical - 1 - it is a critical point - 0 - it is not a critical point or error @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT @code szwEntityHandle lineHandle=...; ... szwPoint point{}; ... int isCritical=0; ZwEntityCriticalPointCheck(lineHandle, &point, &isCritical); @endcode */ ZW_API_C ezwErrors ZwEntityCriticalPointCheck(szwEntityHandle curveHandle, szwPoint point, int *isCritical); /** @ingroup ZwEntity Determines whether an entity is curve (includes edges and parting lines). @param [in] entityHandle entity handle (in active file) @param [out] isCurve the entity is curvilinear @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT */ ZW_API_C ezwErrors ZwEntityCurveCheck(szwEntityHandle entityHandle, int *isCurve); /** @ingroup ZwEntity Determines whether an entity is electrode. @param [in] entityHandle entity handle (in active file) @param [out] isElectrode whether the entity is electrode @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityElectrodeCheck(szwEntityHandle entityHandle, int *isElectrode); /** @ingroup ZwEntity Projects "point" onto the specified curve, edge, face or plane and outputs the result as "projPoint". @param [in] entityHandle entity handle data of curve, edge, face or plane entity @param [in] point point to project @param [out] projPoint projected point on entity @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT @code szwPoint point{}; ... szwEntityHandle curveHandle=...; ... szwPoint point1{}; ... ZwEntityProjectionPointGet(curveHandle, point, &point1); @endcode */ ZW_API_C ezwErrors ZwEntityProjectionPointGet(szwEntityHandle entityHandle, szwPoint point, szwPoint *projPoint); /** @ingroup ZwEntity Outputs the handle of the shape that the specified face or edge (entityHandle) belongs to. It is assumed the entity resides in the active object. If "shapeHandle.innerData == NULL" is output, the entity could not be located or didn't belong to a face set. @note The caller is responsible to free the shapeHandle by using ZwEntityHandleFree(). @param [in] entityHandle entity handle (in active file) @param [out] shapeHandle shape handle data (shapeHandle.innerData = NULL if undefined) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityShapeGet(szwEntityHandle entityHandle, szwEntityHandle *shapeHandle); /** @ingroup ZwEntity Acquire the minimum distance between the point and the target entity, the target entity type includes shape, face, curve, edge, datum plane, point. @param [in] entityHandle entity handle data @param [in] point point coordinates of the inquiry @param [out] targetPoint the closest point on target entity (NULL to ignore) @param [out] distance the minimum distance (NULL to ignore) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOR_OBJ_ACT_FAIL @code szwEntityHandle shapeHandle=...; ... szwPoint point{}; ... szwPoint pointT{}; double distance; ... ZwEntityPointMinDistanceGet(shapeHandle, point, &pointT, &distance); @endcode */ ZW_API_C ezwErrors ZwEntityPointMinDistanceGet(szwEntityHandle entityHandle, szwPoint point, szwPoint *targetPoint, double *distance); /** @ingroup ZwEntity Inquires the related file name and root name of the input entity, only component and component reference are supported. 'component reference' is the tree node in drawing manager. @param [in] entityHandle entity handle data @param [in] fileSize max size of 'fileName' (0 to ignore) @param [out] fileName file name to get (NULL to ignore) @param [in] rootSize max size of 'rootName' (0 to ignore) @param [out] rootName root name to get (NULL to ignore) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_INPUT - ZW_API_INPUT_TYPE_ERROR - ZW_API_ROOR_OBJ_ACT_FAIL - ZW_API_WRONG_ROOT_ENV - ZW_API_OBJ_DATA_GET_ERROR - ZW_API_OUT_OF_RANGE */ ZW_API_C ezwErrors ZwEntityReferenceFileNameGet(szwEntityHandle entityHandle, int fileSize, char *fileName, int rootSize, char *rootName); //==================================================================================================================== /** @name Entity Info Get/Set */ //==================================================================================================================== /** @ingroup ZwEntity Outputs an ascii text string describing the entity class identified by "typeNumber". The string is stored in the memory referenced by "typeName", which is assumed to be sufficient (min = 64 bytes). @param [in] typeNumber entity class number @param [in] nameSize type name size @param [out] typeName class name @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_INPUT - ZW_API_OBJ_TYPE_ERROR @code //Prepare enough size zwString256 typeName{}; ezwEntityType type=...; ZwEntityTypeNameGet(type,sizeof(zwString256),typeName); @endcode */ ZW_API_C ezwErrors ZwEntityTypeNameGet(ezwEntityType typeNumber, int nameSize, char *typeName); /** @ingroup ZwEntity Returns the class number of the specified entity in the active object. @param [in] entityHandle entity handle @param [out] type class number @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT */ ZW_API_C ezwErrors ZwEntityTypeNumberGet(szwEntityHandle entityHandle, ezwEntityType *type); /** @ingroup ZwEntity Assigns the specified name to the specified entity. It is assumed the entity resides in the active file. It is assumed the entity has a "name" field. @note This function is often used to set the name of dimension/datum/texture/block/config/sheet/equation... You can use function "ZwEntityNameTagSet()" to set the name tag of shell/face... @param [in] entityHandle entity handle @param [in] name entity name @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_NAME - ZW_API_OUT_OF_RANGE - ZW_API_OBJ_DATA_SET_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityNameSet(szwEntityHandle entityHandle, const zwString32 name); /** @ingroup ZwEntity Sets the name tag of the specified entity, the character length of name tag can not exceed 256 character. @see ZwEntityNameTagGet @see ZwEntityNameTagGetAll @param [in] entity handle of entity @param [in] nameTag name tag (nullptr to delete name tag of entity) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_CMMD_INIT_ERROR - ZW_API_INPUT_ERROR - ZW_API_CMMD_EXEC_ERROR @code szwEntityHandle entity = {}; // some code to get the data of entity ... zwString256 nameTag = "Tag"; ezwErrors ret = ZwEntityNameTagSet(entity, nameTag); ... // free memory of handle ZwEntityHandleFree(&entity); @endcode */ ZW_API_C ezwErrors ZwEntityNameTagSet(szwEntityHandle entity, const char *nameTag); /** @ingroup ZwEntity Gets the name tag of the specified entity. @see ZwEntityNameTagSet @see ZwEntityNameTagGetAll @param [in] entity handle of entity @param [out] nameTag name tag @param [in] size max size of name tag @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OUT_OF_RANGE @code szwEntityHandle entity = {}; // some code to get the data of entity ... zwString256 nameTag = ""; ezwErrors ret = ZwEntityNameTagGet(entity, nameTag, sizeof(nameTag)); ... // free memory of handle ZwEntityHandleFree(&entity); @endcode */ ZW_API_C ezwErrors ZwEntityNameTagGet(szwEntityHandle entity, char *nameTag, int size); /** @ingroup ZwEntity Outputs a list of name tags of all entities in the current root object. @see ZwEntityNameTagSet @see ZwEntityNameTagGet @param [out] count number of name tags @param [out] nameTags list of the name tags, the caller must free memory of the variable using ZwMemoryFree @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MEMORY_ERROR - ZW_API_OUT_OF_RANGE @code int count = 0; zwString256* nameTags = nullptr; ezwErrors ret = ZwEntityNameTagGetAll(&count, &nameTags); ... // free memory ZwMemoryFree((void**)&nameTags); @endcode */ ZW_API_C ezwErrors ZwEntityNameTagGetAll(int *count, zwString256 **nameTags); /** @ingroup ZwEntity Outputs the handle of the specified entity's layer. @param [in] entityHandle entity handle @param [out] layerHandle layer handle @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityLayerGet(szwEntityHandle entityHandle, szwEntityHandle *layerHandle); /** @ingroup ZwEntity Outputs the matrix of the specified entity. @param [in] entityHandle entity handle @param [out] matrix transformation matrix @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityMatrixGet(szwEntityHandle entityHandle, szwMatrix *matrix); /** @ingroup ZwEntity Outputs the transformation matrix associated with the specified entity. @verbatim ZW3D uses column vector matrix for modeling and transforming entity. szwMatrix { 1.identity; 2. 3. 4. 5. xx, yx, zx, xt; xy, yy, zy, yt; xz, yz, zz, zt; 6.ox, oy, oz, scale; } 1. 1 if identity matrix, else 0 2. first column is vector on x-direction. 3. second column is vector on y-direction. 4. third column is vector on z-direction. 5. fourth column is offset of entity 6. original point of matrix and scale. (this row doesn't take effect and always (0,0,0,1) when transform entity in ZW3D.) @endverbatim @param [in] entityHandle entity handle @param [out] matrix transformation matrix @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityTransformMatrixGet(szwEntityHandle entityHandle, szwMatrix *matrix); /** @ingroup ZwEntity Sets the transformation matrix associated with the specified entity in the active file. If the entity does not support a transformation matrix, nothing is done. @param [in] entityHandle entity handle @param [in] matrix transformation matrix @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_SET_ERROR - ZW_API_MATRIX_NONORTHOGONAL */ ZW_API_C ezwErrors ZwEntityMatrixSet(szwEntityHandle entityHandle, szwMatrix matrix); /** @ingroup ZwEntity Outputs the handle of the parent feature of the specified entity in the active file. If you want to get child entity of feature, see ZwFeatureChildEntityListGet(). @param [in] entityHandle entity handle @param [out] featureHandle feature handle @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityParentFeatureGet(szwEntityHandle entityHandle, szwEntityHandle *featureHandle); /** @ingroup ZwEntity This function gets the bounding box of the specified entity. Interface ZwBoundingBoxTransform() can convert envelope boxes to different matrices. Interface cvxBndBoxPnts() can convert the envelope box to the coordinate value under the current world coordinate system. Interface ZwPointTransform() can convert points under different coordinate systems. @note When the matrix of the specified entity is not orthogonal to the matrix of the current world coordinate system(e.g. you want get bounding box of a component, and this component has been rotated in assemble, there are two bounding boxes you can get.) If you want to get its bounding box in original file, please set coordinateSystemType=ZW_COORDINATE_MODEL. If you want to get bounding box in current file set coordinateSystemType=ZW_COORDINATE_WORLD. When coordinateSystemType=ZW_COORDINATE_WORLD, the envelope box output from the interface can be directly converted to points. The envelope box drawn according to the coordinates of these points is correct. When coordinateSystemType=ZW_COORDINATE_MODEL, you need to convert the envelope box to the point coordinates first, and then convert the point to the point coordinates under the current coordinate system. At this time, the envelope box drawn according to the point coordinates is correct. When coordinateSystemType=ZW_COORDINATE_CUSTOM, the envelope box output from the interface is the result of multiplying "matrix" and bounding box in model coordinate system. matrix.xt, matrix.yt and matrix.zt won't take effect on transforming the bounding box. @param [in] entityHandle entity handle @param [in] coordinateSystemType coordinate system where bounding box in @param [in] matrix transform matrix, taking effect only when coordinateSystemType = ZW_COORDINATE_CUSTOM. @param [out] box bounding box of specified entity @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MATRIX_NONORTHOGONAL */ ZW_API_C ezwErrors ZwEntityBoundingBoxGet(szwEntityHandle entityHandle, ezwCoordinateType coordinateSystemType, szwMatrix matrix, szwBoundingBox *box); /** @ingroup ZwEntity This function gets the compact bounding box of the specified entity under the local coordinate system. This function only supports with component, shape, face, edge, curve and 3D block. @note A normal bounding box will be calculated with the distances of X, Y and Z more than zero, thus if the entity like a circle or face is parallel to XY, XZ or YZ plane, it can't get the correct result and returns ZW_API_GENERAL_ERROR. @param [in] entity entity handle @param [out] boudningBox bounding box of specified entity @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_WRONG_ROOT_ENV - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR */ ZW_API_C ezwErrors ZwEntityCompactBoundingBoxGet(szwEntityHandle entity, szwBoundingBox *boudningBox); /** @ingroup ZwEntity Gets the info of critical points for the specified entity. @note The caller is responsible to free the infoList by using ZwMemoryFree. @param [in] entityHandle entity handle (in active file) @param [out] count number of critical point info @param [out] infoList critical point info list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR */ ZW_API_C ezwErrors ZwEntityCriticalPointInfoGet(szwEntityHandle entityHandle, int *count, szwEntityCriticalPointInfo **infoList); /** @ingroup ZwEntity Searches sketches within the active part for the specified entity (entityHandle). @note If the entity is found within a sketch, the handle of the sketch is output. If the entity is not found inside a sketch, "sketchHandle" innerData is null and no error will be thrown. Remember to deallocate handle if it's innerData is not null. @param [in] entityHandle entity handle @param [out] sketchHandle handle of entity's parent sketch @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL @code szwEntityHandle handle=...; szwEntityHandle sketch{}; ZwEntityParentSketchGet(handle, &sketch); ... //free the handle you get ZwEntityHandleFree(&sketch); @endcode */ ZW_API_C ezwErrors ZwEntityParentSketchGet(szwEntityHandle entityHandle, szwEntityHandle *sketchHandle); /** @ingroup ZwEntity Outputs the handle of the parent feature of the specified entity in the active part. @note If the parent entity is found, the handle of the parent is output. If the parent entity is not found, "parentHandle" innerData is null and no error will be thrown. Remember to deallocate handle if it's innerData is not null. @param [in] entityHandle entity handle @param [out] parentHandle parent feature handle (NULL if undefined) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR @code szwEntityHandle handle=...; szwEntityHandle parent{}; ZwEntityParentGet(handle, &parent); ... //free the handle you get ZwEntityHandleFree(&parent); @endcode */ ZW_API_C ezwErrors ZwEntityParentGet(szwEntityHandle entityHandle, szwEntityHandle *parentHandle); /** @ingroup ZwEntity Gets the entity handle that "referenceHandle" takes it as a reference. @note If the entity is found, the handle is output. If the entity is not found, "handle" innerData is null and no error will be thrown. Remember to deallocate handle if it's innerData is not null. @param [in] referenceHandle parametric reference entity handle @param [out] handle handle of entity defined by reference entity @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OBJ_DATA_GET_ERROR @code szwEntityHandle referenceHandle=...; szwEntityHandle handle{}; ZwEntityReferenceGet(referenceHandle, &handle); ... //free the handle you get ZwEntityHandleFree(&handle); @endcode */ ZW_API_C ezwErrors ZwEntityReferenceGet(szwEntityHandle referenceHandle, szwEntityHandle *handle); /** @ingroup ZwEntity Outputs the name of the specified entity. It is assumed the entity resides in the active file. A blank string is output if the entity doesn't have a name. @param [in] entityHandle entity handle @param [in] nBytes string max size of entity name @param [out] name entity name @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_OUT_OF_RANGE */ ZW_API_C ezwErrors ZwEntityNameGet(szwEntityHandle entityHandle, int nBytes, char *name); //==================================================================================================================== /** @name Entity Handle */ //==================================================================================================================== /** @ingroup ZwEntity Transfers entity indexes to entity handles. @note The memory referenced by "entityHandles" is allocated by this function. The calling procedure is responsible to use ZwEntityHandleFree() to free it. @see ZwEntityHandleFree @param [in] count the num of entity list @param [in] indexes entity list @param [out] entityHandles entity handle data @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR - ZW_API_GENERAL_ERROR @code // transfer single entity szwEntityHandle entityHandle; // assume that there's a variable named entityId(int) ZwEntityIdTransfer(1, &entityId, &entityHandle); ... ZwEntityHandleFree(&entityHandle); // transfer entity array szwEntityHandle entityHandles[arrayCount]; // assume that there are a variable named arrayCount(int) and a variable named entityArray(int [] or int *) ZwEntityIdTransfer(arrayCount, entityArray, entityHandles); ... for (int i = 0; i < arrayCount; ++i) { ZwEntityHandleFree(&entityHandles[i]); } @endcode */ ZW_API_C ezwErrors ZwEntityIdTransfer(int count, const int *indexes, szwEntityHandle *entityHandles); /** @ingroup ZwEntity Transfers entity paths to entity handles. @note The memory referenced by "entityHandles" is allocated by this function. The calling procedure is responsible to free it. @see ZwEntityHandleFree @param [in] count the num of entity list @param [in] entityPaths entity list @param [out] entityHandles entity handle data @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_MEMORY_ERROR - ZW_API_GENERAL_ERROR @code // transfer single entity szwEntityHandle entityHandle; // assume that there's a variable named entityPath(svxEntPath) ZwEntityPathTransfer(1, &entityPath, &entityHandle); ... ZwEntityHandleFree(&entityHandle); // transfer entity array szwEntityHandle entityHandles[arrayCount]; // assume that there are a variable named arrayCount(int) and a variable named entityPaths(svxEntPath [] or svxEntPath *) ZwEntityIdTransfer(arrayCount, entityPaths, entityHandles); ... for (int i = 0; i < arrayCount; ++i) { ZwEntityHandleFree(&entityHandles[i]); } @endcode */ ZW_API_C ezwErrors ZwEntityPathTransfer(int count, const svxEntPath *entityPaths, szwEntityHandle *entityHandles); /** @ingroup ZwEntity Frees the inner data of the specified entity handle. @param [in] entityHandle entity handle data @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_GENERAL_ERROR */ ZW_API_C ezwErrors ZwEntityHandleFree(szwEntityHandle *entityHandle); /** @ingroup ZwEntity Frees the memory of an entity handle list and the inner data. In this function, it will free each member's inner data of entityList, then free the list. @param [in] count the count of entity handle list @param [in] entityList entity handle list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_INVALID_INPUT - ZW_API_GENERAL_ERROR */ ZW_API_C ezwErrors ZwEntityHandleListFree(int count, szwEntityHandle **entityList); /** @ingroup ZwEntity Gets the id of entity specified by entity handle. @note Before using this function, you need to allocate memory for "entityIdList" first. Id can be used in old style api(cvx***) Id can identify the entity in specified zw3d file, but it can be repetitive in different files. So DON'T get an id from one file and use it in other files. @param [in] count number of entity handles @param [in] handleList list of entity handle @param [out] entityIdList list of entity id @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MEMORY_ERROR */ ZW_API_C ezwErrors ZwEntityIdGet(int count, const szwEntityHandle *handleList, int *entityIdList); /** @ingroup ZwEntity Gets the entity path of entity specified by entity handle. @note Before using this function, you need to allocate memory for "entityPathList" first. Entity path can be used in old style api(cvx***) Entity path can identify the entity in specified zw3d document, but it can be repetitive in different document. So DON'T get an entity path from one document and use it in other document. @param [in] count number of entity handles @param [in] handleList list of entity handle @param [out] entityPathList list of entity path @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_MEMORY_ERROR */ ZW_API_C ezwErrors ZwEntityPathGet(int count, const szwEntityHandle *handleList, svxEntPath *entityPathList); //==================================================================================================================== /** @name Entity UniqueId */ //==================================================================================================================== /** @ingroup ZwEntity Outputs the unique id of the specified entity in the active part. @note The caller is responsible to free the entityId.innerData by using ZwMemoryFree(). @param [in] entityHandle entity handle @param [out] entityId entity id @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT - ZW_API_INVALID_INPUT - ZW_API_MEMORY_ERROR - ZW_API_OBJECT_NO_UNIQUEID @code szwEntityHandle entityHandle{}; szwEntityIdentifier entityId{}; ZwEntityUniqueIdGet(entityHandle, &entityId); ZwMemoryFree((void**)&entityId.innerData); @endcode */ ZW_API_C ezwErrors ZwEntityUniqueIdGet(szwEntityHandle entityHandle, szwEntityIdentifier *entityId); /** @ingroup ZwEntity Searches the active part for an entity with the specified label. @param [in] entityId entity id @param [out] entityHandle entity handle(nullptr is output if no entity is found) @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL */ ZW_API_C ezwErrors ZwEntityGetByUniqueId(szwEntityIdentifier entityId, szwEntityHandle *entityHandle); //==================================================================================================================== /** @name Entity Regen */ //==================================================================================================================== /** @ingroup ZwEntity Invoke the specified function of entity regenerate of the activated file. "regenMode" controls the regen mode: ZW_REGEN_FOR_HISTORY means regen history, ZW_REGEN_FOR_OUTDATED_OBJECTS means regen objects, ZW_REGEN_FOR_ASSEMBLY_ALL_COMPONENT means regen all component in assembly. "prompt" controls the status of prompt dialog for "No need to updated ....". 0 - enable; >0 - disable: the default action is "Yes"; -<0 - disable: the default action is "No" @note Only when the active file is an assembly, can the third mode be work. @param [in] regenMode regen mode @param [in] prompt flag to control the prompt status @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_WRONG_ROOT_ENV - ZW_API_INVALID_INPUT */ ZW_API_C ezwErrors ZwEntityAutoRegen(ezwEntityRegenMode regenMode, int prompt); /** @ingroup ZwEntity Specify the associated lines, edges and other solid objects that need to be queried in the 3D environment (parts, assembly), enter the drawing name and root name to be queried (the root name under a single root file is the same as the file name), and specify the list of views you need to query. The interface returns the 2D geometric objects corresponding to 3D solids in the drawing in the view order you specify. It should be noted that the display and hidden state of two-dimensional geometry in the drawing will not affect the acquisition of association, even if the 2D geometric objects are hidden. @note The caller is responsible to free the referenceList by using ZwEntityReferenceViewGeometryListFree. @param [in] entityHandle edge and curve handle @param [in] fileName file name @param [in] rootName root name @param [in] viewCount count of the view @param [in] viewHandleList handle list of view @param [out] countView the output count of view @param [out] referenceList referenced geometry list of view @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INPUT_TYPE_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT */ ZW_API_C ezwErrors ZwEntityReferenceDrawingGeometryGetByView(szwEntityHandle entityHandle, zwPath fileName, zwRootName rootName, int viewCount, szwEntityHandle *viewHandleList, int *countView, szwReferenceViewGeometryList **referenceList); /** @ingroup ZwEntity Specify the associated lines, edges and other solid objects that need to be queried in the 3D environment (parts, assembly), enter the drawing name and root name to be queried (the root name under a single root file is the same as the file name), and specify the Sheet list you need to query. The interface returns in the Sheet order you specify, and outputs views and a list of 2D objects that exist corresponding to 2D geometric objects. It should be noted that the display and hidden state of 2D geometric objects in the drawing will not affect the acquisition of association, even if the 2D geometric objects are hidden. @note The caller is responsible to free the referenceList by using ZwEntityReferenceViewGeometryListFree. @param [in] entityHandle edge and curve handle @param [in] fileName file name @param [in] rootName root name @param [in] sheetCount count of the sheet @param [in] sheetHandleList handle list of sheet @param [out] countSheet the output count of view @param [out] referenceList referenced geometry list of sheet @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INPUT_TYPE_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT */ ZW_API_C ezwErrors ZwEntityReferenceDrawingGeometryGetBySheet(szwEntityHandle entityHandle, zwPath fileName, zwRootName rootName, int sheetCount, szwEntityHandle *sheetHandleList, int *countSheet, szwReferenceSheetGeometryList **referenceList); /** @ingroup ZwEntity Specify the associated lines, edges and other solid objects that need to be queried in the 3D environment (parts, assembly), and enter the drawing name and root name to be queried (the root name is the same as the file name under a single root file). This API will return all 2D geometric objects corresponding to 3D entities in the drawing, and the output will be based on the Sheet page. Sheet with no corresponding geometry will not be returned, and you can see the corresponding view and 2D geometric objects in its substructures. It should be noted that the display and hidden state of 2D geometric objects in the drawing will not affect the acquisition of association, even if the 2D geometric objects are hidden. @note The caller is responsible to free the referenceList by using ZwEntityReferenceViewGeometryListFree. @param [in] entityHandle edge and curve handle @param [in] fileName file name @param [in] rootName root name @param [out] countSheet the output count of view @param [out] referenceList referenced geometry list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INPUT_TYPE_ERROR - ZW_API_INVALID_INPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_INVALID_OUTPUT */ ZW_API_C ezwErrors ZwEntityReferenceDrawingGeometryGetAll(szwEntityHandle entityHandle, zwPath fileName, zwRootName rootName, int *countSheet, szwReferenceSheetGeometryList **referenceList); /** @ingroup ZwEntity Frees memory associated with the specified szwReferenceViewGeometryList structure. @param [in] countData count of input data @param [in] referenceList referenced geometry list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT */ ZW_API_C ezwErrors ZwEntityReferenceViewGeometryListFree(int countData, szwReferenceViewGeometryList **referenceList); /** @ingroup ZwEntity Frees memory associated with the specified szwReferenceSheetGeometryList structure. @param [in] countData count of input data @param [in] referenceList referenced geometry list @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT */ ZW_API_C ezwErrors ZwEntityReferenceSheetGeometryListFree(int countData, szwReferenceSheetGeometryList **referenceList); /** @ingroup ZwEntity Gets the distance between two entities in part environment. @param [in] entity1 handle of entity 1 @param [in] entity2 handle of entity 2 @param [out] point1 point on entity 1 (NULL to ignore) @param [out] point2 point on entity 2 (NULL to ignore) @param [out] distance distance of point1 and point2 @retval succeeds - ZW_API_NO_ERROR @retval fail - ZW_API_GENERAL_ERROR - ZW_API_INVALID_INPUT - ZW_API_INVALID_OUTPUT - ZW_API_ROOT_OBJ_ACT_FAIL - ZW_API_WRONG_ROOT_ENV */ ZW_API_C ezwErrors ZwEntityDistanceGet(szwEntityHandle handle1, szwEntityHandle handle2, szwPoint *point1, szwPoint *point2, double *distance); /* ** END HEADER FILE */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* ZW_API_ENTITY_H */翻译注释
最新发布
10-31
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值