Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Offset a curve that is not on a planar surface (NX 8)

Status
Not open for further replies.

JChurch77

Mechanical
Mar 10, 2010
72
I am working in NX8. I have a curve that I would like to OFFSET, making it larger in diameter so to speak. I dont see an easy way to do this using the Offset Curve function, can this be done? I have attached my file for reference and would really appreciate some advice on a quick way of doing this, thank you in advance.
 
Replies continue below

Recommended for you

Here's a little workaround.
I extruded the spline , then offsetted the face. I first created two lines roughly across the spline, then a third line perpendicular to one of the lines to get a "reasonable" vector for the extrusion.


Regards,
Tomas
 
 http://files.engineering.com/getfile.aspx?folder=57d2f6f3-4df0-43cf-bcaa-49da38c6c5c6&file=Offset_Curve_trial_tomas.prt
I do not have NX8, so I am just guessing here
Is it possible to scale the curve ? then for the scale factor use sizes of new diameter/current diameter
 
You can scale it, however it moves off location of where it currently needs to be. There must be a way around that as well. Im just kind of confused why the Offset Curve function doesnt easily do this simple operation. Toost, good idea as well. Good input guys.
 
It isn't really a simple operation since an offset needs a vector , if a curve is planar then the vectors are all in the plane of the curve, ( perpendicular to the curve itself) but if the curve is 3D then there is no logical default direction, there is no "plane of curve" to use.
If one scales the curve one needs to define a scale center, which one might be able to set by human logic but i doubt that a computer might "understand where it should be per default". Plus that it will scale in all directions not only in the "expected plane of curve" ( The scaled curve will also be "higher" .)
My workaround is based upon my assumption of the extrusion vector, then the offset is the face normal.

I attach a picture for Jerry.

Regards,
Tomas
 
 http://files.engineering.com/getfile.aspx?folder=7ace90d4-9723-4332-99f4-f31fb694dfaf&file=jerry.png
Another NX8 guees here . . . because I don't have it.
Under previous versions of NX there was 3 Point Fit and 4 Point Fit under Transform
There must be something eqivalent to that in NX8.
Maybe use the binoculars and enter 3 Point Fit and see what comes up
 
It depends on how you want to offset. I have used the z axis as the normal direction. That is at each point on the original spline I determine a vector offset using the cross product of the spline slope with the normal. Below is the journal. Just change the line

Dim offset1 As Double = 0.5

to some other value. Note this journal only works using NX8.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Features

Module ZNormalOffset
    Dim s As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = s.Parts.Work
    Sub Main()
        Dim offset1 As Double = 0.5
        Dim spline1 As Spline = Nothing
        spline1 = select_a_spline("Select a Spline")
        Dim curveparm As Double = 0.0
        Dim delcurveparm As Double = 1.0 / 100.0
        Dim pnt1(2) As Double
        Dim curvetang(2) As Double
        Dim junk3(2) As Double
        Dim junk1 As Double = Nothing
        Dim normal1() As Double = {0.0, 0.0, 1.0}
        Dim vect1(2) As Double
        Dim magnitude1 As Double = 0.0001
        Dim epnt1(2) As Double
        Dim coordinates1 As Point3d
        Dim ArrayOfPoints2(99) As Point
        For i As Integer = 0 To 99
            ufs.Modl.AskCurveProps(spline1.Tag, curveparm, pnt1, curvetang, junk3, junk3, junk1, junk1)
            ufs.Vec3.Cross(normal1, curvetang, vect1)
            ufs.Vec3.Unitize(vect1, 0.001, magnitude1, vect1)
            epnt1(0) = pnt1(0) + offset1 * vect1(0)
            epnt1(1) = pnt1(1) + offset1 * vect1(1)
            epnt1(2) = pnt1(2) + offset1 * vect1(2)
            coordinates1 = New Point3d(epnt1(0), epnt1(1), epnt1(2))
            ArrayOfPoints2(i) = workPart.Points.CreatePoint(coordinates1)
            curveparm += delcurveparm
        Next
        Dim splinefeat2 As Feature
        Dim periodic1 As Boolean = True
        splinefeat2 = CreateStudioSplineThruPoints(ArrayOfPoints2, periodic1)
    End Sub
    
    Public Function CreateStudioSplineThruPoints(ByRef points() As Point, ByVal periodic1 As Boolean) As Feature
        Dim markId9 As Session.UndoMarkId
        markId9 = s.SetUndoMark(Session.MarkVisibility.Visible, "Studio Spline Thru Point")
        Dim Pcount As Integer = points.Length - 1
        Dim nullNXObject As NXObject = Nothing
        Dim studioSplineBuilderEx1 As Features.StudioSplineBuilderEx
        studioSplineBuilderEx1 = workPart.Features.CreateStudioSplineBuilderEx(nullNXObject)
        studioSplineBuilderEx1.Degree = 3
        studioSplineBuilderEx1.InputCurveOption = StudioSplineBuilderEx.InputCurveOptions.Delete
        studioSplineBuilderEx1.Type = Features.StudioSplineBuilderEx.Types.ThroughPoints
        studioSplineBuilderEx1.IsPeriodic = periodic1
        studioSplineBuilderEx1.MatchKnotsType = Features.StudioSplineBuilderEx.MatchKnotsTypes.None
        studioSplineBuilderEx1.HasPlaneConstraint = False
        studioSplineBuilderEx1.OrientExpress.AxisOption = GeometricUtilities.OrientXpressBuilder.Axis.Passive
        studioSplineBuilderEx1.OrientExpress.PlaneOption = GeometricUtilities.OrientXpressBuilder.Plane.Passive
        Dim knots1(-1) As Double
        studioSplineBuilderEx1.SetKnots(knots1)
        Dim parameters1(-1) As Double
        studioSplineBuilderEx1.SetParameters(parameters1)
        Dim nullDirection As Direction = Nothing
        Dim nullScalar As Scalar = Nothing
        Dim nullOffset As Offset = Nothing
        Dim geometricConstraintData(Pcount) As Features.GeometricConstraintData
        For ii As Integer = 0 To Pcount
            geometricConstraintData(ii) = studioSplineBuilderEx1.ConstraintManager.CreateGeometricConstraintData()
            geometricConstraintData(ii).Point = points(ii)
            geometricConstraintData(ii).AutomaticConstraintDirection = Features.GeometricConstraintData.ParameterDirection.Iso
            geometricConstraintData(ii).AutomaticConstraintType = Features.GeometricConstraintData.AutoConstraintType.None
            geometricConstraintData(ii).TangentDirection = nullDirection
            geometricConstraintData(ii).TangentMagnitude = nullScalar
            geometricConstraintData(ii).Curvature = nullOffset
            geometricConstraintData(ii).CurvatureDerivative = nullOffset
            geometricConstraintData(ii).HasSymmetricModelingConstraint = False
        Next ii
        studioSplineBuilderEx1.ConstraintManager.SetContents(geometricConstraintData)
        Dim feature1 As Features.Feature
        feature1 = studioSplineBuilderEx1.CommitFeature()
        studioSplineBuilderEx1.Destroy()
        Return feature1
    End Function
    Function select_a_spline(ByVal prompt As String) As Spline
        Dim ui As UI = ui.GetUI()
        Dim curveType() As Selection.SelectionType = _
            {Selection.SelectionType.Curves}
        Dim cursor As Point3d = Nothing
        Dim selobj As Spline = Nothing
        Dim resp As Selection.Response = _
            ui.SelectionManager.SelectObject("Select a spline", prompt, _
                Selection.SelectionScope.AnyInAssembly, False, _
                curveType, selobj, cursor)
        Return selobj
    End Function
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
    End Function
End Module

Frank Swinkels
 
This solution is a bit kludgy, but might give you what you want.

1) Use N-sided surface with triangular type to Build a surface of the spline.
2) Enlarge the faces in UV directions with linear mode.
3) Sew the enlarged faces together.
2) Use the Offset curve in face command with the sewn faces and original spline. Set the offset method to along arc length.

Step 1 to 3, is the kludge bit as the quality of the created surfaces will decide the final offset curves position.

 
 http://files.engineering.com/getfile.aspx?folder=eb78ceae-d1b9-44b7-8636-8bef60fc4e9d&file=Offset_Curve_Trial_Kludge_NX8.prt

I created an extrude from the spline. Used offset region to offset the faces of the extrude. Then used Project Curve to project along the face normal.

The result is exactly same as the spline generated from Frank's journal.

Suresh
www.technisites.com.au
 
 http://files.engineering.com/getfile.aspx?folder=1dcb2aee-6120-4429-88e2-9bbc7c20fc4e&file=Offset_Curve_trial.prt
I used the same approach as petulf,
Use N-sided surface with triangular type to Build a surface of the spline
copied the spline, splited the copy in 4 segments , offset in face with the segments
regards
 
Project the curves to a plane that is parallel to the direction you want to offset, then offset the curves, then project back on to the face the curves were on, if no face you may have to make an n-sided surface beforehand to be able to project them back to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor