LISP and AutoCAD commands
Chapter 9 API Programming guide of the Inventor Integra- Integra-tion in Productstream Professional
Introduction
Two programming interfaces are provided in Inventor-Integration. The functions of the CAI interface can be called from Productstream Professional. The Productstream Professional Add-In interface can be used in In-ventor.
CAI interface
The functions of the CAI interface are described in this section. These functions can be called using DBP pro-cedures, in Productstream Professional Jobserver and from the Productstream Professional-Shell.
They usually require Autodesk Inventor. However, some of the functions only require Inventor Apprentice.
Inventor Apprentice can be used to read information out of Inventor documents, and then to edit them to a limited extent. It is installed automatically with Inventor. Inventor Apprentice is also available free of charge in conjunction with the product Autodesk Inventor Design Tracking.
Calling the CAI functions
General syntax for calling the CAI functions::
CAI_CALL 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 application Inventor is aimdinv.CAI_Call. When using the class name directly, remember that some CAI functions require an application context (e.g. AIMDOpen to start Inventor).
For this reason, the procedure ApplCall is provided for Inventor. This ensures that an application context is always available.
Inventor-specific syntax for calling the CAI functions:
ApplCall <function name> [<Arg1> <Arg2> <Arg3>]
The absolute file name of an Inventor document is required as an argument for almost all of the functions, which means that the path, file name and the extension are given.
AIMDChangeReference
This function is for substituting an existing reference in an Inventor document with another one.
Arguments Arg1: <File>
The absolute file name of the Inventor document in which the reference is to be substituted.
Arg2: <Old Reference>=<New Reference>
<Old Reference>: The absolute file name of the existing reference.
<New Reference>: The absolute file name of the new reference.
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• The function is performed in Inventor Apprentice.
• Write permissions must be set for the document in Productstream Professional in order to perform the func-tion.
• When the reference has been successfully substituted, the document is saved and the structure is synchroni-zed.
CAI interface 47
AIMDDeferUpdate
This function is used to set the Inventor property DeferUpdate for Inventor drawings (IDWs). This is practical if a drawing is not to be updated as soon as it is opened.
Arguments Arg1: <File>
The absolute file name of the Inventor derived drawing in which this property is to be set.
Arg2: 0 | 1
• The function is performed in Inventor Apprentice.
AIMDGetProp
This function is used to read out the value of a specified Inventor property, and to set this value in a specified Productstream Professional field.
Arguments Arg1: <File>
The absolute file name of the Inventor document from which the property is to be read out.
Arg2: <Productstream Professional field>=<Inventor property>|
ENVIRONMENT.<Environment variable>=<Inventor-property>
<Productstream Professional field>: Name of the Productstream Professional field.
<Environment variable>: Name of the environment variable
<Inventor property> Designation of the Inventor property..
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• The function is performed in Inventor Apprentice.
• The same syntax is used to specify the Productstream Professional field and the Inventor property as is used for the definitions in the INI files aimdprop_xxx.ini.
Example
ApplCall AIMDGetProp "#(DOCNAME0" "SHORT_DESC =<Design Tracking Properties.Description>"
AIMDGetProperties
This function is used to read out the Inventor properties and to hand over the values to the Productstream Professional fields as defined in the INI files aimdprop_xxx.ini .
Arguments Arg1: <File>
The absolute file name of the Inventor document from which the properties are to be read out Arg2: [<Section name>]
<Section Name>: Optional. The section name in the INI file. If this argument is empty, the section name Pro-pertiesToCompass is used.
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• The function is performed in Inventor Apprentice.
CAI interface 48
AIMDInsert
This function is used to insert an Inventor document into the active Inventor application document.
Arguments Arg1: <File>
The absolute file name of the Inventor document to be inserted.
Return values
None. Error messages are displayed on the screen where applicable.
Remarks
• This function requires an instance of Autodesk Inventor.
• User input is expected when this function is performed.
AIMDIsInstalled
This function is used to check whether Inventor Apprentice (or a specified version of it) has been installed.
Arguments
Arg1: [<Version Number>]
Optional. The Inventor version number.
Return values
0: Apprentice is not installed..
1: Inventor Apprentice is installed.
AIMDNew
This function is used to create an Inventor document.
Arguments Arg1: <File>
The absolute file name of the new Inventor document.
Return values
None. Error messages are displayed on the screen where applicable.
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• User input is expected when this function is performed.
• When the new document has been created, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in the configuration).
• In the case of new component documents, a sketch is generated according to the Inventor settings and then activated if there are none in the template.
AIMDOpen
This function is used to open an Inventor document.
Arguments Arg1: <File>
The absolute file name of the Inventor document to be opened.
Return values None
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• When the new document has been opened, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in the configuration).
CAI interface 49
AIMDPackAndGo
This function is used to launch the Inventor Pack and Go tools.
Arguments Arg1: <File>
The absolute file name of the Inventor document for which the Pack and Go tool is to be launched.
Return values None
Remarks
• The function is performed in Inventor Apprentice.
AIMDPrint
This function is used to print an Inventor document.
Arguments Arg1: <File>
The absolute file name of the Inventor document which is to be printed.
Arg2: <Configuration File>
The absolute file name of the configuration file. Refer to the Inventor Integration manual or aimdprint.ini, for example, for details about the syntax used in the configuration file.
Return values None
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• When the new document has been opened, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in the configuration).
• When the document has been printed, it is closed without being saved.
AIMDPublishDWF
Function for creating the DWF secondary file for an Inventor document.
Arguments Arg1: <File>
The absolute file name of the Inventor document for which a DWF secondary file is to be created.
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• When the new document is opened, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in 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 Inventor document is closed after the DWF file has been created.
CAI interface 50
AIMDQuit
This function is used to shut down Inventor.
Arguments None
Return values None
Remarks
• Autodesk Inventor is only shut down when no more documents are open.
AIMDSaveAs
This function is used to save an Inventor document in a different format.
Arguments Arg1: <File>
The absolute file name of the Inventor document which is to be saved in a different format.
Arg2: <New File Name> | <Extension>
<New File Name>: The absolute file name (incl. the extension) of the new file.
<Extension>: Extension (file type: e.g. DWF) of the new file. In this case, the same file name is used. This means that the new file is located next to the original file.
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• When the new document has been opened, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in the configuration).
• When the document has been saved, it is closed without the original document being saved.
AIMDSaveAsAttachment
This function is used to save an Inventor document in a different format and to automatically generate a Productstream Professional secondary document for the new file.
Arguments Arg1: <File>
The absolute file name of the Inventor document which is to be saved in a different format.
Arg2: <Extension>
Extension (file type: e.g. DWF) of the new file.
Arg3: 0 | 1
Optional. 0 if no value is given.
0: Generate a secondary document without the new record dialog window 1: Generate a secondary document with the new record dialog window Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• When the new document has been opened, the properties are updated with the defined values from Productstream Professional (dependent upon the settings in the configuration).
• When the document has been saved, it is closed without the original document being saved.
CAI interface 51
AIMDSyncStruct
This function is used to manually perform the structure synchronization.
Arguments Arg1: <File>
The absolute file name of the Inventor document for which a structure synchronization is to be performed.
Return values
None. Messages or errors are written to the log file invlog.err.
Remarks
• The function is performed in Inventor Apprentice.
AIMDUpdateProps
This function is used to update the properties of an Inventor document using the defined values from Productstream Professional. The Inventor properties are assigned to the Productstream Professional fields in the document-specific INI files aimdprop_xxx.ini. They are updated using Inventor.
Arguments Arg1: <File>
The absolute file name of the Inventor document for which the properties are to be updated.
Arg2: 1 | 2
1: Only the properties of the document are updated.
2: The properties of all the referenced documents are updated as well (recursively).
Return values None
Remarks
• This function requires an instance of Autodesk Inventor. Autodesk Inventor is launched if necessary.
• Write permissions must be set for the document in Productstream Professional in order to perform the func-tion.
• The document is saved after it has been updated (only if it has been edited) and then closed.
AIMDUpdateProps2
This function is used to update the properties of an Inventor document using the defined values from Productstream Professional. The Inventor properties are assigned to the Productstream Professional fields in the document-specific INI files aimdprop_xxx.ini (refer to the Inventor Integration manual). They are up-dated using Inventor Apprentice.
Arguments Arg1: <File>
The absolute file name of the Inventor document for which the properties are to be updated.
Arg2: 1 | 2
1: Only the properties of the document are updated.
2: The properties of all referenced documents are updated as well (recursively).
Return values None
Remarks
• The function is performed in Inventor Apprentice.
• Write permissions must be set for the document in Productstream Professional in order to perform the func-tion.
• The document is saved if it has been modified.
• Only the properties are updated, which means that changes in drawings are not applied accordingly in the title field. In this case, it is necessary to use the function AIMDUpdateProps.
Productstream Professional Add-In interface 52
Productstream Professional Add-In interface
The Add-In interface is described in this section. This is an ActiveX interface which can be run using a VBA macro, for example.