Public Sub CreateSketch( ByRef counter As Integer, ByRef curPoint As Point, ByRef datumPlane1 as DatumPlane, ByRef associativeLineBuilder1 As Features.AssociativeLineBuilder, byRef strDir as String )
Dim transform As transform
Dim nullSketch As Sketch = Nothing
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
Dim sketchInPlaceBuilder1 As SketchInPlaceBuilder
sketchInPlaceBuilder1 = workPart.Sketches.CreateNewSketchInPlaceBuilder(nullSketch)
Dim section1 As Section
section1 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)
Dim section2 As Section
section2 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)
Dim sketchAlongPathBuilder1 As SketchAlongPathBuilder
sketchAlongPathBuilder1 = workPart.Sketches.CreateSketchAlongPathBuilder(nullSketch)
sketchInPlaceBuilder1.PlaneOption = Sketch.PlaneOption.ExistingPlane
sketchAlongPathBuilder1.PlaneLocation.Expression.RightHandSide = "0"
Dim point1 As Point3d
point1 = curPoint.coordinates
sketchInPlaceBuilder1.PlaneOrFace.SetValue(datumPlane1, workPart.ModelingViews.WorkView, point1)
Dim nXObject1 As NXObject
nXObject1 = sketchInPlaceBuilder1.Commit()
Dim sketch1 As Sketch = CType(nXObject1, Sketch)
'Dim feature1 As Features.Feature
'feature1 = sketch1.Feature
sketch1.Activate(Sketch.ViewReorient.False)
sketchInPlaceBuilder1.Destroy()
sketchAlongPathBuilder1.Destroy()
section1.Destroy()
transform = New Transform(activeSketch.Origin, activeSketch.Orientation.Element)
CreateChord( counter, associativeLineBuilder1, transform ) 'Creates and dimensions the chord
'CreateTE() Creates and dimensions the trailing edge
'CreateTopSurfaceSpline( strDir ) Creates and constrains top surface of sketch
'CreateBotSurfaceSpline() Creates and constrains bottom surface of sketch
theSession.ActiveSketch.Deactivate(Sketch.ViewReorient.False, Sketch.UpdateLevel.Model)
End Sub
Public Sub CreateChord( ByRef counter As Integer, ByRef associativeLineBuilder1 As Features.AssociativeLineBuilder, ByRef Transform As Transform)
'------------------------------------------------------------------------------------------
' Place a line from -x, -y to +x, +y
' Points need z value?????? But each sketch, each chord is on different datum,
' at different angle
'------------------------------------------------------------------------------------------
Dim startPoint1 As Point3d = Transform.Apply( New Point3d( -33.26829028699467, -35.0000000000009, 0 ) )
Dim endPoint1 As Point3d = Transform.Apply( New Point3d( 33.0495132264591, 38.7111164380587, 0 ) )
Dim line1 As Line
line1 = workPart.Curves.CreateLine(startPoint1, endPoint1)
ActiveSketch.AddGeometry(line1, Sketch.InferConstraintsOption.InferNoConstraints)
'------------------------------------------------------------------------------------------
' Constrain curLine endpoint as point on line1
'------------------------------------------------------------------------------------------
' Dim conGeom1_1 As Sketch.ConstraintGeometry
' conGeom1_1.Geometry = line1
' conGeom1_1.PointType = Sketch.ConstraintPointType.None
' conGeom1_1.SplineDefiningPointIndex = 0
' Dim conGeom2_1 As Sketch.ConstraintGeometry
' Dim feature1 = associativeLineBuilder1.commitfeature()
' Dim associativeLine1 As Features.AssociativeLine = CType(workPart.Features.FindObject("LINE(3)"), Features.AssociativeLine)
' Dim line2 As Line = CType(associativeLine1.FindObject("CURVE 1"), Line)
' Dim endPoint as SelectPoint = associativeLineBuilder1.endpoint
' Dim curLPoint As Point3d = SelectPoint.GetValue( )
' conGeom2_1.Geometry = line2
' conGeom2_1.PointType = Sketch.ConstraintPointType.EndVertex
' conGeom2_1.SplineDefiningPointIndex = 0
' Dim help1 As Sketch.ConstraintGeometryHelp
' help1.Type = Sketch.ConstraintGeometryHelpType.Point
' help1.Point.X = curLPoint.x
' help1.Point.Y = curLPoint.y
' help1.Point.Z = curLPoint.z
' help1.Parameter = 0.0
' Dim sketchHelpedGeometricConstraint1 As SketchHelpedGeometricConstraint
' sketchHelpedGeometricConstraint1 = theSession.ActiveSketch.CreatePointOnCurveConstraint(conGeom1_1, conGeom2_1, help1)
'------------------------------------------------------------------------------------------
' Dimension length as s(counter)_Chord
'------------------------------------------------------------------------------------------
'Dim strLineLength = "S" & counter & "_Chord"
'------------------------------------------------------------------------------------------
' Dimension distance from line1 startpoint to curLine endpoint as S(counter)_YP
'------------------------------------------------------------------------------------------
'Dim strYOffset = "S" & counter & "_YP"
'------------------------------------------------------------------------------------------
' Dimension angle from line2 to y-axis as S(counter)_Twist
'------------------------------------------------------------------------------------------
'Dim strTwist = "S" & counter & "_Twist"
End Sub