You are on page 1of 5

Overview

This set of example Rules illustrates how the


RuleChecker processes the Rules and what kind of
things you can do with such Rules.

This example Ruleset has three rules in this


AssignModule project, two Module Rules (Volume /
Part Modification Handlers), and a WBS Handler

Preparation (Bulkload) for the


Rules to work
The above Rules need the files in the Bulkload
directory to be bulkloaded – To begin with we Use the Files in FirstSession folder. They add new
properties which the Rules will be using / setting and driving some business logic in the Rules.

ModuleSchemaChanges.xls  defines the new interface (IUConstModule) and adds it to list of


implementing classes (Parts and Area objects).

ModuleSpaces.xls  defines new Area partclass called “Modules” with a new “Area” part to use for
creating such Modules in Smart 3D modeling environment.

DesignAreaCodeLists.xls  the Codelist definition and values for DesignArea codelist (used for
cm_DesignArea attribute)

Rules_Catalog.xls  adds these Rules to the Catalog.

Explanation of the Rules


Volume Modification Handler  CMAssignModule,CMAssignModule.AssignModuleByVolume
Tracks new or modified AreaSpace kind of objects (space management objects) in the Ruleset’s
Discrimination filter. Sets properties [DesignArea, SubArea] from such AreaSpace to Piping & Equipment
Parts within that AreaSpace, and sets the ModuleNo property if not overridden by user.

Part Modification Handler  CMAssignModule,CMAssignModule.AssignModuleToObject


Tracks new or modified Parts. Finds AreaSpace object within which they lie. Sets properties [DesignArea,
SubArea] from such AreaSpace to Piping & Equipment Parts within that AreaSpace, and sets the
ModuleNo property if not overridden by user. Clears these properties if objects are out of such area.

WBS Handler  CMAssignModule,CMAssignModule.AssignObjectToWBS


Manages WBS Assignment - Creates WBS items based on the properties assigned If not existing already.
Assigns parts to WBS based on properties assigned. Removes Parts from WBS if properties were cleared
by above rules. This rule expects WBSParents of certain type [Design Area, Other] created for each
DesignArea. This rule creates the WBSItems below the specified DesignArea.
Rules in Action
We will learn how Rules process business objects based on modules in this section.

1) Open a session file to the active plant. Make sure your filter definition brings in WBSItems into the
workspace. (Use below steps to do this)
a. define a filter with WBSItem selected in the ObjectType – lets name this filter as ‘WBSItems’
b. define a filter of your choice which brings in regular 3D objects & Areas (NamedSpace)
representing modules – lets name this filter as ‘Objects’
c. create a Compound filter with its definition as “Objects OR WBSItems” and name it the same.
d. use the compound filter to define your workspace.

2) Create some modules (Area objects) in “Space” tab. The


parent folder of these modules must be selected as part of
your RuleSetFilter’s definition on the NameSpace tab.

3) Specify the module properties on these modules


i.e. the three user defined properties called
“Design Area”, “Sub Area”, “Module No” and
“Override Module”.

4) Create the parent WBSItem for each Design Area


value used – i.e. 10, 20, 30 … 90.
[Type=DesignArea, Purpose=Other, Exclusive=true]

5) Start the Rule Checker Service using the Configure


RuleChecker Utility.

6) RuleChecker service detects newly


created/modified Business Objects and invokes the
configured Rules. The Rules transfer properties
from Module to Business Objects if Business
Object lies inside module based on criteria defined
in Rule.

7) Go through logic used in Rule


“AssignModuleToObj.cs” for processing Business
Objects. Open “AssignModule.sln” in “FirstSession”
folder.

8) RuleChecker service creates log file (.csv) in the configured LogsPath folder. This log file contains
detailed information from the Service & Rule(s). Open property page for any of the processed object
and you will see that “Design Area”, “Module No” attribute information has been transferred from
Module to Business Object.
9) Refreshing workspace after the service has run for some time will show up the corresponding
WBSItems in WBS tab. Note that Rules have created new WBS items under Design Area WBS “20” &
“30”.

10) Moving the items into a new volume, or moving the volume itself etc., will trigger the appropriate
rule which automatically updates the properties.

