我需要将草图导入 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