'This VBScript code is used to control the Imagineer object 'in the scripting example discussed in the file IMAGINE.MCD. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'These are supposed to be pre-defined Imagineer constants, but they are 'only defined on the Application level. What we are scripting here 'is an Imagineer Document object (not Aplication object). 'So we'll define these constants here globally (on the script level) 'in a manner consistent with how they are defined in Imagineer Application. ' Const igDimTypeLinear = 1 'Dimension of Type Linear, measures the linear value. Const igDimTypeAngular = 3 'Dimension of Type Angular, measures the angle value. Sub imObjEvent_Start() REM Nothing is triggered by the Start event. End Sub Sub imObjEvent_Exec(Inputs,Outputs) 'Set up the Imagineer Document and Sheet objects 'and the Dimension collection object Set docObj = imObj Set sheetObj = docObj.ActiveSheet Set dimsObj = sheetObj.Dimensions 'Get the length and angle inputs from Mathcad. LineLength = Inputs(0).Value(0,0) WedgeAngle = Inputs(1).Value(0,0) 'Examine each object in the dimsObj collection 'and assign LineLength to all linear dimensions 'and WedgeAngle to all angular dimensions. ' For Each d In dimsObj If d.DimensionType = igDimTypeLinear Then d.Value = LineLength ElseIf d.DimensionType = igDimTypeAngular Then d.Value = WedgeAngle End If Next 'NOTE: If we know the precise indices of the elements 'of the dimsObj collection that are of interest to us, 'we can use these indices to set the values of these dimensions 'directly, without having to loop through all elements. 'In this example, we could simply write: ' 'dimsObj(1).Value = LineLength 'dimsObj(2).Value = WedgeAngle End Sub Sub imObjEvent_Stop() REM Nothing is triggered by the Stop event. End Sub