iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 23285|回复: 0
打印 上一主题 下一主题

创建扫略曲面并将空间点投影到曲面上

[复制链接]
跳转到指定楼层
楼主
发表于 2012-7-13 23:09:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

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

x
' 始初化
InitCATIAPart

' 新加一个几何图形集
Set oHBody = AddHBody("曲面设计测试")

' 创建6个点
Dim oPt1 As HybridShapePointCoord
Dim oPt2 As HybridShapePointCoord
Dim oPt3 As HybridShapePointCoord
Dim oPt4 As HybridShapePointCoord
Dim oPt5 As HybridShapePointCoord
Dim oPt6 As HybridShapePointCoord
Set oPt1 = oHSF.AddNewPointCoord( 10, 60, 30)
Set oPt2 = oHSF.AddNewPointCoord( 70, 75, 35)
Set oPt3 = oHSF.AddNewPointCoord(100, 80, 30)
Set oPt4 = oHSF.AddNewPointCoord(100, 80, 40)
Set oPt5 = oHSF.AddNewPointCoord( 95, 20, 45)
Set oPt6 = oHSF.AddNewPointCoord(100, 10, 50)

' 用刚才的点创建参考元素
Dim R1 As Reference, R2 As Reference, R3 As Reference
Dim R4 As Reference, R5 As Reference, R6 As Reference
Set R1 = oPart.CreateReferenceFromObject(oPt1)
Set R2 = oPart.CreateReferenceFromObject(oPt2)
Set R3 = oPart.CreateReferenceFromObject(oPt3)
Set R4 = oPart.CreateReferenceFromObject(oPt4)
Set R5 = oPart.CreateReferenceFromObject(oPt5)
Set R6 = oPart.CreateReferenceFromObject(oPt6)

' 创建第一条云形线
Dim oSpline1 As HybridShapeSpline
Set oSpline1 = oHSF.AddNewSpline()

oSpline1.AddPoint R1
oSpline1.AddPoint R2
oSpline1.AddPoint R3

' 创建第二条云形线
Dim oSpline2 As HybridShapeSpline
Set oSpline2 = oHSF.AddNewSpline()

oSpline2.AddPoint R4
oSpline2.AddPoint R5
oSpline2.AddPoint R6

' 创建扫略曲面
Dim Ref1 As Reference
Dim Ref2 As Reference
Set Ref1 = oPart.CreateReferenceFromObject(oSpline1)
Set Ref2 = oPart.CreateReferenceFromObject(oSpline2)

Dim oSweepExplicit As HybridShapeSweepExplicit
Set oSweepExplicit = oHSF.AddNewSweepExplicit(Ref1, Ref2)

oHBody.AppendHybridShape oSweepExplicit

' 创建一个空间点
Dim oPt As HybridShapePointCoord
Set oPt = oHSF.AddNewPointCoord(50, 30, 100)
oHBody.AppendHybridShape oPt

' 把空间点投影到曲面上
Dim Ref3 As Reference, Ref4 As Reference
Set Ref3 = oPart.CreateReferenceFromObject(oPt)
Set Ref4 = oPart.CreateReferenceFromObject(oSweepExplicit)

Dim oProject As HybridShapeProject
Set oProject = oHSF.AddNewProject(Ref3, Ref4)
oHBody.AppendHybridShape oProject

oPart.Update
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-9-23 04:21 , Processed in 0.011759 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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