|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
总是变换不成功,弹出错误对话框,
请高人指点,多谢!!!
' NX 4.0.0.25
' Journal created by nmgf on Tue Mar 27 11:12:31 2007 中国标准时间
'
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module UGTransformTest
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
' ----------------------------------------------
' 菜单: 插入->曲线->Basic Curves...
' ----------------------------------------------
Dim startPoint1 As Point3d = New Point3d(-30, 30, 0.0)
Dim endPoint1 As Point3d = New Point3d(60, 30, 0.0)
Dim line1 As Line
line1 = workPart.Curves.CreateLine(startPoint1, endPoint1)
Dim startPoint2 As Point3d = New Point3d(60, 30, 0.0)
Dim endPoint2 As Point3d = New Point3d(60, -30, 0.0)
Dim line2 As Line
line2 = workPart.Curves.CreateLine(startPoint2, endPoint2)
Dim startPoint3 As Point3d = New Point3d(60, -30, 0.0)
Dim endPoint3 As Point3d = New Point3d(-30, -30, 0.0)
Dim line3 As Line
line3 = workPart.Curves.CreateLine(startPoint3, endPoint3)
Dim startPoint4 As Point3d = New Point3d(-30, -30, 0.0)
Dim endPoint4 As Point3d = New Point3d(-30, 30, 0.0)
Dim line4 As Line
line4 = workPart.Curves.CreateLine(startPoint4, endPoint4)
' ----------------------------------------------
' 菜单: 插入->Design Feature->拉伸...
' ----------------------------------------------
Dim section1 As Section
section1 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim extrudeBuilder1 As Features.ExtrudeBuilder
extrudeBuilder1 = workPart.Features.CreateExtrudeBuilder(nullFeatures_Feature)
extrudeBuilder1.Section = section1
Dim limits1 As GeometricUtilities.Limits
limits1 = extrudeBuilder1.Limits
Dim featureOptions1 As GeometricUtilities.FeatureOptions
featureOptions1 = extrudeBuilder1.FeatureOptions
Dim linearLimits1 As GeometricUtilities.LinearLimits = CType(limits1, GeometricUtilities.LinearLimits)
Dim extend1 As GeometricUtilities.Extend
extend1 = linearLimits1.StartExtend
Dim extend2 As GeometricUtilities.Extend
extend2 = linearLimits1.EndExtend
Dim booleanOperation1 As GeometricUtilities.BooleanOperation
booleanOperation1 = extrudeBuilder1.BooleanOperation
Dim direction1 As Direction
direction1 = extrudeBuilder1.Direction
Dim featureOffset1 As GeometricUtilities.FeatureOffset
featureOffset1 = extrudeBuilder1.Offset
Dim simpleDraft1 As GeometricUtilities.SimpleDraft
simpleDraft1 = extrudeBuilder1.Draft
Dim featureOptions2 As GeometricUtilities.FeatureOptions
featureOptions2 = extrudeBuilder1.FeatureOptions
extend1.SetValue("0")
extend2.SetValue("25")
featureOffset1.SetStartOffset("0")
featureOffset1.SetEndOffset("5")
featureOffset1.OffsetType = GeometricUtilities.Type.NonsymmetricOffset
simpleDraft1.SetDraftAngle("2")
simpleDraft1.DraftType = GeometricUtilities.SimpleDraft.SimpleDraftType.SimpleFromStart
Dim curves1(3) As Curve
curves1(0) = line3
curves1(1) = line2
curves1(2) = line1
curves1(3) = line4
Dim curveDumbRule1 As CurveDumbRule
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(curves1)
section1.AllowSelfIntersection(False)
Dim rules1(0) As SelectionIntentRule
rules1(0) = curveDumbRule1
Dim nullNXObject As NXObject = Nothing
Dim helpPoint1 As Point3d = New Point3d(33.1834217214209, -32.8259757986841, 0.0)
section1.AddToSection(rules1, line3, nullNXObject, nullNXObject, helpPoint1, Section.Mode.Create)
Dim origin1 As Point3d = New Point3d(11.40625, -7.96875000000001, 0.0)
Dim vector1 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim direction2 As Direction
direction2 = workPart.Directions.CreateDirection(origin1, vector1, SmartObject.UpdateOption.WithinModeling)
extrudeBuilder1.Direction = direction2
Dim feature1 As Features.Feature
feature1 = extrudeBuilder1.CommitFeature()
extrudeBuilder1.Destroy()
' ----------------------------------------------
' 菜单: 工具->日记->停止
' ----------------------------------------------
Dim fs() As Features.Feature = workPart.Features.ToArray
Dim count As Integer = fs.GetLength(0)
Dim i As Integer = 0
Dim featureTag(count - 1) As Tag
For Each f As Features.Feature In fs
featureTag(i) = f.Tag
i += 1
Next
Dim transMode As Integer = 2
Dim csysTrans(1, 11) As Double
csysTrans(0, 0) = 0
csysTrans(0, 1) = 0
csysTrans(0, 2) = 0
csysTrans(0, 3) = 1
csysTrans(0, 4) = 0
csysTrans(0, 5) = 0
csysTrans(0, 6) = 0
csysTrans(0, 7) = 1
csysTrans(0, 8) = 0
csysTrans(0, 9) = 0
csysTrans(0, 10) = 0
csysTrans(0, 11) = 1
csysTrans(1, 0) = 120
csysTrans(1, 1) = 0
csysTrans(1, 2) = 0
csysTrans(1, 3) = 0
csysTrans(1, 4) = 0
csysTrans(1, 5) = 1
csysTrans(1, 6) = 1
csysTrans(1, 7) = 0
csysTrans(1, 8) = 0
csysTrans(1, 9) = 0
csysTrans(1, 10) = 1
csysTrans(1, 11) = 0
Dim theUFSession As UFSession = UFSession.GetUFSession
theUFSession.Modl.MoveFeature(featureTag, transMode, csysTrans)
theUFSession.Modl.Update()
End Sub
End Module |
|