How to create Workplane perpendicular to viewing angle?

How to create Workplane perpendicular to viewing angle?

Anonymous
Not applicable
447 Views
0 Replies
Message 1 of 1

How to create Workplane perpendicular to viewing angle?

Anonymous
Not applicable

I need to create a Workplane perpendicular to the current viewing angle of the model.  I'm sure the ActiveView's Camera will be utilized but I can't quite figure out what properties of the Camera to use and how to use them in order to create a workplane perpendicular to the current viewing angle and through a point.  Here's what I have so far.  If I could just calculate oXAxisUnitVector and oYAxisUnitVector so that the workplane is created perpendicular to the current view then I'd have what I need.  I'm not set on using WorkPlanes.AddFixed but it seem to fit the bill.

 

    Dim oView As View
    Dim oCamera As Camera
    Dim oEyePt As Point
    Dim oTargetPt As Point
    Dim oTG As TransientGeometry
    Dim oPoint As Point
    Dim oVector As Vector
    Dim oPartDocument As PartDocument
    Dim oPartComponentDefinition As PartComponentDefinition

    Dim oXAxisUnitVector As UnitVector
    Dim oYAxisUnitVector As UnitVector

    Set oTG = ThisApplication.TransientGeometry
    Set oView = ThisApplication.ActiveView
    Set oPartDocument = ThisApplication.ActiveDocument
    Set oPartComponentDefinition = oPartDocument.ComponentDefinition
   
    Set oCamera = oView.Camera
    Set oEyePt = oCamera.Eye
    Set oTargetPt = oCamera.Target
    Set oVector = oEyePt.VectorTo(oTargetPt)
    
    Set oPoint = oTG.CreatePoint(0, 0, 0)
    Set oXAxisUnitVector = oTG.CreateUnitVector
    Set oYAxisUnitVector = oTG.CreateUnitVector
    oXAxisUnitVector.X = ?
    oXAxisUnitVector.Y = ?
    oXAxisUnitVector.Z = ?
    oYAxisUnitVector.X = ?
    oYAxisUnitVector.Y = ?
    oYAxisUnitVector.Z = ?
    
    oPartComponentDefinition.WorkPlanes.AddFixed oPoint, oXAxisUnitVector, oYAxisUnitVector

0 Likes
448 Views
0 Replies
Replies (0)