Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX 8.5 Make Surface from Point Cloud

Status
Not open for further replies.

Rodrigomitsuy

Mechanical
Nov 9, 2013
2
Hello,
I am having trouble making a surface from scanned data. It is basically a hand mold for a joystick. I was told to use Insert>Surface>From Point Cloud , but since my version is 8.5 i guess that option is not available anymore. My question is, what tool should I use to make a clean surface of the point cloud so I can reverse engineer it and change some things? I hear I should use Fit Surface but when I use it, the resulting surface is not enveloping the point cloud but going in different directions. What parameters should I change in order to get what I want?

Thanks in advance.
 
Replies continue below

Recommended for you

This is NOT the sort of 'point cloud' data that can be used with EITHER the old Surface -> From Point Cloud or the new Surface -> Fit Surface function. What you have looks like it was created using 'white light scanning' and therefore you need to use what's referred to as Reverse Engineering tools. Even then you'll probably have to decimate (break-up into smaller sets of data) the 'point cloud' and then try to fit the resulting surfaces together at the end. Basically what I'm saying is that this is beyond the scope of the normal NX surface creation tools. You need specialized reverse engineering tools found in products like 'Imageware'.

BTW, if this model could have been imported as a pair of faceted bodies there might be a few more options available to you in NX.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
John talks to fast here. If the points are grouped , the fit surface works.
But, rather than trying to create a single sheet from all points,:
Divide the cloud into "logical four sided areas" onto which a four sided surface can be mapped, either by placing the points on different layers or using hide/ show. Ignore small transitions which, on the model, would be created by regular blends. These areas should be created by a blend or other type but not by mapping a surface to the cloud. If possible also divide the cloud into "smooth groups"- it's easier to map a surface to points if they describe a simple , consistent, common shape than if the points do "all the shape at once".( Difficult to describe) Then create groups of these smaller clouds. Create in some way a similar shaped surface compared to the points you will fit it to, i.e map a quarter of a cylinder to a quarter of the joystick. The mapping will by this be easier for NX to accomplish. Then use Refit Surface - Fit to target. ( Group not needed.)
On the attached example i have created a single "slab" on one side to show the process.

Regards,
Tomas
 
 http://files.engineering.com/getfile.aspx?folder=9767a4c9-5be7-4d5a-b1ff-273c6a9c559a&file=10000_pointcloudjoystick_(1).prt
Hi Rodrigomitsuy ,
I just opened your part file. This contains only points and not exactly the point cloud or .stl data. I would prefer to have a point cloud data which will enable me to take sections and fitcurves on these and create surfaces (also you can use Rapid Surfacing depending on if you have the license for it).I think Rapid Surfacing will gel good in your case.
But would suggest you to obtain the .stl file or the facet data for the same first.
Best Regards
Kapil
 
Here is a journal which allows one to create planar point sets from cloud of points. Before running the journal create any number of datum planes that intersect the point cloud. When you then run the journal you are asked to select a datum plane. The program then get the points that lie within a defined distance (in this case 1mm) of the selected datum plane. These points are saved into two lists, one for points on each side of the datum plane. Next for each point on one side of the datum plane the nearest point on the other side of the datum plane is found. Finally the point of intesection with the datum plane of the line joining these points is obtained resulting in a set of points that are planar which makes it easier to create section splines and surfaces. The points are created on the layer of each selected datum plane.

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

Module PointCloudTools2
    Dim s As Session = Session.GetSession()
    Dim ui As UI = UI.GetUI()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim lw As ListingWindow = s.ListingWindow
    Dim wp As Part = s.Parts.Work
    Sub Main()
        Dim response As Selection.Response = Nothing
        Dim dplane1 As DatumPlane = Nothing
        Dim dplaneorigin As Point3d = Nothing
        Dim dplanenormal As Vector3d = Nothing
        Dim dplanelayer As Integer = Nothing
        Dim pntcol As PointCollection = wp.Points
        Dim pntarray() As Point = pntcol.ToArray
        Dim workLayer As Integer = wp.Layers.WorkLayer
        Dim stateArray1(0) As Layer.StateInfo
        Dim m1 As Session.UndoMarkId = s.SetUndoMark(Session.MarkVisibility.Visible, "M1")
Start1:
        response = selectDatumPlane(dplane1)
        If response = Selection.Response.Cancel Or response = Selection.Response.Back _
            Then GoTo End1
        dplaneorigin = dplane1.Origin
        dplanenormal = dplane1.Normal
        dplanelayer = dplane1.Layer
        If dplanelayer <> workLayer Then
            stateArray1(0).Layer = dplanelayer
            stateArray1(0).State = Layer.State.WorkLayer
            wp.Layers.ChangeStates(stateArray1, False)
        End If
        Dim dist1 As Double = Nothing
        Dim mindist As Double = 500.0
        Dim nearest1 As Integer = Nothing
        Dim neglist As New ArrayList
        Dim poslist As New ArrayList
        Dim planelist As New ArrayList
        Dim planept3d As New Point3d
        Dim planepoint As Point = Nothing
        For Each pt As Point In pntarray
            dist1 = NormalDistance1(dplaneorigin, dplanenormal, pt)
            If dist1 < 0.0 And dist1 > -1.0 Then
                neglist.Add(pt)
            ElseIf dist1 > 0.0 And dist1 < 1.0 Then
                poslist.Add(pt)
            ElseIf dist1 = 0.0 Then
                planelist.Add(pt)
            End If
        Next
        For Each pt As Point In planelist
            pt.Layer = dplanelayer
        Next
        For i As Integer = 0 To poslist.Count - 1
            For j As Integer = 0 To neglist.Count - 1
                dist1 = Math.Sqrt((poslist(i).Coordinates.X - neglist(j).Coordinates.X) ^ 2 + _
                        (poslist(i).Coordinates.Y - neglist(j).Coordinates.Y) ^ 2 + _
                        (poslist(i).Coordinates.Z - neglist(j).Coordinates.Z) ^ 2)
                If dist1 < mindist Then
                    mindist = dist1
                    nearest1 = j
                End If
            Next
            planept3d = PlanePoint1(dplaneorigin, dplanenormal, _
                                    poslist(i), neglist(nearest1))
            planepoint = wp.Points.CreatePoint(planept3d)
            planepoint.SetVisibility(SmartObject.VisibilityOption.Visible)
            planelist.Add(planepoint)
            mindist = 500.0
        Next
        neglist.Clear()
        poslist.Clear()
        planelist.Clear()
        GoTo Start1
