Message 1 of 3
TransientGeometry.CreatePoint gives Compile error: Argument Not Optional error

Not applicable
11-08-2013
01:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Trying to create my 1st Inventor Macro here. This is driving me crazy. I copied what I think is the offending code right from the "Mod the Machine" blog. Inventor/VBA is telling me Compile error: Argument Not Optional. Here is the entire Macro/Sub
Public Sub CopyCurrentIpnView() Dim app As Application Set app = ThisApplication Dim exView As PresentationExplodedView Dim baseView As view Dim baseCamera, otherCam As Camera Dim eye, target As Point Dim upvector As UnitVector Dim tg As TransientGeometry baseCamera = app.ActiveView.Camera tg = app.TransientGeometry eye = tg.CreatePoint(baseCamera.eye.X, baseCamera.eye.Y, baseCamera.eye.Z) target = tg.CreatePoint(baseCamera.target.X, baseCamera.target.Y, baseCamera.target.Z) upvector = tg.CreateUnitVector(baseCamera.upvector.X, baseCamera.upvector.Y, baseCamera.upvector.Z) If app.ActiveDocument.DocumentType <> kPresentationDocumentObject Then MsgBox "Not a presentation project." Exit Sub End If For Each exView In app.ActiveDocument.PresentationExplodedViews exView.Activate otherCam = app.ActiveView.Camera otherCam.eye.X = eye.X otherCam.eye.Y = eye.Y otherCam.eye.Z = eye.Z otherCam.target.X = target.X otherCam.target.Y = target.Y otherCam.target.Z = target.Z otherCam.upvector.X = upvector.X otherCam.upvector.Y = upvector.Y otherCam.upvector.Z = upvector.Z otherCam.Apply otherCam.Fit Next End Sub
The Public Sub CopyCurrentIpnView() line gets highlighted in yellow but the "target =" gets selected, so I assume the error is near the "target =". But I get no other help to tell me what is wrong! I've slogged through documentation. Searched Google and Stackoverflow. I've tried putting Set in front of the tg, eye, target, and upvector assignments but that did not help.
I'm on Inventor 2012 Ultimate x64 with SP2 and OS is Win 7 Enterprise.
Any help is appreciated.