Wednesday, October 22, 2014

AutoCAD Command Line API Specification

In this version of CI, an AutoCAD user is able to input AutoLISP commands that execute various CI functions
The API specifications are described below.



CIA – Command Line API Specification
AutoLISP Limitations
AutoLISP does not naturally support a “long” datatype, yet TRIRIGA uses long values for many items, such as record ID. In particular, numbers > 2147483647 will automatically be converted to a double in lisp (using exponential notation), so CAD Integrator will not receive the correct value from Acad. To work around this, always quote your record ID values, e.g.: "2147483648".
AutoLISP commands only work from the context of a single document. Therefore we cannot have an open drawing or close drawing command run from within a lisp function, and then execute the remainder of the function in the newly opened drawing. The open/close drawing must be run outside the lisp function, then the drawing must be activated, and then call the lisp function(s) to do operations on the open drawing.

Command Specifications
CiAttachDrawing

Attaches the current drawing to the server.
(CiAttachDrawing appDefName drawingUnitName recordID)
Arguments
appDefName A string that specifies the name of the application definition to attach the drawing with.
drawingUnitName A string that specifies the drawing unit to attach the drawing with.
recordID The record ID of the server object to attach to. Should be enclosed in quotes.
Return Values
If attach was successful, returns T. If the operation failed for any reason, returns nil.
Examples
Attaches the current drawing using the Facilities Management application definition, inches, and to the record on the server with id 12246754:
Command: (CiAttachDrawing "Facilities Management-Primary" "inches" "12246754")
T

CiAttachGross
Attaches the gross area of the current drawing to the largest boundary with the layer name specified.
(CiAttachGross layername [layername]...)
Arguments
layername A string that specifies the layer name to attach with. If more than one layer name is provided, the command will use the first layer in the arguments that exists in the drawing.
Return Values
If attach gross was successful, returns T. If the operation failed for any reason, returns nil.
Examples
Attach the current drawing's gross area to the largest boundary on the GrAE-24 layer:
Command: (CiAttachGross "GrAE-24")
T
Attach the current drawing's gross area to layer1 if it is on the drawing, layer2 if it is on the drawing, or layer3 if it is on the drawing, in that order. If no layers are present, the command fails and return nil.
Command: (CiAttachMGross "layer1" "layer2" "layer3")
T

 
CiAttachMGross
Attaches the measured gross area of the current drawing to the largest boundary with the layer name specified.
(CiAttachMGross layername [layername]... )
Arguments
layername A string that specifies the layer name to attach with. If more than one layer name is provided, the command will use the first layer in the list that exists in the drawing.
Return Values
If attach measured gross was successful, returns T. If the operation failed for any reason, returns nil.
Examples
Attach the current drawing's measured gross area to the largest boundary on the GRMV-19 layer:
(CiAttachMGross "GRMV-19")
T
Attach the current drawing's measured gross area to layer1 if it is on the drawing, layer2 if it is on the drawing, or layer3 if it is on the drawing, in that order. If no layers are present, the command fails and return nil.
Command: (CiAttachMGross "layer1" "layer2" "layer3")
T

 
CiLogin
Logs in to the server environment specified by name using the username and password.
(CiLogin environment username password)
Arguments
environment A string that specifies what environment to log in to. The name is case-sensitive.
username A string that specifies the username to log in with. The name is case-sensitive.
password A string that specifies the password to log in with. The name is case-sensitive.
Return Values
If login succeeds, returns T. If login failed for any reason, returns nil.
Examples
Log in to the environment with the name "Default" using the username "caduser", and password "password".
Command: (CiLogin "Default" "caduser" "password")
T

 
CiLogout
Logs out of the server.
(CiLogout)
Return Values
Returnes T if successful, nil otherwise.


CiPublish
Publishes the current drawing.
(CiPublish)
Return Values
Returnes T if successful, nil otherwise.

