I will be doing this for a support, to do this for topworks repeat all of the same steps except start with topworks.ini instead of support.ini. In this post I intend to add a new function and section under the Cable Tray supports tab. To see the help file for this open support/Topwork browser and click on the “?”.
First open supports.ini in the folder “Network Drive”\Bentley\Plant V8i\Modules, the definitions for the support browser can only be place on the network drive,not the project drive. This will open a text document with multiple sections that look like classes. for example my [BASE] section looks like this:
[vb]
;//Base
[Base]
Description = Base Supports
Anchors and Guides = anchors.ini Hangers =
hangers.ini Shoes =
shoes.ini
Base =basesupp.ini
Misc. Supports = miscsupp.ini
User Supports = Supports.ini
[/vb]
The [base] indicates that it is part of the base components so the system will search for the .ini files in the base folder. For cable tray the indicator is [AT_CABLET] so the system knows to search in the cableT folder (this is defined somewhere but I’m not sure where). All of the ini files must be in the correct folder for there functions to appear in the window.
Note the supports.ini file associated with user supports is not the same as the modules\supports.ini file because it is in the base folder
To add your section and functions place “desired section name = desired functions file.ini” under the overall heading. For example mine would be under [AT_CABLET] as MyFunction = Test.ini
The next step is to create the Test.ini file, I recomend copying one of the [base] ini files to use as a template then fill in the required fields. Only 3 fields are required:
- the identifier in []
- Class name = AT_CLASS_NAME (this is the name of the class that will be called when the function runs)
- Description = Function name (this is the function name that will appear in the supports/Topworks browser)
After this open the Class.ini file in your local project and create a class that has the same name as the one from the last step the class should look something like this
[vb]
[AT_SUPPORT_Test]
PARENT_CLASS =BASE_SHOES_SUPPORTS
METHOD_KEY =AT_SUPPORT_Test
PICT_NAME =WEARPAD
CLASS_DESCRIPTION =Test Support Class
ISOLENGTH_KEY =AT_SUPPORT_HANGER
SHOP_FLD =1
SPEC_KEY =TestSpec
[/vb]
Im using the wear pad class as my base, so I left some of the keys as they were default, we need to change the Method_key, Spec_key and class description so that it runs our function The speckey is changed in your project directory inside of the folder defined earlier (mine is the CableT folder).The speckey will have the same formate as a regular speckey and should look something like this
[vb]
[TestSpec]
SPEC_TABLE = PIPE WHERE_CLAUSE = GTYPE = ‘SUPT’ AND STYPE = ‘WEAR’ AND MAIN_SIZE = ‘6’
SPECKEY_SCRIPT = at_SpecKey_valves
DISPLAY_FIELDS =COMM_ID;TAG;MAIN_SIZE;COMP_LEN;LONG_DESCR;TAGNUMBER
[/vb]
For the method key copy the method key of the class your modelling your function on
[vb]
[AT_SUPPORT_Test] DRAW_METHOD = %APP_DIR%\Draw\SupTest ; at_CableTrayConnector
INPUT_METHOD = Common\SupTest ; at_Support_inputWearPad
PORT_METHOD = %APP_DIR%\Util\Ports ; at_Support_definePorts
ORIENT_METHOD = %APP_DIR%\Util\Orient ; at_HangerSupport_determineOrientation
PXF_IN_METHOD = XCHG\PXF\SuppIn ; PXF_IN_WEARPAD
PXF_OUT_METHOD = XCHG\PXF\SuppOut ; PXF_OUT_WEARPAD COORDS_METHOD = %APP_DIR%\Util\Coords ; at_HangerSupport_defineCoords
JSM_OUT_METHOD = XCHG\JSM\SupWearPad ; JSM_OUT_SupWearPad
EDIT_METHOD = Common\SupTest ; at_Support_editWearPad
ATTACHMENT_LOC_METHOD = %APP_DIR%\Util\attloc ; at_SaddleSupport_determineAttachmentLocation
[/vb]
I changed the name of the draw file and created a function to draw my desired support. I also changed the edit and input methods (they use the same file because they call different versions of the same dialogue) by altering what the dialogue asked for. When changing these file alter the ones on your project drive.
Note: the ATTACHMENT_LOC_METHOD applies only when something is being attached to the OBJECT THAT HAS THE METHOD. Ex attaching support A to Pipe B, will use Pipe B’s ATTACHMENT_LOC_METHOD and not support A’s ATTACHMENT_LOC_METHOD
Due to the note above I had to change the attachment method of each type of cable tray I want to attach to so that my support appears in the correct place. I changed my local project file by adding an if statement to each of the affected function so that it called a separate attachment function if they object was CableT and let the functions run normally if it wasn’t.
Note: When creating a support make sure to apply it to each type of object that it will be attached to. for example I had to try my support on all forms of cable tray such as straights, bends, tees and so forth