Private Function Airfoil(ByVal beta2 As Double, ByVal VaneL As Double) As Boolean
If beta2 * VaneL = 0 Then Exit Function
Dim objpDoc As SolidEdgePart.PartDocument
If (objDoc.Type <> SolidEdgeFramework.DocumentTypeConstants.igPartDocument) Then
MsgBox("Please, Open Part Document.")
Airfoil = False
Exit Function
End If
objpDoc = objDoc
Dim objRefPlane(2) As SolidEdgePart.RefPlane
Dim objProfile As SolidEdgePart.Profile
Dim dblX As Double
Dim dblY As Double
' Create a new reference plane.
' objRefPlane = objDoc.RefPlanes.AddParallelByDistance( _
' ParentPlane:=objDoc.RefPlanes(1), _
' distance:=0, _
' NormalSide:=igLeft, _
' Local:=True)
objRefPlane(1) = objpDoc.RefPlanes.AddAngularByAngle( _
ParentPlane:=objpDoc.RefPlanes(1), _
Angle:=(180 - beta2) / 180 * Math.PI, _
NormalSide:=SolidEdgePart.FeaturePropertyConstants.igNormalSideDummy, _
Pivot:=objpDoc.RefPlanes(2), _
PivotOrigin:=SolidEdgePart.ReferenceElementConstants.igPivotEnd, _
Local:=False)
objRefPlane(0) = objpDoc.RefPlanes.AddAngularByAngle( _
ParentPlane:=objRefPlane(1), _
Angle:=Math.PI / 2, _
NormalSide:=SolidEdgePart.FeaturePropertyConstants.igNormalSideDummy, _
Pivot:=objpDoc.RefPlanes(0), _
PivotOrigin:=SolidEdgePart.ReferenceElementConstants.igPivotEnd, _
Local:=False)
objProfile = objDoc.ProfileSets.Add.Profiles.Add(objRefPlane(0))
' Get the model space origin relative to profile space.
objProfile.Convert3DCoordinate(x3d:=0, y3d:=0, z3d:=0, _
x2d:=dblX, y2d:=dblY)
' Draw a circle for the profile graphics.
' objProfile.Circles2d.AddByCenterRadius(x:=dblX, y:=dblY, Radius:=500 / 1000)
Dim PointData(52) As Double
Dim i As Long = 0
PointData(i) = 486.3 / 1000 : PointData(i + 1) = 5.7 / 1000 : i = i + 2
PointData(i) = 437.6 / 1000 : PointData(i + 1) = 20.2 / 1000 : i = i + 2
PointData(i) = 389.0 / 1000 : PointData(i + 1) = 31.7 / 1000 : i = i + 2
PointData(i) = 340.4 / 1000 : PointData(i + 1) = 39.8 / 1000 : i = i + 2
PointData(i) = 291.8 / 1000 : PointData(i + 1) = 45.4 / 1000 : i = i + 2
PointData(i) = 243.1 / 1000 : PointData(i + 1) = 49.2 / 1000 : i = i + 2
PointData(i) = 194.5 / 1000 : PointData(i + 1) = 50.9 / 1000 : i = i + 2
PointData(i) = 145.9 / 1000 : PointData(i + 1) = 48.6 / 1000 : i = i + 2
PointData(i) = 97.3 / 1000 : PointData(i + 1) = 44.4 / 1000 : i = i + 2
PointData(i) = 72.9 / 1000 : PointData(i + 1) = 40.5 / 1000 : i = i + 2
PointData(i) = 48.6 / 1000 : PointData(i + 1) = 37.3 / 1000 : i = i + 2
PointData(i) = 24.3 / 1000 : PointData(i + 1) = 32.7 / 1000 : i = i + 2
PointData(i) = 0 / 1000 : PointData(i + 1) = 12.8 / 1000 : i = i + 2
PointData(i) = 24.3 / 1000 : PointData(i + 1) = 1.4 / 1000 : i = i + 2
PointData(i) = 48.6 / 1000 : PointData(i + 1) = 2.1 / 1000 : i = i + 2
PointData(i) = 72.9 / 1000 : PointData(i + 1) = 2.8 / 1000 : i = i + 2
PointData(i) = 97.3 / 1000 : PointData(i + 1) = 4.3 / 1000 : i = i + 2
PointData(i) = 145.9 / 1000 : PointData(i + 1) = 5.7 / 1000 : i = i + 2
PointData(i) = 194.5 / 1000 : PointData(i + 1) = 6.1 / 1000 : i = i + 2
PointData(i) = 243.1 / 1000 : PointData(i + 1) = 6.8 / 1000 : i = i + 2
PointData(i) = 291.8 / 1000 : PointData(i + 1) = 7.1 / 1000 : i = i + 2
PointData(i) = 340.4 / 1000 : PointData(i + 1) = 7.1 / 1000 : i = i + 2
PointData(i) = 389.0 / 1000 : PointData(i + 1) = 5.7 / 1000 : i = i + 2
PointData(i) = 437.6 / 1000 : PointData(i + 1) = 2.8 / 1000 : i = i + 2
PointData(i) = 486.3 / 1000 : PointData(i + 1) = 0 / 1000 : i = i + 2
Dim objBSpline As SolidEdgeFrameworkSupport.BSplineCurve2d
objBSpline = objProfile.BSplineCurves2d.AddByPoints(Order:=4, ArraySize:=25, Array:=PointData)
Dim objLine As SolidEdgeFrameworkSupport.Line2d
objLine = objProfile.Lines2d.AddBy2Points(PointData(48), PointData(49), PointData(0), PointData(1))
Dim objRelations As SolidEdgeFrameworkSupport.Relations2d
objRelations = objProfile.Relations2d
objProfile.Relations2d.addkeypoint( _
objLine, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, _
objBSpline, SolidEdgeConstants.KeypointIndexConstants.igBsplineCurveStart)
objRelations.AddKeypoint( _
objLine, SolidEdgeConstants.KeypointIndexConstants.igLineStart, _
objBSpline, 25 - 1) ' Array 갯수과 관련이 있음.
' End and validate the profile.
Dim ordStatus As Boolean
ordStatus = objProfile.End(ValidationCriteria:=SolidEdgePart.ProfileValidationType.igProfileClosed)
If ordStatus <> 0 Then
MsgBox("Invalid Profile")
Exit Function
End If
End Function
댓글 없음:
댓글 쓰기