CiSync
Sync the current drawing to the server.
(CiSync)
Return Values
Returnes T if successful, nil otherwise.

 
CiUpload
Given a mapping name (e.g. the space mapping), scan the boundaries with the specified boundary layer name with text specified by the text layer name, and upload (create or update) the records specified by the mapping to the server. The list of mappable fields
(CiUpload childMappingName boundaryLayername textLayername listRequiredFieldSublists [listMappableFieldSublists])
Arguments
childMappingName A string that specifies which mapping to upload the boundaries for.
boundaryLayername A string that specifies the layer to look for boundaries to upload
textLayername A string that specifies the layer to look for the name of the boundaries.
listRequiredFieldSublists A list of sublists that specify the required field default values, and the layer to look for a value to upload. It will have the following form:
((fieldkey defaultvalue [layername]...)...)
Subarguments
fieldkey The unique identifier for a required field.
defaultvalue The value to upload by default
layername Optionally, the layer name can be used to override the default value with the value from the layer. If more than one layer is specified, the first layer on the list that is present on the drawing will be used.
The number of arguments for listRequiredFieldSublists depends on the number of actual required fields for the current drawing's application and the child mapping specified. The command CiQueryRequiredFields will return the field keys that must be specified in this parameter. Extra field sublists will be accepted, and any that do not match a field key will be ignored. Since all required fields must have a default value specified, this command will fail if this parameter does not have at least one fieldkey specified for each required field. If there are no required fields, then this parameter will be ignored. You can specify expecting no required fields with an empty list ().
listMappableFieldSublists A list of sublists that specify the mappable field and layer to upload values from. It will have the following form:
([(fieldkey layername [layername]...)]...)
Subarguments
fieldkey The unique identifier for a mappable field.
layername The layer name to look for a value to upload. If more than one layer is specified, the first layer on the list that is present on the drawing will be used.
Each mappable field upload is optional. The command CiQueryMappableFields will return the field keys that may be specified in this parameter. Extra field sublists will be accepted, and any that do not match a field key will be ignored.

 
Return Values
If upload succeeds, returns T. If upload failed, returns nil.
Examples
Let us assume the following is true:
Command: (CiQueryRequiredFields "Facilities Management-Primary" "triSpace Mapping")
("triGeneral_triCurrentSpaceClass_triNameTX")
Command: (CiQueryMappableFields "Facilities Management-Primary" "triSpace Mapping")
("triGeneral_triDetails_triMainFaxTX" "triGeneral_triGeneral_triDescriptionTX")
Also assume the current drawing is attached with the "Facilities Management-Primary" application definition.
The following command uploads all the "spaces" (as specified in the "triSpace Mapping") that are enclosed by boundaries on the "PL-23" layer, with the space name determined by the text on the "name" layer. This will set the the required "space class" field to "Office" if text on the "SC-44" layer is not in the boundary, or the value of the"SC-44" layer text field if it is. If there is text for the "faxLayer" in the boundary, the "Main Fax" field will be populated by the layer contents. If the layer "layer1" exists on the drawing, the "Description" field will be populated by that layer contents, and if not, the "faxLayer" will determine the contents of the "Description" field.
Command: (CiUpload "triSpace Mapping" "PL-23" "name" '(("triGeneral_triCurrentSpaceClass_triNameTX" "Office" "SC-44")) '(("triGeneral_triDetails_triMainFaxTX" "faxLayer") ("triGeneral_triGeneral_triDescriptionTX" "layer1" "faxLayer")))
T
Same command as above, but we do not want to populate the "Description" field at all.
Command: (CiUpload "triSpace Mapping" "PL-23" "name" '(("triGeneral_triCurrentSpaceClass_triNameTX" "Office" "SC-44")) '(("triGeneral_triDetails_triMainFaxTX" "faxLayer")))
T
Same command as above, but we do not want to populate any of the mappable fields:
Command: (CiUpload "triSpace Mapping" "PL-23" "name" '(("triGeneral_triCurrentSpaceClass_triNameTX" "Office" "SC-44")))
T
Suppose we have the following instead:
Command: (CiQueryRequiredFields "Facilities Management-Primary" "triSpace Mapping")
T
Then there are no required fields.
Command to upload with no required fields or mappable field updates:
Command: (CiUpload "triSpace Mapping" "PL-23" "name")
T
Same as above but with a mappable field specified. Here, since the 5th parameter is the mappable fields argument, we have to fill in the empty required field argument:
Command: (CiUpload "triSpace Mapping" "PL-23" "name" () '(("triGeneral_triDetails_triMainFaxTX" "faxLayer")))
T

 
Query Commands

Commands that return information, as opposed to executing an action, will be shown here.
 
CiQueryMappableFields
Returns the mappable field keys for a given application definition and mapping.
(CiQueryMappableFields applicationDefinition mapping)
Arguments
applicationDefinition A string that specifies the application definition.
mapping A string that specifies the mapping.
Return Values
The field keys for each mappable field on the mapping. If the keys are empty, returns T. If the command fails for any reason, returns nil.
Examples
Command to list the field keys for the mappable fields in the "Facilities Management-Primary" application definition and the "triSpace Mapping". In this example, the mappable fields for "triSpace Mapping" is the main fax field, and the description field. The results show the tab name, section name, and field name, which uniquely identifies those fields on the triSpace form.
Command: (CiQueryMappableFields "Facilities Management-Primary" "triSpace Mapping")
("triGeneral_triDetails_triMainFaxTX" "triGeneral_triGeneral_triDescriptionTX")

 
CiQueryRequiredFields
Returns the required field keys for a given application definition and mapping. Note that for CiUpload, all these fields must have a default value specified.
(CiQueryRequiredFields applicationDefinition mapping)
Arguments
applicationDefinition A string that specifies the application definition.
mapping A string that specifies the mapping.
Return Values
The field keys for each required field specified by the mapping's form. If the keys are empty, returns T. If the command fails for any reason, returns nil.
Examples
Command to list the field keys for the required fields in the "Facilities Management-Primary" application definition and the "triSpace Mapping". In this example, the required field for "triSpace Mapping" is the current use space class field. The results show the tab name, section name, and field name, which uniquely identifies the field on the triSpace form.
Command: (CiQueryRequiredFields "Facilities Management-Primary" "triSpace Mapping")
("triGeneral_triCurrentSpaceClass_triNameTX")

Taken from https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20TRIRIGA1/page/AutoCAD%20Command%20Line%20API%20Specification

IBM TRIRIGA CAD Integrator Tutorials

Check out the new video tutorials on YouTube about IBM TRIRIGA CI


http://www.youtube.com/playlist?list=PLiD3_RDV00Je4i5UEzoWrTJgz_GW2gbCZ

IBM TRIRIGA Performance Best Practices

Over the last few months I have seen an increase in performance related tickets that have come into the TRIRIGA call center.  The vast majority of those tickets were resolved by following all of the recommendations outlined in the Performance Best Practices Guide and the document can be found at:


With this entry I will discuss two of the most common items from that document the I have seen.

1. Workflow instance saving.

By Default, TRIRIGA ships with this value being set to 'Errors Only' in the TRIRIGAWEB.properties file and this is also the recommended setting for production environments.  This is a very important setting since enabling workflow instance saving can cause a tremendous amount of additional overhead from a performance perspective.  Additionally, the cleanup agent may run longer than expected or run into a normal workday if there is a significant amount of data that needs to be removed.  Keep in mind that this setting can be enabled and disabled from the TRIRIGA Admin Console without the need of a restart.

2. Production Mode

Production mode is also another way to improve performance and is also recommended to be enabled in production environments.  This setting enables data from the database to be cached in memory.

The Performance Best Practices Guide has more great information on these settings as well as additional recommendations that will provide a positive performance impact to most any environment. 

Taken from https://www.ibm.com/developerworks/community/blogs/8eeee156-f1f3-45ec-970c-53b17ccb452a/entry/tririga_performance_best_practices?lang=en

CAD Integrator Logging Locations

To elimate confusion about where to locate CI logging, I want to explain where to find the logs.
The CI logs are located on the local end users machine. Typically you will find the logs in the ProgramData directory (for ex: \\programdata\IBM\CAD Integrator\Log.) Here you will find not only the CI.log, but also the httpwire.log, performance.log, and the CI.out log as well. All these are important troubleshooting and debugging resources used in the event there is a problem with CI. If you do not know how to turn these logs on, you can find instructions here: CAD Logging
Its important to mention that although these logs capture valuable information, you can also capture information regarding CI in the server.log file on the application or platform server. For this you will navigate the admin console to Platform Logging. From there you can add a manual category for " com.tririga.ci " and apply this. What will happen is now the server will put debug logging information about CAD Integrator in the server.log file. You can then replicate the issue and retrieve the server.log file from the Error Logs selection in the admin console. Just make sure to pick up the log with no datestamp.

Taken from https://www.ibm.com/developerworks/community/blogs/8eeee156-f1f3-45ec-970c-53b17ccb452a/entry/cad_integrator_logging_locations?lang=en

BIRT Report Parameters - Using Hard Coded SQL Statements

Today I would like to talk about BIRT reports and, in particular, report parameters that are hard coded select statements in the report design file. The following will be especially important for those people running their application in SQL Server.
The latest release of TRIRIGA includes several security reports that contain hard coded SQL select statements. Unfortunately, the select statements apparently cause a problem for those clients using SQL Server. The report is supposed to display the list of security groups. It does this via a simple select statement that gets the group name from the t_group table and looks like this:
SELECT name1 FROM t_group WHERE name1 <> 'Admin Group';
If you take that SQL statement and run it in the Admin Console->Database Query Tool you will see the expected results. When run from the context of a BIRT report, however, SQL Server does not appear to handle the select statement properly and you end up with a parameter list with no values. To correct the problem, you need to uppercase the entire SQL statement with the exception of the value in quotes. So the altered SQL statement will appear as follows:
SELECT NAME1 FROM T_GROUP WHERE NAME1 <> 'Admin Group';
In general, SQL Server BIRT report writers, be aware that if you decide to hard code a select statement such as this to provide the values for a prompt and you do NOT see anything in the list box for parameter selection, check the select statement that you used and make sure you uppercase all of the select statement that references either a database object or are reserved SQL keywords. Obviously, in the case of text searches as the one noted here, the case must match the expected value in the database.
You may now be asking yourself, how do I go about changing that in our BIRT reports? It is relatively easy and the following are instructions on how to do this within the report designer tool. I am assuming the report writers are familiar with the report design lifecycle. These instructions were written with the report mentioned above, so you will need to generalize as appropriate.
1 - In the report designer, expand the Data Sets section to reveal the SecurityGroups and SecurityPermissions datasets.
2 - Expand the SecurityGroups dataset to reveal the NAME1 object.
3 - Click on the Advanced vertical tab in the Property Editor.
4 - Scroll down to find the Query property. It will look as if the Value is set to "SELECT name1".
5 - Click on the Value and you should see this SQL:

SELECT name1
FROM t_group
WHERE name1 <> 'Admin Group'

6 - Everything except 'Admin Group' should be in uppercase in order for SQL to process the query correctly in SQL Server environments.

Taken from https://www.ibm.com/developerworks/community/blogs/8eeee156-f1f3-45ec-970c-53b17ccb452a/entry/birt_report_parameters_using_hard_coded_sql_statements?lang=en

Tuesday, October 21, 2014

Missing AutoCAD or MicroStation exception installing the CAD Integrator

Question


When installing the CAD integrator (IC) you sometimes receive an error message to say AutoCAD or MicroStation are not installed even though you know they are installed.

Why?

A check list before calling up support for assistance.

Exception on install:

""A supported version of AutoCAD or MicroStation must be installed on your computer before installing IBM TRIRIGA CAD Integrator/Publisher. Please close this installer, install the required software, then reinstall IBM TRIRIGA CAD Integrator/Publisher.""

Cause


The error is generic and can have other causes besides AutoCAD not being installed.

Answer


Check the following.

1. Ensure AutoCAD is installed.
2. Run install.bat (ie Run as administrator).
So right mouse click on the InstallCI.exe and run as administrator.

3. Make sure you have applied the SP2 to AutoCAD 2013.

4. Confirm what OS you are using, win2008 will not work.
5. Make sure using Java supported in TRIRIGA Matrix has been installed
TRIRIGA Support Matrix:

6. Make sure using (64 bit) Java with 64 bit AutoCAD and vice versa for (32 bit) releases.
This is most common cause where the Java installed is not correct in terms of 32 or 64 bit..
So if installing 32 bit AutoCAD install 32 bit Java and the same for 64 bit installations use 64 bit Java.
------------------------------------------------------------------------------------------------------------------------
If this still fails to resolve the install exception then send this information to support.
------------------------------------------------------------------------------------------------------------------------

1. What version of AutoCAD are you using?

2. What version of TRIRIGA are you using both platform/application releases?

3. What database, application server and OS is TRIRIGA deployed to?

4. What is the OS of the AutoCAD client?
5. Provide the ciinstall.properties file.

Located: <installdir>\CI-12\ciinstall.properties

Example:
C:\Program Files\IBM\TRIRIGA\CI-12\ciinstall.properties

Taken from 
http://www-01.ibm.com/support/docview.wss?uid=swg21660344