Cancel
Showing results for
Did you mean:

# Re: How to get start point of each patterned instance

Gears Esteemed Contributor

The video shows what you are doing, but does not explain why you are doing it. It appears that you have 2 splines and are trying to create a curve midway between the 2. If so, here is an alternate approach: use the 2 splines to create a "through curves" surface, then create an isoparametric curve at the 50% U parameter (or V parameter, as appropriate).

# Re: How to get start point of each patterned instance

Valued Contributor

Hi @cowski1,

In the beginning I was just looking for the way to easy create midpoint and as you can see it's unassociative way. Now, I believe it would be better if midpoints are associative to the lines durring update state.

I'm looking at the .CreatePoint method as you suggested, so would you like to suggest specific function that I could try?

Also, I have tested an isoparametric curve on the surface through curves but it doesn't intersect lines through midpoints.

In my case, middle curve is not so important, more important are the midpoints of the lines cause I need to use them for the further analysis.

Thank you for the great ideas!

Best,

Danijel

# Re: How to get start point of each patterned instance

Valued Contributor

@NikolasLosse wrote:

Can you get a point on curve percentage on each of the instances? If the directions are mixed, you might have to create 0 and 100 percent, and ask which one is closer to the parent curve.

Alternatively, you could use the distance by arc length to sort your intersection points. Just ask for distance to 0 percent point of the parent curve.

`        length, curves = theSession.Measurement.GetArcLengthBetweenPoints(p1, p2)`

Hi Nikolas,

Thank you for the advice. I have used function that you suggested to get the arc length distance between start point of the curve and other (early created points on curve).

```Dim compositeCurve12 As NXOpen.Features.CompositeCurve = CType(workPart.Features.FindObject("EXTRACTED_CURVE(4)"), NXOpen.Features.CompositeCurve)
Dim spline12 As NXOpen.Spline = CType(compositeCurve12.FindObject("CURVE 1"), NXOpen.Spline)
Dim theCurves(0) As NXOpen.Curve
theCurves(0) = spline12
Dim length As Double = Nothing
For i = 1 To points.Count - 1
' // To get arc length between start point on curve and each other point to the end point
theSession.Measurement.GetArcLengthBetweenPoints(points(0), points(i), length, theCurves)
lw.WriteLine("Point 0" & " - " & "Point " & i & " = " & length)
Next```

But, I realized that function from above creates splines, something like "temporary" object. Is it possible to remove them somehow or even to hide? I am not looking to remove them when loop is finished. I want to delete or hide them durring a loop. This will prevent deleting any other splines and I will be sure that only splines created in the loop will be deleted.

# Re: How to get start point of each patterned instance

Legend

I'm not sure I understand correctly - which of the functions creates temporary curves?

The GetArcLengthBetweenPoints function should - as I understand it - return the references to the existing curves. It should not generate extra curves. Does it?

If you generate curves somewhere and have a reference to them, you can always just add them to the delete list.

`theSession.UpdateManager.AddToDeleteList(objects)`
Nikolas Losse | Developer | Siemens PG PR R&D TEC
NX12 | CentOS7 | Python

# Re: How to get start point of each patterned instance

Valued Contributor

@NikolasLosse wrote:

I'm not sure I understand correctly - which of the functions creates temporary curves?

The GetArcLengthBetweenPoints function should - as I understand it - return the references to the existing curves. It should not generate extra curves. Does it?

If you generate curves somewhere and have a reference to them, you can always just add them to the delete list.

`theSession.UpdateManager.AddToDeleteList(objects)`

Here is the code that I have used to get arc length between start point of the curve and each other point of 928 points on curve. Each loop creates a curve which is added to the "theCurves" collection.

```        Dim compositeCurve12 As NXOpen.Features.CompositeCurve = CType(workPart.Features.FindObject("EXTRACTED_CURVE(1)"), NXOpen.Features.CompositeCurve)
Dim spline12 As NXOpen.Spline = CType(compositeCurve12.FindObject("CURVE 1"), NXOpen.Spline)
Dim theCurves(0) As NXOpen.Curve
theCurves(0) = spline12
Dim zero As Scalar = workPart.Scalars.CreateScalar(0, Scalar.DimensionalityType.None, SmartObject.UpdateOption.WithinModeling)
Dim curveStartPoint As NXOpen.Point = workPart.Points.CreatePoint(theCurves(0), zero, SmartObject.UpdateOption.WithinModeling)

Dim length As Double = Nothing

For i = 0 To trcrvPoints.Count - 1
' // To get arc length between start point on curve And each other point to the end point
theSession.Measurement.GetArcLengthBetweenPoints(curveStartPoint, trcrvPoints(i), length, theCurves)
lw.WriteLine("0 - " & i & " = " & length)
Next```

Created curves are in Non-timestamp Geometry.

Hope that now is clear.

Best,

Danijel

# Re: How to get start point of each patterned instance

Legend

Hmm, i just tested

`GetArcLengthBetweenPoints`

in Python again and that doesn't create any curves. That seems to be a difference between the API languages.

I can't test that because VBA doesn't run on Linux.

What do the VBA docs say about the function?

Anyway, since you have the curves in your theCurves array, you should be able to delete them easily.

Nikolas Losse | Developer | Siemens PG PR R&D TEC
NX12 | CentOS7 | Python

# Re: How to get start point of each patterned instance

Valued Contributor

Yes, it seems there is a difference between the API languages. Documnetation says:

 void NXOpen::Measurement::GetArcLengthBetweenPoints ( NXOpen:: Point * point1, NXOpen:: Point * point2, double * length, std::vector< NXOpen::Curve * > & curves )

Calculates and returns the arc length between two points on curves.

The points may be on a single curve or a set of connected curves. Also returns the curves that is the shortest path between the two points.
NXOpen.Features.SewBuilder.Type of allowed input objects is NXOpen:: Point

Created in NX6.0.0.

Parameters
 point1 First point on curve point2 Second point on curve length Arc length between the two points curves The curves of the shortest path

# Re: How to get start point of each patterned instance

Legend

I get the curves back in Python too, but only as a reference to existing curves (since he only measures the distance along already existing curves), no new creation happening, at least in my test.

¯\_(ツ)_/¯

Nikolas Losse | Developer | Siemens PG PR R&D TEC
NX12 | CentOS7 | Python

# Re: How to get start point of each patterned instance

Valued Contributor

Is it possible to hide everything which is inside non-timestamp geometry?

# Re: How to get start point of each patterned instance

Legend

You can hide these curves since you already have references to them by using

`theSession.DisplayManager.BlankObjects(objects)`

or you could just hide all curves (using Show/Hide), and then Show all features. That should be journalable (if that is a word)

Nikolas Losse | Developer | Siemens PG PR R&D TEC
NX12 | CentOS7 | Python