Vb.net 如何通过visual basic以编程方式将草图文件导入NX?

Vb.net 如何通过visual basic以编程方式将草图文件导入NX?,vb.net,sketching,Vb.net,Sketching,我需要将草图导入NX,这个草图是2D草图,它可以是任何几何形状,我不知道它会是什么样子,因为这取决于客户。此草图应作为对象的横截面。绘制完草图后,我应该拉伸它并创建对象。 下面是一个我为另一个目的编写的程序,我在代码中留下了一个空白,因为我相信我应该在其中插入一些东西,以便调用草图,但我不知道应该在空白处写什么。有人能告诉我应该在空白处写些什么才能画出草图吗?多谢各位 Option Strict Off Imports System Imports NXOpen Module Points_01

我需要将草图导入NX,这个草图是2D草图,它可以是任何几何形状,我不知道它会是什么样子,因为这取决于客户。此草图应作为对象的横截面。绘制完草图后,我应该拉伸它并创建对象。 下面是一个我为另一个目的编写的程序,我在代码中留下了一个空白,因为我相信我应该在其中插入一些东西,以便调用草图,但我不知道应该在空白处写什么。有人能告诉我应该在空白处写些什么才能画出草图吗?多谢各位

Option Strict Off
Imports System
Imports NXOpen
Module Points_01
     Sub Main(ByVal args() As String)
              'Declare working part of the NX session
       Dim theSession As Session = Session.GetSession()
       Dim workPart As Part = theSession.Parts.Work




              'Create a section
              Dim circ As NXOpen.Section = workPart.Sections.CreateSection(ctol, dtol, atol)
              Dim helpPoint As New NXOpen.Point3d(X,Y,Z)
              Dim nullObj As NXOpen.NXObject = Nothing
              Dim noChain As Boolean = False
              Dim createMode As NXOpen.Section.Mode = Section.Mode.Create
              ' Create rules to add the circle to the section
              Dim circl As NXOpen.CurveDumbRule = workPart.ScRuleFactory.CreateRuleBaseCurveDumb({disk0,disk1})
              circ.AddToSection({circl}, disk0, nullObj, nullObj, helpPoint, createMode, noChain)
              circ.AddToSection({circl}, disk1, nullObj, nullObj, helpPoint, createMode, noChain)
              Dim builder = workPart.Features.CreateExtrudeBuilder(Nothing)
              builder.Section = circ
              'Define the direction of the Extrude
              Dim origin As New NXOpen.Point3d(X,Y,Z)
              Dim axisZ As New NXOpen.Vector3d(0,0,1)
              Dim updateOption = SmartObject.UpdateOption.DontUpdate
              builder.Direction = workPart.Directions.CreateDirection(origin, axisZ, updateOption)
              builder.Limits.StartExtend.Value.RightHandSide = "0"
              builder.Limits.EndExtend.Value.RightHandSide = "50"
              Dim pegs As NXOpen.Features.Extrude = builder.CommitFeature
              builder.Destroy
              'Get the displayable object of the Extrude feature
               Dim bodies As NXOpen.Body() = pegs.GetBodies
              ' Change its color to color red (186)
              bodies(0).Color = 186
              'Show object
              bodies(0).RedisplayObject
     End Sub
End Module

哦,不!它应该是选项严格的。好的,我会做这个更改,我可以问一下,为了让草图运行,我还应该在代码中写些什么吗?