Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen VB Journal How to extrude an arc

Status
Not open for further replies.

kalo86

Mechanical
May 7, 2016
2
Hello to everyone,

I'm new in the NX Journaling and I'm trying to write down a code in Visual Basic language with NXOpen.
I managed to get two splines and one arc on NX10 with a journal but when I try to make an extrusion of it, I get an error.
This is a part of my actual code, where I define thw splines and the arc (after their splinebuilder and arcbuilder):

Code:
Dim spline_dx As NXOpen.Spline
spline_dx = studioSplineBuilderEx1.Curve()
Dim spline_sx As NXOpen.Spline
spline_sx = studioSplineBuilderEx2.Curve()
Dim arc As NXOpen.Arc
arc = associativeArcBuilder1.Commit()

Dim extrudeBuilder1 As NXOpen.Features.ExtrudeBuilder
extrudeBuilder1 = workPart.Features.CreateExtrudeBuilder(Nothing)
Dim section1 As NXOpen.Section
section1 = workPart.Sections.CreateSection(0, 0, 0)
extrudeBuilder1.Section = section1
extrudeBuilder1.AllowSelfIntersectingSection(True)
extrudeBuilder1.DistanceTolerance = linear_toll
extrudeBuilder1.Limits.StartExtend.Value.RightHandSide = "0"
extrudeBuilder1.Limits.EndExtend.Value.RightHandSide = "123.456"
section1.DistanceTolerance = linear_toll
extrudeBuilder1.Direction = direction_Z
section1.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves)

Dim curves1(0) As NXOpen.IBaseCurve
Dim spline1 As NXOpen.Spline = spline_dx
curves1(0) = spline1
Dim curveDumbRule1 As NXOpen.CurveDumbRule
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves1)
section1.AllowSelfIntersection(True)
Dim rules1(0) As NXOpen.SelectionIntentRule
rules1(0) = curveDumbRule1
section1.AddToSection(rules1, spline1, Nothing, Nothing, origin, NXOpen.Section.Mode.Create, False)

Dim curves2(0) As NXOpen.IBaseCurve
Dim arc1 As NXOpen.Arc = arc
curves2(0) = arc1
Dim curveDumbRule2 As NXOpen.CurveDumbRule
'Here I get the issue:
curveDumbRule2 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves2)
section1.AllowSelfIntersection(True)
Dim rules2(0) As NXOpen.SelectionIntentRule
rules2(0) = curveDumbRule2
section1.AddToSection(rules2, arc1, Nothing, Nothing, origin, NXOpen.Section.Mode.Create, False)

Dim curves3(0) As NXOpen.IBaseCurve
Dim spline2 As NXOpen.Spline = spline_sx
curves3(0) = spline2
Dim curveDumbRule3 As NXOpen.CurveDumbRule
curveDumbRule3 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves3)
section1.AllowSelfIntersection(True)
Dim rules3(0) As NXOpen.SelectionIntentRule
rules3(0) = curveDumbRule3
section1.AddToSection(rules3, spline2, Nothing, Nothing, origin, NXOpen.Section.Mode.Create, False)

Dim feature1 As NXOpen.Features.Feature
feature1 = extrudeBuilder1.CommitFeature()
extrudeBuilder1.Destroy()

I get an error message after executing the journal on the line: "curveDumbRule2 = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves2)"

Is there someone who can help me?
Thank you in advance!
Best regards,

kalo86
 
Replies continue below

Recommended for you

What is the error message?

Have you recorded a journal and compared you code to what is recorded?

Mark Rief
NX CAM Customer Success
Siemens PLM Software
 
Hi markrief,
My code derives from a recorded journal.
When I try to extrude a spline, it works.
The result does not change if I want to extrude 2 or more splines, all is working fine.
When I add an arc to the curve selection I get an error.
I need to figure out why I cannot add the arc to curve selection.

Best regards,

kalo86
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor