- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I see there are a lot of unanswered posts for creating a custom view. My problem sounds simple. I have the view direction I want. It is NOT a standard (front, left, right, top, bottom) direction. I want to apply it to the document. My failure is creating the camera object properly. I have a target center, and a normal unit vector, but when my view is created I get a strange unusable (and massively large) view that tells me my camera is not correct.
How about some code:
Dim sheet1 As Sheet = drawDoc.Sheets(1)
Dim pViewPosition As Point2d = tg.CreatePoint2d(sheet1.Width * 2 / 5, sheet1.Height * 3 / 5)
'choose base view rotation
Dim viewOrientation As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kArbitraryViewOrientation
Dim viewCamera As Camera = invApp.TransientObjects.CreateCamera() viewCamera.SceneObject = partDoc.ComponentDefinition viewCamera.ViewOrientationType = ViewOrientationTypeEnum.kFrontViewOrientation viewCamera.Target = FindMidPoint3D(partDoc.ComponentDefinition.RangeBox.MinPoint, partDoc.ComponentDefinition.RangeBox.MaxPoint) viewCamera.UpVector = sktNormal viewCamera.Apply()
Dim vBase As DrawingView = sht.DrawingViews.AddBaseView(docModel, pntView, dblScale, viewOrientation, viewStyle, strViewName, viewCamera, viewOptions)
I set to viewOrientation Notice there is not an 'eye' to the camera probably my problem, but I don't know what I should set it too. I know the view will scale the document after I supply a scale, so can eye be target as well? or should eye be target translated with up/normal vector to a point above the target? This camera thing is difficult for me to process. Probably thinking too hard. Please help,
Thanks,
Solved! Go to Solution.