Get XYZ table out of SW into text or xcel file.

Would like to create a 3D sketch with points on it. Once those points are created, I need to know their exact position, in a text or Xcel file layout. if you click on each point it gives the location for each in the FMT.

Has anyone ever tried this?

T.I.A

Reply to
modelsin3d
Loading thread data ...

Yes. Its tedious(lots of typing), but it works great. Of course, the more points the better.

Best Regards, Devon T. Sowell

formatting link

Reply to
Devon T. Sowell

Merry Christmas Early!!!

Sub main() Dim swApp As SldWorks.SldWorks Dim doc As SldWorks.ModelDoc2 Dim part As SldWorks.PartDoc Dim sm As SldWorks.SelectionMgr Dim feat As SldWorks.feature Dim sketch As SldWorks.sketch Dim v As Variant Dim i As Long Dim sseg As SldWorks.SketchSegment Dim sline As SldWorks.SketchLine Dim sp As SldWorks.SketchPoint Dim ep As SldWorks.SketchPoint Dim s As String

Dim exApp As Excel.Application Dim sheet As Excel.Worksheet

Set exApp = New Excel.Application If Not exApp Is Nothing Then exApp.Visible = True If Not exApp Is Nothing Then exApp.Workbooks.Add Set sheet = exApp.ActiveSheet If Not sheet Is Nothing Then sheet.Cells(1, 2).Value = "X" sheet.Cells(1, 3).Value = "Y" sheet.Cells(1, 4).Value = "Z" End If End If End If

Set swApp = GetObject(, "sldworks.application") If Not swApp Is Nothing Then Set doc = swApp.ActiveDoc If Not doc Is Nothing Then If doc.GetType = swDocPART Then Set part = doc Set sm = doc.SelectionManager If Not part Is Nothing And Not sm Is Nothing Then If sm.GetSelectedObjectType2(1) = swSelSKETCHES Then Set feat = sm.GetSelectedObject4(1) Set sketch = feat.GetSpecificFeature If Not sketch Is Nothing Then v = sketch.GetSketchPoints For i = LBound(v) To UBound(v) Set sp = v(i) If Not sp Is Nothing And Not sheet Is Nothing And Not exApp Is Nothing Then 'sheet.Cells(2 + i, 1).Value = "Normal Vector " & i + 1 sheet.Cells(2 + i, 2).Value = (sp.X * 1000) / 25.4 sheet.Cells(2 + i, 3).Value = (sp.Y * 1000) / 25.4 sheet.Cells(2 + i, 4).Value = (sp.Z * 1000) / 25.4 exApp.Columns.AutoFit End If Next i End If End If End If End If End If End If End Sub

Reply to
Jeff

snipped-for-privacy@yahoo.com wrote in news:1142626659.606595.82630 @e56g2000cwe.googlegroups.com:

I haven't tried until just now... I don't know of a direct way to export sketch coordinates without a macro, so I tried this:

I made a new part with a 3DSketch containing 3 points, then exported it to IGES with the "Export sketch entities" option. IGES is a text-based format so you can read it in Notepad, or import it into Excel. If you do this to your part, you should find a group if lines in there beginining with "116". Presumably, "116" is some sort of point entity type. Anyhow, if you open it in Excel as a comma-separated file, you should get some junk you don't need plus this group of coordinates, in columns. With some formatting, you should have what you need.

Here's the text of hte IGES file I made, but automatic word-wrapping will make a mess of it:

SolidWorks IGES file using analytic representation for surfaces S

1 1H,,1H;,5HPart1,27HC:\0home\06\0TEMP\Part1.IGS,41HSolidWorks 2006 by SolG 1 idWorks Corporation,41HSolidWorks 2006 by SolidWorks Corporation,32, G 2 308,15,308,15,5HPart1,1.,2,2HMM,50,0.125,13H060317.155144,1E-008, G 3 499990.,5Hddunn,,11,0,13H060317.155144; G 4 116 1 0 0 0 00010000D 1 116 0 0 1 0 0D 2 116 2 0 0 0 00010000D 3 116 0 0 1 0 0D 4 116 3 0 0 0 00010000D 5 116 0 0 1 0 0D 6 402 4 0 0 0 00000000D 7 402 0 0 1 15 3DSKETCH 1D 8 314 5 0 0 0 00000200D 9 314 0 8 1 0 0D 10 116,-38.5039077,-25.138570044,0.,; 1P 1 116,-5.718830226,6.265679931,12.940825681,; 3P 2 116,42.672421923,10.123228977,0.,; 5P 3 402,3,1,3,5; 7P 4 314,75.2941176470588,75.2941176470588,75.2941176470588,; 9P 5 S 1G 4D 10P 5 T 1
Reply to
Dale Dunn

"Jeff" wrote in news:1142628653.159301.310760 @p10g2000cwp.googlegroups.com:

That's a lot better than my way...

Reply to
Dale Dunn

Thanks Jeff. Awesome!

Devon

Reply to
Devon T. Sowell

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.