Adding new Rule Managed attribute & Modifying Rule Logic


In the further enhancement of this Rule, a new attribute (cm_SubSubArea) is added to the same
interface by bulkloading the SecondSession\ModuleSchemaChanges.xls. The related code modifications
to enhance the Rule logic to set this attribute are also explained …

1) Close S3D session if it is open and stop RuleChecker service using Configuration utility.

2) Bulkload “ModuleSchemaChanges.xls” located in SecondSession using Append mode as shown


below. This process will add new user defined attribute called “SubSubArea” to all required
Business Objects. *Ensure “Update Object Type Hierarchy and Catalog Views” option is checked+

3) After bulkload process is complete, invoke the “Synchronize Model with Catalog” command in
project Management to just regenerate views in Model DB *uncheck “Synchronize Model with
Catalog” option+ – Then go on to Regenerate Reports DB.

4) Open S3D session and switch to “Space Management” Task. Select Modules of your choice one
at a time and set values for “SubSubArea” attribute. Save session and Close S3D.

5) Open “AssignModule.sln” in “C:\Training\Rule\Code\FirstSession” folder using Visual Studio


2008 and we will be editing “AssignModuleToObj.cs”.

6) Uncomment following code in “AssignModuleBase” class by removing “//” in the beginning.


// public virtual string sSubSubArea
// {
// get
// {
// return "cm_SubSubArea";
// }
// }
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

In TransferVolumeAttributes Method

PropertyValueString oVolumeSubArea =
PropertyValueString)oBOArea.GetPropertyValue(sModuleInterface, sSubArea);
// PropertyValueString oVolumeSubSubArea =
(PropertyValueString)oBOArea.GetPropertyValue(sModuleInterface, sSubSubArea);
PropertyValueString oVolumeModuleNo =
(PropertyValueString)oBOArea.GetPropertyValue(sModuleInterface,sModuleNo);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In TransferVolumeAttributes Method

oBO.SetPropertyValue(oVolumeSubArea.PropValue, sModuleInterface, sSubArea);


// oBO.SetPropertyValue(oVolumeSubSubArea.PropValue, sModuleInterface,
sSubSubArea);
oBO.SetPropertyValue(oVolumeModuleNo.PropValue, sModuleInterface, sModuleNo);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

In RemoveVolumeAttributesMethod

oBO.SetPropertyValue("", sModuleInterface, sSubArea);


// oBO.SetPropertyValue("", sModuleInterface, sSubSubArea);
oBO.SetPropertyValue("", sModuleInterface, sModuleNo);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

7) Save solution and Build using “BuildRebuild Solution”. This will update “CMAssignModule.dll”
for the active configuration – Updated DLL will be in “bin\Release” or bin\Debug accordingly.

8) Copy (overwrite) the new DLL to the folder specified in your configuration (RulesPath).

9) Since we added a new attribute and modified the rule, we need to ensure that processing must
restarted from beginning. Use the Configuration utility to do the same. This will force
RuleCheker service to start processing the Plant from beginning.

10) Wait till service processes entire plant. Open S3D session and refresh workspace. Observe that
“SubSubArea” attribute is also transferred from Modules to Business Objects inside Module.
Splitting Piping at Module boundary
When Rule processes straight pipe crossing several Module boundaries, it assigns pipe to Module based
on center of pipe. Such pipes need to be
split at Module boundary. This can be
achieved by using “Split Route” custom
command.

1) Switch to Piping task and switch


selection model to “Overlapping
Fence”. Drag fence over Module
boundary and select pipe features at
Module boundary as shown below.

2) Start “Split Route” Custom Command


using Tools->Custom Command
menu. Click on “Select Splitting
Volume” button on ribbon bar as
shown here and select “20-NS-001”
Module.

3) Click “Split Pipe” button on ribbon bar. Command will


process all straight piping crossing Module boundary
from selected piping and split pipe at Module
boundary by creating weld at Module boundary.

4) This action will create new pipe as well as modify


other piping which RuleChecker service will detect
and invoke the configured rules as appropriate, which
process these pipes for determining correct module.

You might also like