Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX 11 Journal - Creating Section Curves

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
Hi, me again...

I'm trying to create a section curve feature given an edge and a join curve feature (from the edge). My code tries to get the body (EdgeParent) belonging to the selected edge (selEdge) and convert the join curve feature (JoinedCurve) into a spline, in order to make cuts along and normal to the spline.

Code:
Dim joinCurves1 As NXOpen.Features.JoinCurves = JoinedCurve
EdgeParent=selEdge.OwningComponent
Dim spline1 As NXOpen.Spline = CType(joinCurves1.getEntities(0), NXOpen.Spline)
Dim body1 As NXOpen.Body = CType(EdgeParent, NXOpen.Body)
'********************* Create Sections through Body ***********************
Dim sectionCurveBuilder1 As NXOpen.Features.SectionCurveBuilder = Nothing

sectionCurveBuilder1 = workPart.Features.CreateSectionCurveBuilder(nullNXOpen_Features_Feature)
sectionCurveBuilder1.CurveFitData.Tolerance = 0.01
sectionCurveBuilder1.CurveFitData.AngleTolerance = 0.5
sectionCurveBuilder1.ChordalTolerance = 0.01
sectionCurveBuilder1.Type = NXOpen.Features.SectionCurveBuilder.PlaneType.PerpendicularToCurve
sectionCurveBuilder1.StartDistance = -500.0
sectionCurveBuilder1.EndDistance = 500.0
sectionCurveBuilder1.StepDistance = 50.0
sectionCurveBuilder1.SpacingAlongCurveType = NXOpen.Features.SectionCurveBuilder.SpacingType.IncrementalArclengthSpacing
sectionCurveBuilder1.Increment = 100.0
sectionCurveBuilder1.Associative = False
sectionCurveBuilder1.GroupObjects = True

Dim added1 As Boolean = Nothing
added1 = sectionCurveBuilder1.ObjectsToSection.Add(body1)

sectionCurveBuilder1.CurveForPerpendicularPlane.Value = spline1
sectionCurveBuilder1.Associative = True

Dim SectionCuts As NXOpen.NXObject = Nothing
SectionCuts = sectionCurveBuilder1.Commit()

Unfortunately this returns a "Null Tag not allowed" error, which suggests one of the lines isn't doing what it is supposed to do and when the feature tries to commit, it fails.

But of course, I can't figure out which line is the culprit. Any suggestions, as always, would be appreciated.

Thanks,
Jeff
 
Replies continue below

Recommended for you

I figured out that the problem was how I was finding the body belonging to the edge.

Instead of
Code:
EdgeParent=selEdge.OwningComponent
Dim body1 As NXOpen.Body = CType(EdgeParent, NXOpen.Body)

I needed to use
Code:
Dim EdgeOBJ as Edge = selEdge
Dim body1 As Body = EdgeOBJ.GetBody()

I think I just wrapped my head around the fact that entities can be NXObjects, but unless you declare them as specific entities they aren't what you think they are.

For example: my seledge was a selected edge to me, but to NXOpen it was just an NXObject. In order to get its parents, I needed NXOpen to know it was an edge. That is why I declared the EdgeOBJ. Once I did that, I could use the "actual" edge to get the parent body.

I hope I remember this.
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor