CimClassInstance (object)

Contains the properties of an CIMPLICITY Class Object.
Description: The CimClassInstance object contains the information for a CIMPLICITY class.

Examples

Dim project as CimProject
[...]
Set newClass = CreateObject("CimClassInstance")
newClass.ID = "NewClass"
' create some attributes
Set attributeList = newClass.Attributes
Set newBoolAttribute = attributeList.Add("BOOL_ATTRIBUTE")
newBoolAttribute.Type = cimAttributeBoolean
newBoolAttribute.InstantiationType = cimInstantionOptional
newBoolAttribute.Prompt = "Prompt"
newBoolAttribute.HelpString = "Help"
newBoolAttribute.Order = 1
newBoolAttribute.PropertyPage = "page 1"

Set newStringAttribute = attributeList.Add("STRING_ATTRIBUTE")
newStringAttribute.Type = cimAttributeString
newStringAttribute.InstantiationType = cimInstantionRequired
newStringAttribute.Prompt = "Prompt"
newStringAttribute.HelpString = "Help"
newStringAttribute.Order = 2
newStringAttribute.PropertyPage = "page 1"

Set newStringAttribute = attributeList.Add("INT_ATTRIBUTE")
newStringAttribute.Type = cimAttributeAnalog
newStringAttribute.InstantiationType = cimInstantionRequired
newStringAttribute.Prompt = "Prompt"
newStringAttribute.HelpString = "Help"
newStringAttribute.Order = 2
newStringAttribute.PropertyPage = "page 1"

' create some actions
Set actionList = newClass.Actions
Set newPointAction = actionList.Add("POINT_ACTION")
newPointAction.Type = cimSetPoint
newPointAction.PointID = "{$OBJECT.VIRTUAL_POINT"}
newPointAction.PointValue = "4325"

Set newScriptAction = actionList.Add("SCRIPT_ACTION")
newScriptAction.Type = cimRunScript
newScriptAction.ScriptName = "some-script.bcl"

' create some events
Set eventList = newClass.Events
Set newPointEvent = eventList.Add("POINT_EVENT")
newPointEvent.Type = cimPointEquals
newPointEvent.PointID = "{$OBJECT.VIRTUAL_POINT"}
newPointEvent.PointValue = "4325"
newPointEvent.Enabled = True
newPointEvent.AlarmOnOverFlow = True
newPointEvent.LogErrorOnOverFlow = False
newPointEvent.EventExecution = cimSequentialExecution

' create some actions for the point event
Set eventActionList = newPointEvent.Actions
Set pointEventAction = eventActionList.Add("POINT_ACTION")
pointEventAction.ActionOrder = 0

Set newAlarmEvent = eventList.Add("ALARM_EVENT")
newAlarmEvent.Type = cimAlarmGenerated
newAlarmEvent.AlarmID = "{$OBJECT.VIRTUAL_POINT"}
newAlarmEvent.ResourceID = "$SYSTEM"
newAlarmEvent.ClassID = "HIGH"

' create some actions for the alarm event
Set eventActionList = newAlarmEvent.Actions
Set scriptEventAction = eventActionList.Add("POINT_ACTION")
scriptEventAction.ActionOrder = 0

Set scriptEventAction = eventActionList.Add("SCRIPT_ACTION")
scriptEventAction.ActionOrder = 1

' create a script
Set scriptList = newClass.Scripts
Set newScript = scriptList.Add("NEW_SCRIPT")
newScript.Text = "Sub Main() MsgBox ""hi"" EndSub"

Set newScriptTwo = scriptList.Add("NEW_SCRIPT_TWO")
newScriptTwo.Text = "Sub Main() MsgBox ""hi two"" EndSub"

' create some data items
Set dataItemList = newClass.DataItems
Set dataItem = dataItemList.Add("VIRTUAL_POINT", "INT")
dataItem.ResourceID = "$SYSTEM"
dataItem.Type = cimGlobal
dataItem.DerivedPoint.InitState = cimInitialized
dataItem.DerivedPoint.InitValue = "1"
dataItem.PointAlarm.AlarmConfigured = False

Set expressionList = dataItem.Expressions
Set expression = expressionList.Add("$LEVEL")
expression.FirstOperandString = "INT_ATTRIBUTE"
expression.Operator = cimExpressionPlus
expression.SecondOperandNum = 2.2

Set dataItem1 = dataItemList.Add("DEVICE_POINT", "INT")
dataItem1.ResourceID = "$SYSTEM"
dataItem1.Type = cimDevice
dataItem1.DevicePoint.DeviceId = "C_9030"
dataItem1.DevicePoint.Address = "%R1000"
dataItem1.PointAlarm.AlarmConfigured = False

newClass.Attributes.Delete "STRING_ATTRIBUTE"
newClass.Actions.Delete "SCRIPT_ACTION"
newClass.Events.Delete "ALARM_EVENT"
newClass.Scripts.Delete "NEW_SCRIPT_TWO"
newClass.DataItems.Delete "DEVICE_POINT"

project.Classes.Save newClass, FALSE
Properties: Actions , Attributes , DataItems , DefaultGraphic , Description , Events , GraphicsFile , HelpFile , ID , Scripts
Methods: AttributeDataType , Protect