- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Chandra,
Thanks very much for the advice, but the results are the same as before.
I will try to explain as best I can.
I have 10 design view representations in an assembly (iam file). I activate each design view rep, and orientate the view randomly, and zoom in / out to various heights so that each of the 10 views appears different. There will be certain items visible / not visible, and certain items colored differently between the views also.
I run my VBA macro. (screen shots attached). After I run the macro, I want all the views that I selected as target views to look exactly like the base view, but I only want the view orientation (upvector), zoom height(camera.eye) and view (camera.target) to be the same as the base view. In other words and colors or part visibility settings must be maintained and not copied from the base view. This is very handy for screen capturing for presentation purposes when you want to represent different parts in the assembly in a specific sequence.
Right now the code does not do this (even with the changes you suggested). If you have any other suggestions, i would be happy to try them.
Private Sub ProcessViews(frmViewCameraCopy As frm_ViewCameraCopy)
Dim oView As Inventor.DesignViewRepresentation
Dim activeViewName As String
Dim oCamera As Inventor.Camera
Dim oBaseView As Inventor.DesignViewRepresentation
Dim oColTargetViews As New Collection
Dim oCompDef As ComponentDefinition
Dim width, height As Double
Dim waslocked As Boolean
Dim viewInfo As String
Dim cameraHeight As Double
Dim cameraWidth As Double
Dim oTG As Inventor.TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim upVector As Inventor.UnitVector
Dim cameraPosition As Inventor.Point
Dim targetPosition As Inventor.Point
Set oCompDef = ThisApplication.ActiveDocument.ComponentDefinition
For Each oView In _
oCompDef.RepresentationsManager.DesignViewRepresentations
If oView.Name = frmViewCameraCopy.BaseViewName Then
Set oBaseView = oView
End If
For Each Item In frmViewCameraCopy.ViewsToProcess
If Item = oView.Name Then
oColTargetViews.Add oView
End If
Next
Next
cameraHeight = GetCameraHeight(oBaseView.DesignViewInfo)
cameraWidth = GetCameraWidth(oBaseView.DesignViewInfo)
Set upVector = oTG.CreateUnitVector(GetUpVectorX(oBaseView.DesignViewInfo), GetUpVectorY(oBaseView.DesignViewInfo), GetUpVectorZ(oBaseView.DesignViewInfo))
Set cameraPosition = oTG.CreatePoint(GetCameraPointX(oBaseView.DesignViewInfo), GetCameraPointY(oBaseView.DesignViewInfo), GetCameraPointZ(oBaseView.DesignViewInfo))
Set targetPosition = oTG.CreatePoint(GetTargetPointX(oBaseView.DesignViewInfo), GetTargetPointY(oBaseView.DesignViewInfo), GetTargetPointZ(oBaseView.DesignViewInfo))
activeViewName = oCompDef.RepresentationsManager.ActiveDesignViewRepresentation.Name
Set oActiveView = ThisApplication.ActiveView
For Each oView In oColTargetViews
ThisApplication.ActiveView.Fit
If oView.Locked Then
waslocked = True
oView.Locked = False
Else
waslocked = False
End If
oView.Activate
'Debug.Print oView.DesignViewInfo
Set oCamera = ThisApplication.ActiveView.Camera
oCamera.Target = oBaseView.Camera.Target.Copy
oCamera.Eye = oBaseView.Camera.Eye.Copy
oCamera.upVector = oBaseView.Camera.upVector.Copy
oCamera.Apply
Application.Wait Now + #12:00:02 AM#
oView.Locked = waslocked
Next
End Sub
Rob
-------------------------------------------
Windows 7 Pro (X64)
Intel(R) core (TM) i5-4690 CPU @ 3.50GHz
32.0 GB RAM
Nvidia Quadro K2000
Autodesk Inventor 2015 Professional Ultimate Design Suite