找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

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

[分享] 创建扫略曲面并将空间点投影到曲面上

[复制链接]
跳转到指定楼层
1
发表于 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 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-5-30 19:14 , Processed in 0.021356 second(s), 14 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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