ChaseWichert
Mining
- Jan 4, 2012
- 147
Is there a way to create a point set on a curve and in one step create datums normal to the curve on all of the points in the set?
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub PlaceDatum( ByRef counter as Integer )
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim pointFeatureBuilder1 As Features.PointFeatureBuilder
pointFeatureBuilder1 = workPart.BaseFeatures.
_CreatePointFeatureBuilder(nullFeatures_Feature)
Dim datumPlaneBuilder1 As Features.DatumPlaneBuilder
datumPlaneBuilder1 = workPart.Features.
_CreateDatumPlaneBuilder(nullFeatures_Feature)
Dim plane1 As Plane
plane1 = datumPlaneBuilder1.GetPlane()
Dim scalar1 As Scalar
'dim counter as integer = 4
Dim unit1 As Unit = CType(workPart.UnitCollection.
_FindObject("MilliMeter"), Unit)
Dim expression1 As Expression
expression1 = workPart.Expressions.
_CreateSystemExpressionWithUnits("0", unit1)
scalar1 = workPart.Scalars.
_CreateScalarExpression(expression1, Scalar.
_DimensionalityType.None, SmartObject.UpdateOption.
_WithinModeling)
Dim curves1(0) As Curve
Dim spline1 As Spline = CType(workPart.Splines.
_FindObject("ENTITY 9 1 1"), Spline)
curves1(0) = spline1
Dim pointFeature1 As Features.PointFeature =
_CType(workPart.Features.FindObject("POINT (2)" ),
_Features.PointFeature)
Dim point1 As Point = CType(pointFeature1.
_FindObject("POINT 2" ), Point)
Dim direction1 As Direction
direction1 = workPart.Directions.
_CreateDirection(spline1, scalar1, Direction.
_OnCurveOption.Tangent, Sense.Forward,
_SmartObject.UpdateOption.WithinModeling)
plane1.SetMethod(PlaneTypes.MethodType.PointDir)
Dim geom1(1) As NXObject
geom1(0) = point1
geom1(1) = direction1
plane1.SetGeometry(geom1)
Dim feature1 As Features.Feature
feature1 = datumPlaneBuilder1.CommitFeature()
Dim datumPlaneFeature1 As Features.DatumPlaneFeature =
_CType(feature1, Features.DatumPlaneFeature)
Dim datumPlane1 As DatumPlane
datumPlane1 = datumPlaneFeature1.DatumPlane
datumPlaneBuilder1.Destroy()
pointFeatureBuilder1.Destroy()
End Sub