你好,我正在用visual basic使用NX 12的日志功能,现在我正在尝试构造两行代码,但是,在我运行我的程序后,没有显示任何结果。我可以问一下我的代码出了什么问题吗?以下是我的代码
谢谢
Imports System
Imports NXOpen
Module NXJournal
Sub Main()
Dim p0 As New NXOpen.Point3d(1,2,3)
Dim p1 As New NXOpen.Point3d(4,7,5)
Dim theSession = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim line1 As NXOpen.Line = workPart.Curves.CreateLine(p0, p1)
End Sub
End Module发布于 2020-09-25 23:29:29
在我运行你的日志之后,我确实得到了一条线,所以你的代码看起来没有任何问题。
虽然它也应该在其他环境中工作,但我只是要确保它是在建模环境中,以减少麻烦。
现在,我已经添加了代码,使窗口适合查看行,以便更好地查看行。
我能想到的另一个可能的问题是,您禁用了在其上绘制直线的图层。为了确保不是这种情况,我将行设置为layer 1。要访问nx中的层管理器,您可以按ctrl+L键,并验证哪些层是可见的。
Imports System
Imports NXOpen
Module NXJournal
Sub Main()
Dim theSession = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
' if nx is not in the modeling application, switch to it
If theSession.ApplicationName IsNot "UG_APP_MODELING" Then theSession.ApplicationSwitchImmediate("UG_APP_MODELING")
' create simple points (not smartpoints)
Dim p0 As New NXOpen.Point3d(1,2,3)
Dim p1 As New NXOpen.Point3d(4,7,5)
' create a line in the part
Dim line1 As NXOpen.Line = workPart.Curves.CreateLine(p0, p1)
'set the layer
line1.layer = 1
' fit to the line
workPart.ModelingViews().WorkView().Fit()
End Sub
End Modulehttps://stackoverflow.com/questions/63919448
复制相似问题