Measure Intersection Curve
Measure Intersection Curve
(OP)
I need to convert my intersection curve to a displayable object, so far everything I have tried has failed.
The error says "System.NullReferenceException: Object reference not set to an instance of an object.
at ModelChecking.MeasureLineLength(IntersectionCurve moldInterLine, String strMoldLength, Boolean boolLength, Unit_unitMM) in" ... "line 676"
Line 676 is the line curves = moldInterLine.GetEntities()
Any help is greatly appreciated.
The error says "System.NullReferenceException: Object reference not set to an instance of an object.
at ModelChecking.MeasureLineLength(IntersectionCurve moldInterLine, String strMoldLength, Boolean boolLength, Unit_unitMM) in" ... "line 676"
CODE --> vb
Sub MeasureLineLength( ByRef moldInterLine As Features.IntersectionCurve, ByRef strMoldLength As String, _
ByRef boolLength As Boolean, ByRef unitMM As Unit )
Dim measureDistanceBuilder1 As MeasureDistanceBuilder
Dim measureLength1 As MeasureLength
Dim curves(-1) As NXObject
Dim nullNXObject As NXObject
nullNXObject = Nothing
measureDistanceBuilder1 = workPart.MeasureManager.CreateMeasureDistanceBuilder(nullNXObject)
curves = moldInterLine.GetEntities()
'Try
measureLength1 = workPart.MeasureManager.NewLength( unitMM, curves )
strMoldLength = measureLength1.value.ToString
msgbox("Mold length = " & strMoldLength )
'Catch
'strMoldLength = "Failed To Measure"
'End Try
End Sub Line 676 is the line curves = moldInterLine.GetEntities()
Any help is greatly appreciated.





RE: Measure Intersection Curve
CODE
To use the list, you'll need to add the line:
Imports System.Collections.Generic
to the "imports" section
Length will be returned in the "analysis units" of the part.
www.nxjournaling.com
RE: Measure Intersection Curve
Imports System.Collections
The problem is it is failing at the second line of your code, or that is where my error is directing me:
<code>
featureObjects = myIntersectionCurve.GetEntities
<code>
I had the same line in my code, I don't know why it won't work.
Error reads:
System.NullReferenceException: Object reference not set to an instance of an object.
at ModelChecking.MeasureLineLength(intersectionCurve moldInterLine, String, strmoldInterLine, String strMoldLength, Boolean, boolLength, Unit_unitMM) ... line 678
RE: Measure Intersection Curve
www.nxjournaling.com
RE: Measure Intersection Curve
CODE --> vb
Try feature1 = intersectionCurveBuilder1.commitFeature() moldinterLine = CType( feature1, Features.IntersectionCurve ) Catch boolIntersection = false intersectionCurveBuilder1.Destroy() Exit Sub End Try intersectionCurveBuilder1.Destroy()From a glance is this "transforming" the builder to curve, correctly?
RE: Measure Intersection Curve
I'd try:
CODE
www.nxjournaling.com
RE: Measure Intersection Curve
moldInterLine = intersectionCurveBuilder1.commitFeature()
I did an if statement as follows
If moldInterLine is Nothing then
msgbox("interLine = Nothing")
End If
and it activated.
I am attempting to place an intersection curve on a component of an assembly, the intersection curve does appear but it is unassociated, that is fine I can make it work, but would this effect the ability of the variable to be passed and used later in the program?
RE: Measure Intersection Curve
To investigate further, I ran this code on the assembly file (where the intersect curve feature was created):
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.Features Module NXJournal Sub Main Dim s As Session = Session.GetSession() Dim ui As UI = UI.GetUI() Dim lw As ListingWindow = s.ListingWindow lw.Open() Dim featArray() As Feature = s.Parts.Work.Features.GetFeatures() Dim featEntities() as NXObject lw.WriteLine("*** All Features ***") For each myFeature as Feature in featArray lw.WriteLine(myFeature.GetFeatureName) lw.WriteLine(myFeature.FeatureType) lw.writeline("") Next lw.Close End Sub End ModuleThis is a simple journal that simply lists all the features in the work part to the information window. I found there was a linked face feature with the same feature number as the intersect curve feature, but it does not appear in the part history.
Perhaps too much code was cut from the journal you originally created to help make your intersect curve feature subroutine?
www.nxjournaling.com
RE: Measure Intersection Curve
I have actually called the GTAC helpline and gotten them to see if they can help me, in the mean time I'll check the original journal and see if I can start from scratch
Thanks for all your help.
RE: Measure Intersection Curve
For getting something like an intersection curve from a component of an assembly you must wave link the feature you are working off of.
So I'm off to learn how to wave link.
Thanks for all the help cowski!