I wrote a VB Program for automating a time consuming modeling process in our company.
In part of this process I want to specify G1 constraint between 2 existing Splines in Sketch environment. But don't 'now how to do that.
In other word I want to set G1 between end point of the first Spline and start point of the second one.
If someone could point me in the right direction, that would be awesome!
There are several methods for achieving this. They all involve getting the poles next to the common spline end pole in line. It all depends on the importance of preserving the splines shape. One relatively simple method is to move two poles as shown in the image.
Consider the left hand spline the poles are shown as the blue circles. The larger blue circle is moved to the large red circle position. The line construction is just to show what I did. The same was done for the right hand spline. You can see the difference between the splines.
As mentioned before if the spline shape is important an other way is to increase the order of the splines so that when the spline poles are moved the affect is less severe. A further method is to increase the knots.
Assuming that you already have the splines as Splines-Objects you can use the following code to get the startpoint:
NXOpen.Spline spline1 = ... (your first spline . You want to get the endpoint)
NXOpen.Expression startParameterValueExpr = workPart.Expressions.CreateSystemExpression ("0.00000");
startParameterValueScalar = workPart.Scalars.CreateScalarExpression(startParam
eterValueExpr, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling);
startPoint = workPart.Points.CreatePoint(spline1, startParameterValueScalar, NXOpen.SmartObject.UpdateOption.WithinModeling);
This code creates a point at the parametervalue '0' of a spline (usually the startpoint). To get the endpoint of a spline the parametervalue has to be '1'. As long as you are using non-periodic splines NX will norm the
knot vector from '0' to '1'.
Hope that helps! :-)