Rotate a Part in Reference to a Face

Rotate a Part in Reference to a Face

Anonymous
Not applicable
1,389 Views
9 Replies
Message 1 of 10

Rotate a Part in Reference to a Face

Anonymous
Not applicable

 

 

Hi all,


I'm attempting to create a script that find the largest face, then rotates the part clockwise in reference to that face. The code works, but rotates the part seemingly randomly.

 

I have taken the following approach:

  1. Get the largest face and set it to the Front View
  2. Find the largest face normal
  3. Set the Rotational Axis and Up Vector to the largest face normal (this is probably a mistake)

My questions are:

  1. What should the relationship of the Rotational Axis and Up Vector be to the largest face normal if I want the part to rotate clockwise in 90 degree increments?
  2. How can I represent that in my code?

Here is the code that I have cobbled together so far. It should work in any part file.

 

Thanks!

Sub Main()
	Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	RotateCamMacro(oDoc, GetFaceNormal(getLargestAreaFace(oDoc))) 
End Sub
	
Function getLargestAreaFace(oDoc As PartDocument) As Face
	Dim maxarea As Double: maxarea = 0
	Dim oface As Face
	Dim ofacemax As Face

	For Each oface In oDoc.ComponentDefinition.SurfaceBodies.Item(1).Faces
	    If oface.SurfaceType <> kCylinderSurface Then
	        If oface.Evaluator.Area > maxarea Then
	            maxarea = oface.Evaluator.Area
	            ofacemax = oface
	        End If
	    End If
	Next

	Dim oSSet As SelectSet = oDoc.SelectSet
	Call oSSet.Clear
	Call oSSet.Select(ofacemax)
	ThisApplication.CommandManager.ControlDefinitions.Item("AppLookAtCmd").Execute
	ThisApplication.CommandManager.ControlDefinitions("AppViewCubeViewFrontCmd").Execute
	getLargestAreaFace = ofacemax
End Function

' Utility function that given a face returns a normal.  This is only useful
' for planar faces, since they have a consistent normal anywhere on the face.
Function GetFaceNormal(InputFace As Face) As UnitVector
    Dim eval As SurfaceEvaluator
    eval = InputFace.Evaluator
    
    ' Get the center of the parametric range.
    Dim center(1) As Double
    center(0) = (eval.ParamRangeRect.MinPoint.X + eval.ParamRangeRect.MaxPoint.X) / 2
    center(1) = (eval.ParamRangeRect.MinPoint.Y + eval.ParamRangeRect.MaxPoint.Y) / 2
    
    ' Calculate the normal.
    Dim normal(2) As Double
    Call eval.GetNormal(center, normal)
    
    ' Create a unit vector to pass back the result.
    GetFaceNormal = ThisApplication.TransientGeometry.CreateUnitVector(normal(0), normal(1), normal(2))
End Function

Public Sub RotateCamMacro(doc As PartDocument, oVector As UnitVector)

	doc.Activate
    'Rotation speed in Rad/Sec
    Dim rotSpeedRad As Double
    rotSpeedRad = 40 * PI / 180
    
    'Get range box center point
    Dim centerPoint As Point
    centerPoint = GetRangeBoxCenter(doc)
    
    'Get Inventor camera
    Dim camera As Inventor.Camera
    camera = ThisApplication.ActiveView.Camera
    
    Dim totalRot As Double
    totalRot = 0
    
    'Issue is probably here-----------------------------------
    Dim rotAxis As Vector
    rotAxis = oVector.AsVector
    
    Dim upVector As UnitVector
	upVector = oVector
    '--------------------------------------------------------
	
	Dim offsetRad As Double
    Do While (totalRot < 0.5 * PI)
        offsetRad = 0.05 * rotSpeedRad
        RotateCam (camera, offsetRad, rotAxis, centerPoint, upVector)
        totalRot = totalRot + offsetRad
    Loop
End Sub

Public Function GetRangeBoxCenter(ByVal doc As Document) As Point

    Dim minPoint As Point
    minPoint = doc.ComponentDefinition.RangeBox.minPoint
    
    Dim maxPoint As Point
    maxPoint = doc.ComponentDefinition.RangeBox.maxPoint
    
    GetRangeBoxCenter = ThisApplication.TransientGeometry.CreatePoint( _
        (minPoint.X + maxPoint.X) * 0.5, _
        (minPoint.Y + maxPoint.Y) * 0.5, _
        (minPoint.Z + maxPoint.Z) * 0.5)

End Function

Public Sub RotateCam( _
    camera As Camera, _
    ByVal offsetRad As Double, _
    rotAxis As Vector, _
    center As Point, _
    upVector As UnitVector)

    Dim matrix As Matrix
    matrix = ThisApplication.TransientGeometry.CreateMatrix
    
    Call matrix.SetToRotation(offsetRad, rotAxis, center)
    
    Dim newEye As Point
    newEye = camera.eye
    
    Call newEye.TransformBy(matrix)
    
    camera.eye = newEye
    
    camera.upVector = upVector
    
    Call camera.ApplyWithoutTransition
    
End Sub

 

0 Likes
Accepted solutions (2)
1,390 Views
9 Replies
Replies (9)
Message 2 of 10

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

In your Sub RotateCamMacro change

Set upVector = oVector

in

Set upVector = camera.upVector

 

Your Sub RotateCam change to

Public Sub RotateCam( _
    camera As camera, _
    ByVal offsetRad As Double, _
    rotAxis As Vector, _
    center As Point, _
    upVector As UnitVector)
    
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    
    Dim matrix As matrix
    Set matrix = ThisApplication.TransientGeometry.CreateMatrix
    
    Call matrix.SetToRotation(-offsetRad, rotAxis, center)
  
    Call upVector.TransformBy(matrix)
   
    camera.upVector = upVector
    
    Call camera.ApplyWithoutTransition
    
End Sub

 

If you rotate around the view axis (line between camera eye and target point) the camera position doesn't change. The camera rotates and this is defined by a changing (rotating) upVector.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 10

aelqabbany
Advocate
Advocate

That works beautifully. Thank you very much!

0 Likes
Message 4 of 10

aelqabbany
Advocate
Advocate

@Ralf_Krieg, if you would be so kind, I had a follow-up question:

 

If I wanted to rotate the part forwards and backwards, how would I go about that? I assume that I would need to add 90 degrees to the rotation axis?

 

Thank you very much!

0 Likes
Message 5 of 10

Ralf_Krieg
Advisor
Advisor

Hello

 

If you rotate a part along the origin axis, you'll find examples in API help, forum and internet. I tried to find a solution to combine your aligning largest face parallel to view and rotate this part.

I'm not an expert in manipulating  the camera object, but try the following code.

 

Option Explicit

Sub Main()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oLargestFace As Face
    Set oLargestFace = getLargestAreaFace(oDoc)
    
    Dim oFaceNormal As UnitVector
    Set oFaceNormal = GetFaceNormal(oLargestFace)
    
    Call FaceToFront(oLargestFace, oFaceNormal)
    
    ThisApplication.CommandManager.ControlDefinitions("AppViewCubeViewFrontCmd").Execute
    
    Call RotateBackAndForward
   
End Sub

Public Sub RotateBackAndForward()

    ThisApplication.ActiveView.Fit
    
    ' Get the active camera.
    Dim oCamera As camera
    Set oCamera = ThisApplication.ActiveView.camera
    
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

    Dim oTarget As Point
    Set oTarget = oTG.CreatePoint(0, 0, 0)
    
    oCamera.Target = oTarget
    
    Call oCamera.Apply
    
    Dim oldEye As Point
    Set oldEye = oCamera.Eye.Copy
  
    Dim oldTarget As Point
    Set oldTarget = oCamera.Target.Copy
  
    Dim oldUpVector As UnitVector
    Set oldUpVector = oCamera.upVector.Copy
    
    ' create a rotate axis
    Dim XAxis As Vector
    Dim YAxis As Vector
    Dim ZAxis As Vector
    Set XAxis = oTG.CreateVector(1, 0, 0)
    Set YAxis = oTG.CreateVector(0, 1, 0)
    Set ZAxis = oTG.CreateVector(0, 0, 1)
    
    Dim oMatrix As matrix
    Set oMatrix = oCamera.ViewToWorld 'oTG.CreateMatrix()
    
    Call XAxis.TransformBy(oMatrix)
    Call YAxis.TransformBy(oMatrix)
    Call ZAxis.TransformBy(oMatrix)
    
    ' define 90 degrees as radiant double
    Dim dRad90 As Double
    dRad90 = 2 * Math.Atn(1)
    
    '###################### Rotation X ##################################
    ' rotate 90 degrees - X-Axis
    Call oMatrix.SetToRotation(-dRad90, XAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
        
    'wait a second
    Sleep 1000
    
    ' rotate back 90 degrees - X-Axis
    Call oMatrix.SetToRotation(dRad90, XAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
    
    'wait a second
    Sleep 1000
    
    '###################### Rotation Y ##################################
    ' rotate 90 degrees - Y-Axis
    Call oMatrix.SetToRotation(-dRad90, YAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
        
    'wait a second
    Sleep 1000
    
    ' rotate back 90 degrees - Y-Axis
    Call oMatrix.SetToRotation(dRad90, YAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
    
    'wait a second
    Sleep 1000
    
    '###################### Rotation Z ##################################
    ' rotate 90 degrees - Z-Axis
    Call oMatrix.SetToRotation(-dRad90, ZAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
        
    'wait a second
    Sleep 1000
    
    ' rotate back 90 degrees - Z-Axis
    Call oMatrix.SetToRotation(dRad90, ZAxis, oldTarget)
    
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    
    Call oCamera.Apply
    
    'wait a second
    Sleep 1000
End Sub


Function getLargestAreaFace(oDoc As PartDocument) As Face
    Dim maxarea As Double: maxarea = 0
    Dim oFace As Face
    Dim ofacemax As Face

    For Each oFace In oDoc.ComponentDefinition.SurfaceBodies.Item(1).Faces
        If oFace.SurfaceType <> kCylinderSurface Then
            If oFace.Evaluator.Area > maxarea Then
                maxarea = oFace.Evaluator.Area
                Set ofacemax = oFace
            End If
        End If
    Next

    Set getLargestAreaFace = ofacemax
End Function

' Utility function that given a face returns a normal.  This is only useful
' for planar faces, since they have a consistent normal anywhere on the face.
Function GetFaceNormal(InputFace As Face) As UnitVector
    Dim eval As SurfaceEvaluator
    Set eval = InputFace.Evaluator
    
    ' Get the center of the parametric range.
    Dim center(1) As Double
    center(0) = (eval.ParamRangeRect.minPoint.x + eval.ParamRangeRect.maxPoint.x) / 2
    center(1) = (eval.ParamRangeRect.minPoint.y + eval.ParamRangeRect.maxPoint.y) / 2
    
    ' Calculate the normal.
    Dim normal(2) As Double
    Call eval.GetNormal(center, normal)
    
    ' Create a unit vector to pass back the result.
    Set GetFaceNormal = ThisApplication.TransientGeometry.CreateUnitVector(normal(0), normal(1), normal(2))
End Function

Private Sub FaceToFront(ByVal oFace As Face, ByVal oFaceNormal As UnitVector)
    ' Rotate camera to align face to view plane
    
    Dim oCamera As camera
    Set oCamera = ThisApplication.ActiveView.camera
    
    ' Set Eye or Target
    Dim oPoint As Point
    If oFace.IsParamReversed Then
        Set oPoint = oCamera.Eye.Copy
        Call oPoint.TranslateBy(oFace.Geometry.normal.AsVector())
        oCamera.Target = oPoint
    Else
        Set oPoint = oCamera.Target.Copy
        Call oPoint.TranslateBy(oFace.Geometry.normal.AsVector())
        oCamera.Eye = oPoint
    End If
    
    Dim oEdge As Edge
    For Each oEdge In oFace.Edges
        If oEdge.GeometryType = kLineSegmentCurve Then
            oCamera.upVector = oEdge.Geometry.Direction
            Exit For
        End If
    Next

    Call oCamera.Apply
    ThisApplication.ActiveView.Fit
    
End Sub

Public Function GetRangeBoxCenter(ByVal doc As Document) As Point

    Dim minPoint As Point
    Set minPoint = doc.ComponentDefinition.RangeBox.minPoint
    
    Dim maxPoint As Point
    Set maxPoint = doc.ComponentDefinition.RangeBox.maxPoint
    
    Set GetRangeBoxCenter = ThisApplication.TransientGeometry.CreatePoint( _
        (minPoint.x + maxPoint.x) * 0.5, _
        (minPoint.y + maxPoint.y) * 0.5, _
        (minPoint.z + maxPoint.z) * 0.5)

End Function

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 6 of 10

aelqabbany
Advocate
Advocate

Thank you very much. I appreciate the time that you put into this.

 

Rotation via the x-axis works perfectly, but with the y and z axes, the part jiggles very slightly but doesn't move.

 

I'll play around with the code and see if I can find the issue.

 

Thanks again!

0 Likes
Message 7 of 10

Ralf_Krieg
Advisor
Advisor

Hello

 

Can you upload your test file? My test file works as aspected, but maybe my part is not complex enough. I've found some minor bugs, but before posting I would test again with your file.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 8 of 10

aelqabbany
Advocate
Advocate

Thank you very much!

0 Likes
Message 9 of 10

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

I've modified the code a little bit.

Your test file is a little bit curios. Some of the internal values are saved in inch. Never seen that before. Inventor always computes in cm and converts units to the defined unit before displaying.

That's why the setting of camera extent with your file fails.

 

Option Explicit

Public Sub Main()
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument
    
    Dim oLargestFace As Face
    Set oLargestFace = GetLargestAreaFace(oPartDoc)
    
    Dim oPoint As Point
    Set oPoint = GetFaceCentroid(oPartDoc, oLargestFace)
    
    Dim oFaceNormal As UnitVector
    Set oFaceNormal = GetFaceNormal(oLargestFace, oPoint)
    
    Call FaceToFront(oLargestFace, oPoint, oFaceNormal)
    
    ThisApplication.CommandManager.ControlDefinitions("AppViewCubeViewFrontCmd").Execute
    
    Call RotateBackAndForward
    
    'activate to go back to home view
    'ThisApplication.ActiveView.GoHome
End Sub


Private Sub RotateBackAndForward()

    ' Get the active camera.
    Dim oCamera As camera
    Set oCamera = ThisApplication.ActiveView.camera
    
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

    Dim oldEye As Point
    Set oldEye = oCamera.Eye.Copy
  
    Dim oldTarget As Point
    Set oldTarget = oCamera.Target.Copy
  
    Dim oldUpVector As UnitVector
    Set oldUpVector = oCamera.upVector.Copy
    
    ' create rotate axis
    Dim XAxis As Vector
    Dim YAxis As Vector
    Dim ZAxis As Vector
    Set XAxis = oTG.CreateVector(1, 0, 0)
    Set YAxis = oTG.CreateVector(0, 1, 0)
    Set ZAxis = oTG.CreateVector(0, 0, 1)
    
    Dim oMatrix As matrix
    Set oMatrix = oCamera.ViewToWorld
    
    Call XAxis.TransformBy(oMatrix)
    Call YAxis.TransformBy(oMatrix)
    Call ZAxis.TransformBy(oMatrix)
    
    ' define 90 degrees as radiant double
    Dim dRad90 As Double
    dRad90 = 2 * Math.Atn(1)
    
    ' define 180 degrees as radiant double
    Dim dRad180 As Double
    dRad180 = 4 * Math.Atn(1)
    
    '###################### Rotation X ##################################
    ' rotate forward 90 degrees - X-Axis
    Call oMatrix.SetToRotation(-dRad90, XAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate backward 180 degrees - X-Axis
    Call oMatrix.SetToRotation(dRad180, XAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate forward again 90 degrees - X-Axis
    Call oMatrix.SetToRotation(-dRad90, XAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    '###################### Rotation Y ##################################
    ' rotate forward 90 degrees - Y-Axis
    Call oMatrix.SetToRotation(-dRad90, YAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate backward 180 degrees - Y-Axis
    Call oMatrix.SetToRotation(dRad180, YAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate forward again 90 degrees - Y-Axis
    Call oMatrix.SetToRotation(-dRad90, YAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500 'wait 0.5 second
    
    '###################### Rotation Z ##################################
    ' rotate forward 90 degrees - Z-Axis
    Call oMatrix.SetToRotation(-dRad90, ZAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate backward 180 degrees - Z-Axis
    Call oMatrix.SetToRotation(dRad180, ZAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    Sleep 500
    
    ' rotate forward again 90 degrees - Z-Axis
    Call oMatrix.SetToRotation(-dRad90, ZAxis, oldTarget)
    Call oldEye.TransformBy(oMatrix)
    oCamera.Eye = oldEye
    Call oldUpVector.TransformBy(oMatrix)
    oCamera.upVector = oldUpVector
    Call oCamera.Apply
    
End Sub

Private Function GetLargestAreaFace(oPartDoc As PartDocument) As Face
    
    Dim maxarea As Double: maxarea = 0
    Dim oFace As Face
    Dim ofacemax As Face

    For Each oFace In oPartDoc.ComponentDefinition.SurfaceBodies.Item(1).Faces
        If oFace.SurfaceType <> kCylinderSurface Then
            If oFace.Evaluator.Area > maxarea Then
                maxarea = oFace.Evaluator.Area
                Set ofacemax = oFace
            End If
        End If
    Next

    Set GetLargestAreaFace = ofacemax
End Function


Private Sub FaceToFront(ByVal oFace As Face, ByVal oPoint As Point, ByVal oFaceNormal As UnitVector)
    ' Rotate camera to align face to view plane and center
    
    Dim oCamera As camera
    Set oCamera = ThisApplication.ActiveView.camera
    
    ' Set camera target to face cendroid
    oCamera.Target = oPoint
    
    Dim oEye As Point
    Set oEye = oCamera.Target
    
    Call oEye.TranslateBy(oFaceNormal.AsVector)
    oCamera.Eye = oEye
    
    Dim oEdge As Edge
    For Each oEdge In oFace.Edges
        If oEdge.GeometryType = kLineSegmentCurve Then
            oCamera.upVector = oEdge.Geometry.Direction
            Exit For
        End If
    Next
    
    Call SetViewExtents(oCamera, oFace)
    
    'Seems we habve to wait a little bit while part positioning finished
    Dim i As Integer
    For i = 1 To 100
        Sleep 10
        DoEvents
    Next
    
End Sub


Private Function GetFaceCentroid(ByVal oPartDoc As PartDocument, ByVal oFace As Face) As Point
    'geometric center point face
    'to center face in view we need the geometrical center
        
    Dim oEdgeLoop As EdgeLoop
    For Each oEdgeLoop In oFace.EdgeLoops
        If oEdgeLoop.IsOuterEdgeLoop Then Exit For
    Next
    
    Dim oTrans As Transaction
    Set oTrans = ThisApplication.TransactionManager.StartTransaction(oPartDoc, "Create TempWorkPoint")
    
    Dim oWorkPoint As WorkPoint
    Dim oPoint As Inventor.Point
    Set oWorkPoint = oPartDoc.ComponentDefinition.WorkPoints.AddAtCentroid(oEdgeLoop, True)
    Set oPoint = oWorkPoint.Point
    
    oTrans.Abort
    
    Set GetFaceCentroid = oPoint
        
End Function

Private Function GetFaceNormal(ByVal oFace As Face, ByVal oPoint As Point) As UnitVector
    ' face normal at center point
    
    Dim oEval As SurfaceEvaluator
    Set oEval = oFace.Evaluator

    Dim aCenter(2) As Double
    aCenter(0) = oPoint.x
    aCenter(1) = oPoint.y
    aCenter(2) = oPoint.z
    
    ' Calculate the normal.
    Dim aNormal(2) As Double
    Call oEval.GetNormalAtPoint(aCenter, aNormal)
    
    ' Create a unit vector to pass back the result.
    Set GetFaceNormal = ThisApplication.TransientGeometry.CreateUnitVector(aNormal(0), aNormal(1), aNormal(2))
    
End Function

Private Sub SetViewExtents(ByRef oCamera As camera, ByVal oFace As Face)
    
    Dim oMaxPoint As Point2d
    Dim oMinPoint As Point2d
    Set oMaxPoint = oFace.Evaluator.ParamRangeRect.maxPoint
    Set oMinPoint = oFace.Evaluator.ParamRangeRect.minPoint
    
    Dim dFaceHeight As Double
    Dim dFaceWidth As Double
    dFaceHeight = Round(oMaxPoint.y - oMinPoint.y, 5)
    dFaceWidth = Round(oMaxPoint.x - oMinPoint.x, 5)
    
    Call oCamera.SetExtents(2 * dFaceWidth, 2 * dFaceHeight)
    oCamera.Apply
    
End Sub

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 10 of 10

aelqabbany
Advocate
Advocate

Amazing stuff. Thank you very much!

0 Likes