Twullf
Mechanical
- Jan 24, 2012
- 196
I am writing a program which will go into an assembly part, and place a Datum on a spline, which will be brought in with one of the assembly components.
I am manually selecting the spline, and I am having the following error:
NXOpen.NXException:Internal error: memory access violation
at NXOpen.Section.AddToSection(SelectionIntentRule[] rules, NXObject seed, NXObject startConnector, NXObject endConnector, Point3d helpPoint, Mode featureMOde, Boolean chainWithinFeature)
at select_a_spline.Main()
The code is as follows
I think the problem is with the section2.AddToSection, but I've been fighting it for several days and have not been able to resolve the issue.
Any help would be greatly appreciated.
I am manually selecting the spline, and I am having the following error:
NXOpen.NXException:Internal error: memory access violation
at NXOpen.Section.AddToSection(SelectionIntentRule[] rules, NXObject seed, NXObject startConnector, NXObject endConnector, Point3d helpPoint, Mode featureMOde, Boolean chainWithinFeature)
at select_a_spline.Main()
The code is as follows
Code:
If (SelectSpline(spline1) = Selection.Response.ObjectSelected) Then
datumPlaneBuilder1 = workPart.Features.CreateDatumPlaneBuilder(nullFeatures_Feature)
unit1 = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
plane1 = datumPlaneBuilder1.GetPlane()
section2 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
plane1.SetUpdateOption(SmartObject.UpdateOption.WithinModeling)
curves1(0) = spline1
'SplinePoint = New Point3d( 0, 0, 0 )
helpPoint2 = New Point3d(-2.36825229556759e-005, 0.0, 1124.15035257941)
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(curves1)
rules1(0) = curveDumbRule1
'section2.AllowSelfIntersection(False)
section2.AddToSection(rules1, spline1, nullNXObject, nullNXObject, helpPoint2, Section.Mode.Create, False)
geom1(0) = section2
plane1.SetMethod(PlaneTypes.MethodType.Frenet)
plane1.SetGeometry(geom1)
plane1.ReplaceExpression(expression2)
plane1.SetFrenetSubtype(PlaneTypes.FrenetSubtype.Tangent)
plane1.SetReverseSection(False)
plane1.SetAlternate(PlaneTypes.AlternateType.One)
plane1.SetPercent(False)
plane1.SetExpression("2000")
plane1.Evaluate()
flip1 = plane1.Flip
feature3 = datumPlaneBuilder1.CommitFeature()
datumPlane1 = datumPlaneFeature1.DatumPlane
datumPlane1.SetReverseSection(False)
datumPlaneBuilder1.Destroy()
I think the problem is with the section2.AddToSection, but I've been fighting it for several days and have not been able to resolve the issue.
Any help would be greatly appreciated.