home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "13_6 Calculator"
- ClientHeight = 6435
- ClientLeft = 1140
- ClientTop = 1425
- ClientWidth = 7035
- Height = 6810
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 6435
- ScaleWidth = 7035
- Top = 1110
- Width = 7155
- Begin VB.Label Label1
- Caption = $"13_6Calculator.frx":0000
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 1575
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 6735
- End
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 4455
- Left = 120
- TabIndex = 0
- Top = 1920
- Width = 6735
- _Version = 131072
- _ExtentX = 11880
- _ExtentY = 7858
- _StockProps = 0
- decorationOn = 0 'False
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Form_Initialize()
- Dim root As SoSeparator
- Set root = New SoSeparator
- 'Add a camera and light
- Dim myCamera As SoPerspectiveCamera
- Set myCamera = V3Space1.getCurrentCamera
- Call myCamera.position.setValue(-0.5, -1#, 19#)
- Call myCamera.nearDistance.setValue(10#)
- Call myCamera.farDistance.setValue(26#)
- 'Call root.addChild(myCamera)
- Dim myLight As SoDirectionalLight
- Set myLight = New SoDirectionalLight
- Call root.addChild(myLight)
- 'Rotate scene slightly to get better view
- Dim globalRotXYZ As SoRotationXYZ
- Set globalRotXYZ = New SoRotationXYZ
- Call globalRotXYZ.axis.setValue(SoRotationXYZ_X)
- Call globalRotXYZ.angle.setValue(M_PI / 7)
- Call root.addChild(globalRotXYZ)
- 'Read the background path from a file and add to the group
- Dim myInput As SoInput
- Set myInput = New SoInput
- Dim flowerPath As Object
- Set flowerPath = myInput.readAllUrl(V3Space1.getRegistryDataPath() + "\examples\data\flowerPath.iv", V3Space1.GetIDispatch())
- Call root.addChild(flowerPath)
- '/////////////////////////////////////////////////////////////
- '// CODE FOR The Inventor Mentor STARTS HERE
- '// Flower group
- Dim flowerGroup As SoSeparator
- Set flowerGroup = New SoSeparator
- Call root.addChild(flowerGroup)
- 'Read the flower object from a file and add to the group
- Dim flower As Object
- Set flower = myInput.readAllUrl(V3Space1.getRegistryDataPath() + "\examples\data\flower.iv", V3Space1.GetIDispatch())
- 'Set up the flower transformations
- Dim danceTranslation As SoTranslation
- Set danceTranslation = New SoTranslation
- Dim initialTransform As SoTransform
- Set initialTransform = New SoTransform
- Call flowerGroup.addChild(danceTranslation)
- Call initialTransform.scaleFactor.setValue(10#, 10#, 10#)
- Call initialTransform.translation.setValue(0#, 0#, 5#)
- Call flowerGroup.addChild(initialTransform)
- Call flowerGroup.addChild(flower)
- 'Set up an engine to calculate the motion path:
- 'r = 5*cos(5*theta); x = r*cos(theta); z = r*sin(theta)
- 'Theta is incremented using a time counter engine,
- 'and converted to radians using an expression in
- 'the calculator engine.
- Dim calcXZ As SoCalculator
- Set calcXZ = New SoCalculator
- Dim thetaCounter As SoTimeCounter
- Set thetaCounter = New SoTimeCounter
- Call thetaCounter.Max.setValue(360)
- Call thetaCounter.step.setValue(4)
- Call thetaCounter.frequency.setValue(0.075)
- Call calcXZ.a.connectFromEngine(thetaCounter.output)
- Call calcXZ.expression.set1Value(0, "ta=a*M_PI/180") 'theta
- Call calcXZ.expression.set1Value(1, "tb=5*cos(5*ta)") 'r
- Call calcXZ.expression.set1Value(2, "td=tb*cos(ta)") 'x
- Call calcXZ.expression.set1Value(3, "te=tb*sin(ta)") 'z
- Call calcXZ.expression.set1Value(4, "oA=vec3f(td,0,te)") '
- Call danceTranslation.translation.connectFromEngine(calcXZ.oAU)
- Call V3Space1.setSceneRoot(root)
- End Sub
-