This is little VBA code to create a helix and I am hoping that someone out
there has more skill than me can help get this to work.
Thanks
Bruce
b*** snipped-for-privacy@sprint.ca remove the *'s to contact directly by email but I
would rather see any response posted to this group
Option Explicit
Public Sub calc1()
Dim points(200) As Integer
' ReDim points(1 To 10) As Integer
Dim x, y, z, h, t As Integer
Dim counter
t = 5
h = 24
For z = 1 To 36
Select Case t
Case t
I do VB to create DXF files so they can be loaded into either full ACAD or
LT.
I think the following code gives a passable helix based on straight lines in
3D space.
You may find it helpful.
Regards
The form has three inputs "number of rotations", "radius" and "pitch" and
two buttons "Create helix" and "EXIT"
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
Nr = Val(Text1.Text) 'number of rotations
Rad = Val(Text2.Text) 'radius of helix
Pt = Val(Text3.Text) 'pitch of helix
'use 5 deg increments
Inc = 360 / 5 'number if increments in a pitch
Zi = Pt / Inc 'position in Z axis
Itot = Nr * Inc ' total number of increments
X1 = Rad 'initial x
Y1 = 0 'initial y
Z1 = 0 'initial z
I = 1
dxfTempFile = "C:\tempHelix.dxf"
'dxfTempFile = GetTempFileName
FileNo = FreeFile
newCreateDXF.FileNo = FileNo 'passes FileNo to DXF module
Open dxfTempFile For Output As #FileNo
'Open dxfTempFile For Output As #1
Lay = "Helix"
Ltype = "Continuous"
Call dxfHeader(-Val(Text2.Text) - 1, -Val(Text2.Text) - 1, Val(Text2.Text) +
1, Val(Text2.Text) + 1)
Call dxfStartTables
Call dxfAddLayer(Lay, 1)
Call dxfEndLayerTable
Call dxfEndTables
Call dxfStartEntity
While I < (Itot + 1)
X2 = Val(Text2.Text) * Cos(I * 0.087266)
Y2 = Val(Text2.Text) * Sin(I * 0.087266)
Z2 = I * Zi
Call dxfAddLine(X1, Y1, Z1, X2, Y2, Z2, Lay, Ltype, 1)
X1 = X2
Y1 = Y2
Z1 = Z2
I = I + 1
Wend
Call dxfClose
Close #FileNo
End Sub
Private Sub Form_Load()
Text1.Text = "1"
Text2.Text = "1"
Text3.Text = "1"
End Sub
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.