|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
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 |
|