• No results found

Calling the CAI functions

In document PSProfDeveloperManualEnglish (Page 54-58)

General syntax for calling the CAI functions

CAI_CALL <CAI class name> <function name> [<Arg1> <Arg2> <Arg3>]

The class name can be established using #(Appl:CAI_Name). However, an application context is required to do so. This is not the case when using Productstream Professional Jobserver or the Productstream Professional shell. The class name of the AutoCAD-based application is AIMDAcad[version].CAI_Call, where [version]

stand for the CAD version (e.g. 16, 17 or 17x for 64Bit). When using the class name directly, remember that some CAI functions in turn require an application context (e.g. AIMDOpen to launch AutoCAD).

Absolute file name:

The absolute file name of an AutoCAD document is required as an argument for some of the functions, which means that the path, file name and the extension must be given.

CAI interface 41

AIMDChangeAimkey

Brief description

Replaces the existing AIMKEY of a title field block in the currently open drawing with another AIMKEY. This function searches the entire drawing (model area and layouts) for title field blocks with the specified AIMKEY, replaces it with the new AIMKEY and then updates the title field.

Title fields that are managed by Productstream Professional usually have one AIMKEY. This refers to a local drawing (DLA) in Productstream Professional, and the title field attributes are filled with the corresponding data for this entry. If the AIMKEY is empty, the data from the document record is used.

Arguments

Arg1: <existing AIMKEY>

AIMKEY for a title field block that is to be replaced. Must always be given. Can also have the value "*" (see Remarks).

Arg2: <new AIMKEY>

New AIMKEY for the title field block. Can also be empty (see Remarks).

Return values

None. Messages or errors are written to the log file ac16log.err.

Remarks

• Before this function can be run, it is necessary to launch an AutoCAD-based application and open a docu-ment using Productstream Professional.

• If "*" is given for the existing AIMKEY, all the title field blocks in the drawing that are being managed by Productstream Professional are given the new AIMKEY.

• If the new AIMKEY is empty, the link with the record in Productstream Professional is "deleted" and the title field is filled with the data for the document record.

• The function is run automatically in Productstream Professional after the function "Copy engineering do-cument" as soon as the copied document is opened for the first time. This ensures that the title fields in the copied drawing are linked with the copied local drawings (DLA).

Note

The AIMKEY for a title field block can be checked using the AutoCAD command AIMDGetTitleInfo.i !

AIMDNew

Brief description

Function for creating an AutoCAD document.

Arguments Arg1: <File>

The absolute file name of the new AutoCAD document.

Return values

None. Error messages are displayed on the screen where applicable. Messages or errors are written to the log file ac16log.err.

Remarks

• The corresponding AutoCAD application is launched if necessary (AutoCAD, Mechanical or MDT depen-ding upon the configuration).

• User input is expected when the function is run (e.g. selection of a template, depending upon the configu-ration).

• In the case of MDT documents, component or assembly files are created according to the document type in Productstream Professional.

CAI interface 42

AIMDOpen

Brief description

Function for opening an AutoCAD document.

Arguments Arg1: <File>

The absolute file name of the AutoCAD document to be opened.

Return values

None. Messages or errors are written to the log file ac16log.err.

Remarks

• The corresponding AutoCAD application is launched if necessary (AutoCAD, Mechanical or MDT depen-ding upon the configuration).

• If the AutoCAD document is already open, it is just activated.

• If necessary the AIMKEYs for the title field blocks are substituted (after the function Copy engineering do-cument). See AIMDChangeAimkey.

• If the document is a local drawing (DLA), the corresponding title field is displayed after it has been opened.

AIMDOpenReadOnly

Brief description

Function for opening an AutoCAD document in write-protected mode.

Arguments Arg1: <File>

The absolute file name of the AutoCAD document to be opened.

Return values

None. Messages or errors are written to the log file ac16log.err.

Remarks

• See AIMDOpen

AIMDPublishDWF

Function for creating the DWF secondary file for an AutoCAD document.

Arguments Arg1: <File>

The absolute file name of the AutoCAD document for which a DWF secondary file is to be created.

Return values

No direct return values. The Productstream Professional environment variable ARXErrorCode is filled with the following values:

0: No errors creating the DWF file.

1: General error creating the DWF file Remarks

• The corresponding AutoCAD application is launched if necessary (AutoCAD, Mechanical or MDT depen-ding upon the configuration).

• The currently configured DWF options for creating the DWF file.

• The name and path of the DWF file to be created is determined by #(ContainerAutoDWF).

• The AutoCAD document is closed after the DWF file has been created.

CAI interface 43

AIMDQuit

Brief description

Function for closing an AutoCAD application (AutoCAD, Mechanical or MDT, determined by the applica-tion context).

Arguments None

Return values

None. Messages or errors are written to the log file ac16log.err..

Remarks

The AutoCAD application is only shut down when no more documents are open.

AIMDRestore

Brief description

Switches the focus to the AutoCAD application (AutoCAD, Mechanical or MDT, determined by the appli-cation context).

Arguments None

Return values

None. Messages or errors are written to the log file ac16log.err.

AIMDUpdateTitleBlocks

Brief description

Function for updating the title block fields of an AutoCAD document using the defined values from Productstream Professional. The attributes are assigned to the Productstream Professional fields in the INI file amdtitle.ini (refer to the AutoCAD Integration manual).

Arguments Arg1: <File>

The absolute file name of the AutoCAD document in which the title block fields are to be updated.

Return values

No direct return values. The Productstream Professional environment variable ARXErrorCode is filled with the following values:

0: No errors updating the title block fields.

1: General error updating the title block fields.

2: No available title block fields managed by Productstream Professional.

3: File amdtitle.ini does not hold any definitions for a title block field Messages or errors are also written to the log file ac16log.err.

Remarks

• The corresponding AutoCAD application is launched if necessary (AutoCAD, Mechanical or MDT depen-ding upon the configuration).

• Write permission must be set for the document in order to run the function.

• The document is saved and closed after it has been updated.

In document PSProfDeveloperManualEnglish (Page 54-58)