End1:
        s.UpdateManager.DoUpdate(m1)
    End Sub
    Function selectDatumPlane(ByRef object1 As DatumPlane) As Selection.Response
        Dim selectionMask_array(0) As Selection.MaskTriple
        selectionMask_array(0).Type = UFConstants.UF_datum_plane_type
        selectionMask_array(0).Subtype = 0
        selectionMask_array(0).SolidBodySubtype = 0
        Dim cursor As Point3d = Nothing
        Dim resp As Selection.Response = _
        ui.SelectionManager.SelectTaggedObject("Datum Plane Selection", "Select a DatumPlane", _
            Selection.SelectionScope.WorkPart, _
            Selection.SelectionAction.ClearAndEnableSpecific, _
            False, False, selectionMask_array, object1, cursor)
        If resp = Selection.Response.ObjectSelected Or _
           resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        ElseIf resp = Selection.Response.Back Then
            Return Selection.Response.Back
        ElseIf resp = Selection.Response.Cancel Then
            Return Selection.Response.Cancel
        End If
    End Function
    Public Function DotVecPoint(ByVal v1 As Vector3d, ByVal p1 As Point3d) As Double
        Return v1.X * p1.X + v1.Y * p1.Y + v1.Z * p1.Z
    End Function
    Public Function DotVecVec(ByVal v1 As Vector3d, ByVal v2 As Vector3d) As Double
        Return v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z
    End Function
    Public Function SubtractPoints1(ByVal p1 As Point3d, ByVal p2 As Point3d) As Point3d
        Dim p3 As Point3d
        p3.X = p1.X - p2.X
        p3.Y = p1.Y - p2.Y
        p3.Z = p1.Z - p2.Z
        Return p3
    End Function
    Public Function SubtractPoints2(ByVal p1 As Point3d, ByVal p2 As Point3d) As Vector3d
        Dim p3 As Vector3d
        p3.X = p1.X - p2.X
        p3.Y = p1.Y - p2.Y
        p3.Z = p1.Z - p2.Z
        Return p3
    End Function
    Public Function NormalDistance1(ByVal dplaneorigin As Point3d, ByVal dplanenormal As Vector3d, _
                                    ByVal testpoint As Point) As Double
        Dim dist1 As Double = Nothing
        Dim vec2 As Vector3d = Nothing
        Dim temppnt As Point3d = Nothing
        Dim testpnt As Point3d = New Point3d(testpoint.Coordinates.X, testpoint.Coordinates.Y, _
                                             testpoint.Coordinates.Z)
        temppnt = SubtractPoints1(dplaneorigin, testpnt)
        dist1 = DotVecPoint(dplanenormal, temppnt)
        Return dist1
    End Function
    Public Function UnitizeVector(ByVal v1 As Vector3d) As Vector3d
        Dim v2 As vector3d
        Dim length As Double = math.sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z)
        v2.x = v1.x / length
        v2.y = v1.y / length
        v2.z = v1.z / length
        Return v2
    End Function
    Public Function AffineCombPointVec(ByVal p1 As Point3d, ByVal s As Double, ByVal v2 As Vector3d) As Point3d
        Dim p3 As Point3d
        p3.X = p1.X + s * v2.X
        p3.Y = p1.Y + s * v2.Y
        p3.Z = p1.Z + s * v2.Z
        Return p3
    End Function
    Public Function PlanePoint1(ByVal dplaneorigin As Point3d, ByVal dplanenormal As Vector3d, _
                                    ByVal pospoint As Point, ByVal negpoint As Point) As Point3d
        Dim sub1 As Double = Nothing
        Dim sub2 As Double = Nothing
        Dim vec2 As Vector3d = Nothing
        Dim temppnt As Point3d = Nothing
        Dim upperpnt As Point3d = New Point3d(pospoint.Coordinates.X, pospoint.Coordinates.Y, _
                                             pospoint.Coordinates.Z)
        Dim lowerpnt As Point3d = New Point3d(negpoint.Coordinates.X, negpoint.Coordinates.Y, _
                                             negpoint.Coordinates.Z)
        temppnt = SubtractPoints1(dplaneorigin, upperpnt)
        sub1 = DotVecPoint(dplanenormal, temppnt)
        Dim vect1 As Vector3d = Nothing
        vect1 = SubtractPoints2(lowerpnt, upperpnt)
        Dim vect2 As Vector3d = Nothing
        vect2 = UnitizeVector(vect1)
        sub2 = DotVecVec(dplanenormal, vect2)
        Dim sub3 As Double = sub1 / sub2
        Dim planept3d As New Point3d
        planept3d = AffineCombPointVec(upperpnt, sub3, vect2)
        Return planept3d
    End Function

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
    End Function

End Module

Frank Swinkels
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor