Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

xyz points (not curve)

Status
Not open for further replies.

macduff

Mechanical
Dec 7, 2003
1,255
Hi, how do I insert just points into SW. I'm not looking for curve though points. See attatched.

Colin Fitzpatrick (aka Macduff)
Mechanical Designer
Solidworks 2010 SP 5.0
Dell T5500 Windows 7 Pro (64-bit)
Xeon CPU 2.53 GHz 6.00 GB of RAM
nVida Quadro 4000 2 GB
3D Connexion-SpaceExplorer
 
Replies continue below

Recommended for you

Open a 3D sketch, select the sketch point, click, then use the 'Parameters' in the FM to place the point.

Jeff Mirisola
My Blog
 
Thanks Jeff, but I"m looking to import an excel file or text file with all the values. Trying to avoid doing this manually. I have other files than the one I uploaded.


Colin Fitzpatrick (aka Macduff)
Mechanical Designer
Solidworks 2010 SP 5.0
Dell T5500 Windows 7 Pro (64-bit)
Xeon CPU 2.53 GHz 6.00 GB of RAM
nVida Quadro 4000 2 GB
3D Connexion-SpaceExplorer
 
here is an Excel sheet that has sample code.
 
Sorry, I am having problems attaching the file. Here is the code though, you can see the API calls there, and set up your sheet in Excel. I'll try to still post the workbook later.

Option Explicit
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim RowNum As Integer
Dim XCoord As Double
Dim YCoord As Double
Dim ZCoord As Double
Private Sub cmdExportPoints_Click()
Set swApp = CreateObject("SldWorks.Application")


Set Part = swApp.ActiveDoc
'Part.Insert3DSketch

RowNum = ActiveCell.Row
XCoord = (Range("B" & RowNum) - Range("J2")) * 0.0254
YCoord = Range("C" & RowNum) * 0.0254
ZCoord = Range("D" & RowNum) * 0.0254

Part.CreatePoint2 XCoord, YCoord, ZCoord
If chkFixPt = True Then
Part.SketchAddConstraints "sgFIXED"
End If
Part.ClearSelection2 True
'Part.InsertSketch2 True
End Sub

Private Sub cmdMirrorPoint_Click()
Set swApp = CreateObject("SldWorks.Application")


Set Part = swApp.ActiveDoc
'Part.Insert3DSketch

RowNum = ActiveCell.Row
XCoord = ((Range("B" & RowNum) - Range("J2")) * (-1)) * 0.0254
YCoord = Range("C" & RowNum) * 0.0254
ZCoord = Range("D" & RowNum) * 0.0254

Part.CreatePoint2 XCoord, YCoord, ZCoord
If chkFixPt = True Then
Part.SketchAddConstraints "sgFIXED"
End If
Part.ClearSelection2 True
'Part.InsertSketch2 True
End Sub

Private Sub Create3dSketch_Click()

Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Part.Insert3DSketch
End Sub

Private Sub optFixPt_Click()

End Sub
 
CBL. the macro locks up on SW2012. At least on my machine. Let me look into Table Driven Patterns.

Grubs, let me try your code. Never did this before.

Thanks all!

Colin Fitzpatrick (aka Macduff)
Mechanical Designer
Solidworks 2010 SP 5.0
Dell T5500 Windows 7 Pro (64-bit)
Xeon CPU 2.53 GHz 6.00 GB of RAM
nVida Quadro 4000 2 GB
3D Connexion-SpaceExplorer
 
Hi macduff,
You are not going to be interested in all of the code, just the stuff like: Part.CreatePoint2 XCoord, YCoord, ZCoord . You can start a 3d sketch with: Part.Insert3DSketch .
 
Am I smelling Enhancement request?

Colin Fitzpatrick (aka Macduff)
Mechanical Designer
Solidworks 2010 SP 5.0
Dell T5500 Windows 7 Pro (64-bit)
Xeon CPU 2.53 GHz 6.00 GB of RAM
nVida Quadro 4000 2 GB
3D Connexion-SpaceExplorer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor