找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 17602|回复: 4
打印 上一主题 下一主题

请教vb.net下UG二次开发:拉伸特征方位变换(有源码)

[复制链接]
跳转到指定楼层
1
发表于 2007-3-27 14:09:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

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
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
 楼主| 发表于 2007-3-28 15:15:13 | 只看该作者

re:

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
3
 楼主| 发表于 2007-3-31 13:07:04 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
4
 楼主| 发表于 2007-4-13 10:48:55 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
5
发表于 2007-6-20 02:31:43 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-11-13 21:02 , Processed in 0.023495 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表