118:
sheng519:
增加自定义图形所有者属性,设置打开图形时的触发器,判断当前用户是否是图形所有者,如果是,继续;如果不是,关闭当前图形后以只读方式打开。 好想是这么回事!可以具体说说吗? 帮你想想 你得谢谢我们sheng519: 你可以在触发器中这样设置,在触发器中设置好几个合法用户的IP/计算机名字,然后在触发器中 对于图形的保存/SAVE AS 这样的命令进行触发条件,当合法用户进行此操作的时候那么就会进行讲用户的信息(IP/计算机名字)写入图形的参考信息中.那么在打开的时候同样设置触发条件,当用户信息和参考信息合法的时候,允许用户读写,如果不合法,那么只读. 如果是非法用户建立了图形你也可以黑一点,在他进行保存工作后 删除他建立的文件...................... 其中有几个重要的地方. 1.触发器 Save drawing post-trigger | Event: | File / Save | Type: | Post | File name: | trig_draft_dwg_save | Input Parameters: | None | Allowed return values: | Standard for Post-Trigger | Note: | This trigger only executes after drawing has been successfully saved. If an error occurs during saving, the trigger will not be executed. |
Save As drawing pre-trigger | Event: | File / Save As | Type: | Pre | File name: | trig_draft_dwg_save_as | Input Parameters: | None | Allowed return values: | Standard for Pre-Trigger | Override functionality: | If kcs_util.trigger_override() is returned, no part of the standard input model function will not be performed. | Note: | This trigger fires before drawing will be save |
Open drawing pre-trigger | Event: | File / Open | Type: | Pre | File name: | trig_draft_dwg_open | Input Parameters: | None | Allowed return values: | Standard for Pre-Trigger | Override functionality: | If kcs_util.trigger_override() is returned, no part of the standard input model function will not be performed. | Note: | This trigger fires before user will be prompted to indicate name of the drawing to open |
2.读取用户的IP/计算机名,这个我目前还不清楚,不过我相信PYTHON书里应该有介绍. 3.加入或者读取图形信息(这样似乎要先打开然后在关闭图形,在次打开才好,因为这个命令是对于当前激活的图形才能读取,不过对于用户的认证方法我想不只这一种,应该可以避免这样的操作,我们可以通过别的方式来完成) document_reference_get () | The function returns a list of document references associated with the active drawing. | Input parameters | None | Returned value: | [0] | List | List of DocumentReference instances | Exceptions: | kcs_ArgumentError |
| Invalid arguments list | kcs_DrawingNotCurrent | Active drawing not set | Active drawing not set | kcs_GeneralError |
| List of result can't be created for some internal reason | | document_reference_add (docRef) | The function adds a document reference to the active drawing object. | Input parameters | DocRef | DocumentReference | Instance of Python DocumentReference class | Returned value: | None | Exceptions: | kcs_ArgumentError | Invalid arguments list | kcs_DrawingNotCurrent | Active drawing not set |
4.就是只读打开了 dwg_open(DwgName, <DwgType>, <OpenMode>, <DwgRevision>), <EnvelopeMode>) | The function opens an existing drawing and makes it the current one. It is possible to specify a Drawing Type, an Open Mode and a Drawing Revision Name. | Input Parameters: | DwgName | string | Name of drawing | <DwgType> | constant or string | Drawing type. It can be defined by using: - drawing types constants
(see chapter: "Drafting Constants") e.g. kcs_draft.kcsDWGTYPE_ASSEMBLY - logical databank names: e.g. "SB_PDB"
User defined drawing databanks can be specified also by: - constant
kcs_draft.kcsDWGTYPE_USER_DEFINED and database index e.g. kcs_draft.kcsDWGTYPE_USER_DEFINED - logical databank names: e.g. "SB_PDB002"
A list of all drawing databanks defined in the Tribon system can be obtained by using kcs_draft.dwg_type_list_get function. This parameter is optional. If not given, the standard drawing databank will be used. | <OpenMode> | constant | Drawing Open Mode. It can be one of the following constants: - kcs_draft.kcsOPENMODE_READONLY
- kcs_draft.kcsOPENMODE_READWRITE
This parameter is optional. If it is not given, the drawing will be opened in read-write mode. | <DwgRevision> | string | Drawing Revision Name. This parameter is valid only in case of TDM usage. If an empty string is given, the latest revision of the drawing will be opened. To open the Base Revision, use the kcs_draft.kcsBASE_REVISION constant. This parameter is optional. If not given the latest revision of drawing will be opened. | <EnvelopeMode> | constant | Drawing views envelope mode. It can be one of the following constants: - kcs_draft.kcsENVELOPE_NONE
- kcs_draft.kcsENVELOPE_INITIAL
- kcs_draft.kcsENVELOPE_PERMANENT
This parameter is optional. If it is not given, the drawing views will be opened without envelope. | Returned value: | None | Exceptions: | kcs_Error | General error | kcs_DbError | Databank error | kcs_DrawingCurrent | A drawing is already current | kcs_DrawingLocked | The drawing is locked in the databank. | kcs_DrawingNotFound | The drawing was not found in the databank. | kcs_NameOccupied | The name is used by system. | kcs_VolumeCurrent | The volume mode is active. | Kcs_RevisionNotFound | The revision not found for given drawing. | Kcs_CouldNotOpenDatabank | Not possible to open databank. Probably because of wrong user database name or id. |
仅为个人对于sheng519:的想法的 构思,没有实际操作过,有不当之处请见谅 顺便说句 如果成功了 请我们吃饭吧
|