ufs.curve.createSplineThruPts not being displayed
ufs.curve.createSplineThruPts not being displayed
(OP)
Ive created a function that creates a spline based on subject.
I can't get the spline to appear in the cad window. What am i missing?
I can't get the spline to appear in the cad window. What am i missing?





RE: ufs.curve.createSplineThruPts not being displayed
You're missing the explanation of your code that will allow people here to see the problems. Show us your code and then (maybe) someone can tell you what you're doing wrong.
RE: ufs.curve.createSplineThruPts not being displayed
CODE --> vb
Public Function makeSpline(ByVal points As ArrayList) As Spline Dim ufs As UF.UFSession = UF.UFSession.GetUFSession Dim mytag As Tag Dim mySpline As Spline = Nothing Dim degree As Integer = 3 Dim periodicity As Integer = 0 Dim numPoints As Integer = points.Count Dim pts As New ArrayList Dim pt(2) As Double For Each iPoint As Point3d In points pt(0) = iPoint.X pt(1) = iPoint.Y pt(2) = iPoint.Z Console.WriteLine("Point(" & pt(0).ToString() & "," & pt(1).ToString() & "," & pt(2).ToString() & ")") pts.Add(pt) Next Dim ptData(pts.Count - 1) As NXOpen.UF.UFCurve.PtSlopeCrvatr For i As Integer = 0 To pts.Count - 1 ptData(i).point = pts(i) ptData(i).slope_type = UF.UFConstants.UF_CURVE_SLOPE_AUTO ptData(i).crvatr_type = UF.UFConstants.UF_CURVE_CRVATR_NONE Next ' ufs.Curve.CreateSplineThruPts(degree, periodicity, numPoints, ptData, _ ' user specified parameterization of input points: use 'nothing' for ' default parameterization, save defining data? 1 = yes (anything else =no) ' return tag variable of new spline ufs.Curve.CreateSplineThruPts(degree, periodicity, numPoints, ptData, Nothing, 0, mytag) ' Convert Tag Reference to NXOpen Object mySpline = Utilities.NXObjectManager.Get(mytag) mySpline.SetVisibility(SmartObject.VisibilityOption.Visible) mySpline.RedisplayObject() MsgBox("Length of Spline = " & mySpline.GetLength) Return mySpline End FunctionRE: ufs.curve.createSplineThruPts not being displayed
thesession.Parts.Work.ModelingViews.WorkView.Regenerate()
Mark Benson
Aerodynamic Model Designer
To a Designer, the glass was right on CAD.
RE: ufs.curve.createSplineThruPts not being displayed
RE: ufs.curve.createSplineThruPts not being displayed
www.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
RE: ufs.curve.createSplineThruPts not being displayed
RE: ufs.curve.createSplineThruPts not being displayed
too early too soon. @cowski....the ptData structure is being assigned correctly. Here's the code that does it
For Each iPoint As Point3d In points
pt(0) = iPoint.X
pt(1) = iPoint.Y
pt(2) = iPoint.Z
Console.WriteLine("Point(" & pt(0).ToString() & "," & pt(1).ToString() & "," & pt(2).ToString() & ")")
pts.Add(pt)
Next
The items in the pts array are points dimensioned as doubles.
That's not the problem. Still looking for the problem.
Regards
RE: ufs.curve.createSplineThruPts not being displayed
CODE
For i As Integer = 0 To pts.Count - 1 ptData(i).point = pts(i) ptData(i).slope_type = UF.UFConstants.UF_CURVE_SLOPE_AUTO ptData(i).crvatr_type = UF.UFConstants.UF_CURVE_CRVATR_NONE Nextwww.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
CODE
Public Function makeSpline(ByVal points As System.Collections.ArrayList) As Spline Dim ufs As UFSession = UFSession.GetUFSession Dim mytag As Tag Dim mySpline As Spline = Nothing Dim degree As Integer = 3 Dim periodicity As Integer = 0 Dim numPoints As Integer = points.Count Dim ptData(points.Count - 1) As NXOpen.UF.UFCurve.PtSlopeCrvatr For i As Integer = 0 To points.Count - 1 Dim pt(2) As Double pt(0) = points.Item(i).X pt(1) = points.Item(i).Y pt(2) = points.Item(i).Z ptData(i).point = pt ptData(i).slope_type = UFConstants.UF_CURVE_SLOPE_AUTO ptData(i).crvatr_type = UFConstants.UF_CURVE_CRVATR_NONE Next ' ufs.Curve.CreateSplineThruPts(degree, periodicity, numPoints, ptData, _ ' user specified parameterization of input points: use 'nothing' for ' default parameterization, save defining data? 1 = yes (anything else =no) ' return tag variable of new spline ufs.Curve.CreateSplineThruPts(degree, periodicity, numPoints, ptData, Nothing, 0, mytag) ' Convert Tag Reference to NXOpen Object mySpline = Utilities.NXObjectManager.Get(mytag) MsgBox("Length of Spline = " & mySpline.GetLength) Return mySpline End Functionwww.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
CODE
For Each iPoint As Point3d In points pt(0) = iPoint.X pt(1) = iPoint.Y pt(2) = iPoint.Z Console.WriteLine("Point(" & pt(0).ToString() & "," & pt(1).ToString() & "," & pt(2).ToString() & ")") pts.Add(pt) Next 'the following results might surprise you For Each jpoint As Double() In pts lw.WriteLine(jpoint(0) & ", " & jpoint(1) & ", " & jpoint(2)) Nextwww.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
CODE --> vb
For Each iPoint As Point3d In points Dim pt(2) As Double pt(0) = iPoint.X pt(1) = iPoint.Y pt(2) = iPoint.Z pts.Add(pt) NextRE: ufs.curve.createSplineThruPts not being displayed
This also answers your previous question as to why no error was thrown. A spline was created with your previous code. It was a degenerate, zero length spline; but it was created.
www.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
3.166, 0.634, 0
3.1, 0.717, 0
3, 0.841, 0
2.9, 0.962, 0
2.8, 1.079, 0
2.7, 1.193, 0
2.6, 1.302, 0
2.5, 1.406, 0
2.4, 1.504, 0
2.3, 1.596, 0
2.2, 1.68, 0
2.1, 1.755, 0
2, 1.822, 0
1.9, 1.88, 0
1.8, 1.928, 0
1.7, 1.967, 0
1.6, 1.996, 0
1.5, 2.017, 0
1.4, 2.03, 0
1.3, 2.034, 0
1.2, 2.03, 0
1.1, 2.016, 0
1, 1.991, 0
0.9, 1.956, 0
0.8, 1.909, 0
0.8, 1.909, 0
0.7, 1.851, 0
0.6, 1.779, 0
0.5, 1.69, 0
0.4, 1.58, 0
0.3, 1.45, 0
0.213, 1.322, 0
RE: ufs.curve.createSplineThruPts not being displayed
Text file read in?
Do you have your code for how you convert your data into an array? It's a little bit difficult to advise otherwise.
A quick guess would be not stripping out the leading spaces in your input but that's a wild stab in the dark
Mark Benson
Aerodynamic Model Designer
To a Designer, the glass was right on CAD.
RE: ufs.curve.createSplineThruPts not being displayed
RE: ufs.curve.createSplineThruPts not being displayed
RE: ufs.curve.createSplineThruPts not being displayed
NXOpen.NXException: Parameters in spline defining data are not increasing
+++ Parameters in spline defining data are not increasing
Maybe time to submit this one to GTAC.
RE: ufs.curve.createSplineThruPts not being displayed
0.8, 1.909, 0
appears twice in the list (consecutively). Is this intentional? If you remove the duplicate, the spline is created.
www.nxjournaling.com
RE: ufs.curve.createSplineThruPts not being displayed
Good eye, Cowski. That's the problem.
I looked for coincident points, but didn't see any.
NX uses the distances between points to assign parameter values to them. If two consecutive points are equal, then the parameter increment between them gets set to zero, so the parameter values are "not increasing". A message saying "coincident points" would be much more helpful.
I still think you should get rid of the ArrayList. ArrayLists are obsolete and evil -- using them prevents the complier from helping you.
RE: ufs.curve.createSplineThruPts not being displayed
I agree a more helpful error message would have been better.
I agree it's kind of sloppy coding to use arrays. But, sometimes I like to bundle up things in list of lists. Then pass the arraylist around and break it apart on the other side. This works great if you are the only one programming but fails when there are multiple programmers. It's better to make a class object. ArrayList are good when you don't know the size of the array. Without knowing the size of the array you have to use redim or redim preserve.
RE: ufs.curve.createSplineThruPts not being displayed
In this case it's more of a style/preference issue since the ArrayList wasn't the source of any of your problems.
www.nxjournaling.com