admin 发表于 2018-3-24 09:25:27

NX二次开发源码分享: 创建视图到指定方向


NX二次开发源码分享: 创建视图到指定方向

Imports System
Imports NXOpen

Module TrimetricViewFromBelow

    Sub Main (ByVal args() As String)

      Dim theSession As Session = Session.GetSession()
      Dim basePrt As BasePart = theSession.Parts.BaseWork
      Dim workPart As CAE.CaePart = Nothing

      Dim origin1 As Point3d = Nothing
      Dim vector1 As Vector3d = Nothing

      Dim Xx As Double = 0.63121905864762995' 50.86 deg
      Dim Xy As Double = 0.77560460287442845' 39.14 deg
      Dim Xz As Double = 0.0
      Dim angle As Double = -44.0

      If (Not (basePrt Is Nothing) And Not (TypeOf basePrt Is CAE.FemPart)) Then
            workPart = CType(theSession.Parts.BaseWork, CAE.SimPart)
      ElseIf (Not (basePrt Is Nothing) And Not (TypeOf basePrt Is CAE.SimPart)) Then
            workPart = CType(theSession.Parts.BaseWork, CAE.FemPart)
      End If

      workPart.ModelingViews.WorkView.Orient(View.Canned.Trimetric, _
                                             View.ScaleAdjustment.Fit)

      origin1 = workPart.ModelingViews.WorkView.AbsoluteOrigin
   
      vector1 = New Vector3d(Xx, Xy, Xz)
   
      workPart.ModelingViews.WorkView.Rotate(origin1, vector1, angle)

      workPart.ModelingViews.WorkView.Fit()

    End Sub

End Module
' negative trimetric view
页: [1]
查看完整版本: NX二次开发源码分享: 创建视图到指定方向