×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Datum on a Spline, Automation Error Help

Datum on a Spline, Automation Error Help

Datum on a Spline, Automation Error Help

(OP)
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

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.

RE: Datum on a Spline, Automation Error Help

The error message seems to indicate that you are getting an exception in your select_a_spline function. If not, make sure all the objects are valid by printing out some information before section2.AddToSection.

Suresh
www.technisites.com.au

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources