Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to get a point cloud from an existing solid model 1

Status
Not open for further replies.

zubaj

Bioengineer
Jul 31, 2007
40
Does anyone know how to get a point cloud of a surface from an existing solid model? I don't have Solidworks Premium, so unfortunately, I don't have the Scan 2 3D function.
 
Replies continue below

Recommended for you

Hi Zubaj,

Usually, point cloud data is used for reverse engineering (i.e. an existing object was scanned).

Which brings up the question, why would you need point cloud data from something that has already been modeled? Would you like to access geometric data from SolidWorks in another software?
 
Can you not just copy the surface for what you need? Or take intersecting contours of the face? (Just curious why this is needed if you've got the solid model already.)



Jeff Mowry
Reason trumps all. And awe transcends reason.
 
Saving as stl essentially tessalates the model into 3 sided polygons. Polygons meet at vertices. Which is a point. So, to increase the density of these verticies go into options on the stl export and crank the tolerance and facing angles way up. Save as an ascii or binary, depending on what program you are going to next. Saving it as an stl ascii gives you a very large file, but if you go in and look at it with wordpad, you'll see its just a format showing how verticies are shared.

Now, go get the rhino 3d evaluation package. This will read a binary stl. It gives you 25 free saves. You can also delete some of the stuff you may not need, because you must have a solid to export stl from solidworks unfortunately, so it sounds like you only wanted one face. Open up this stl file, delete what you don't want, and then save it back out as points (.txt) file. You now have an nice ascii file of your point cloud.

This is just one way i've skinned this cat.

RFUS
 
The purpose behind reverse engineering a model is to get a model with less geometrical data that still accurately represents a complex surface. This is desired to use in finite element modeling to pare down the run time of analyses.

Thanks for the tip, rfus, I'll check the Rhino 3D package out and see how it works for me.
 
This makes little sense to me. Usually, once a model is meshed, the surface data does not have anything to do with the analysis.

Are you just trying to reduce time to create a mesh?
 
Here's my guess since I used to have to do this stuff in college. He's got some cmd line type exe that was written in fortran or basic that does some type of FEA, and it has to read a point file of nodes, associate some measured data with the nearest node, create a 3x3 tensor on each node, take the eigenvalue of the node, find the principals, and apply whatever calcualations on these principals are needed. XYZ is needed cause its not some fancy FEA package that can read in surface or polygon meshes and remesh it based on some tolerance. Just a guess. I don't ask, I just try and answer the question.

RFUS
 
Is it that your FEA program can not glance over surface boundary edges? Good FEA front ends like Abaqus use "virtual topology" (might be a good buzz word). Basically it combines the faces into one with an allowable error. Hope this helps.

Rob Stupplebeen
 
As an alternate to the Rhino route, you could export to STL, then open the STL back up in SolidWorks, and run the following macro to generate a text file of XYZ points. This macro will export the XYZ points of all vertices in the model. This macro should work on pretty much any part file, whether it's been STL'd or not, but non-STL'd parts won't have nearly so many vertices.

Code:
Const OUTFILEPATH As String = "C:\OutTest.txt"

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim myBody As SldWorks.Body2
Dim myVertexArray As Variant
Dim myVertex As SldWorks.Vertex
Dim myBodyArray As Variant
Dim myBodyFolder As SldWorks.BodyFolder
Dim myFeature As SldWorks.Feature
Dim XYZ As Variant
Dim fso As Scripting.FileSystemObject
Dim OutFile As Scripting.TextStream
Dim i As Long
Dim j As Long
Sub main()

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set myFeature = swDoc.FirstFeature
Set fso = CreateObject("Scripting.FileSystemObject")
Set OutFile = fso.OpenTextFile(OUTFILEPATH, ForWriting, True)

While Not (myFeature Is Nothing)
    If (myFeature.GetTypeName = "SolidBodyFolder") Or _
            (myFeature.GetTypeName = "SurfaceBodyFolder") Or _
            (myFeature.GetTypeName = "CutListFolder") Or _
            (myFeature.GetTypeName = "SubWeldFolder") Or _
            (myFeature.GetTypeName = "SubAtomFolder") Then
        Set myBodyFolder = myFeature.GetSpecificFeature2
        If myBodyFolder.GetBodyCount > 0 Then
            myBodyArray = myBodyFolder.GetBodies
            For i = 0 To UBound(myBodyArray)
                Set myBody = myBodyArray(i)
                If myBody.GetVertexCount > 0 Then
                    myVertexArray = myBody.GetVertices
                    For j = 0 To UBound(myVertexArray)
                        Set myVertex = myVertexArray(j)
                        XYZ = myVertex.GetPoint
                        OutFile.WriteLine XYZ(0) & vbTab & XYZ(1) & vbTab & XYZ(2)
                    Next j
                End If
            Next i
        End If
    End If
    Set myFeature = myFeature.GetNextFeature
Wend
OutFile.Close
MsgBox "Point data output to:" & vbCrLf & vbCrLf & OUTFILEPATH
End Sub
 
Thanks... not sure exactly how useful it is, but it did strike me as a quick but interesting challenge to write, so I did. :) I'd say I've probably learned about as much about writing code for SW by looking at interesting questions posed here as I've learned by writing stuff for my own use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor