Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Making array of textboxes on draft in rectangle form

Status
Not open for further replies.

Sannie

Mechanical
Jun 2, 2003
11
Hi,
I've written as a beginner a program to make an array for textboxes on a draft. The user can give the X and Y as startpoint and the amount of textboxes.
Now is the problem that my loop isn't correct.
I want that the textboxes are placed in a rectangle form, so first A, then on the right B, then again A above A1, then again B above B1, etc
But he places them several times on each other!
Thanks already for the support.
------------------------------------------------------------
Option Explicit
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objApp As SolidEdgeFramework.Application
Dim objSheet As SolidEdgeDraft.Sheet
Dim objTxtbox As SolidEdgeFrameworkSupport.Textbox
Dim objTxtboxs As SolidEdgeFrameworkSupport.TextBoxes
Dim dblX As Double
Dim dblY As Double
Dim dblAantal As Double
Dim A As Integer
Dim B As Integer

Private Sub cmdOK_Click()

' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
On Error Resume Next
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
Err.Clear
Set objApp = CreateObject("SolidEdge.Application")
Set objDoc = objApp.Documents.Add("SolidEdge.DraftDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If

On Error GoTo 0
'get the Active Sheet object
Set objSheet = objDoc.ActiveSheet

Call Textbox
End Sub

------------------------------------------------------------
Private Sub Textbox()

Set objTxtboxs = objSheet.TextBoxes
For A = 0 To 1
dblX = CDbl(txtX.Text)
dblY = CDbl(txtY.Text)
dblAantal = CDbl(txtAantal.Text)
Set objTxtbox = objTxtboxs.AddByHtWdAng(dblX + 0.02 * A, dblY, 0, 0.05, 0, 0)
objTxtbox.Text = "Textbox"

For B = 0 To 1
dblX = CDbl(txtX.Text)
dblY = CDbl(txtY.Text)
dblAantal = CDbl(txtAantal.Text)
Set objTxtbox = objTxtboxs.AddByHtWdAng(dblX, dblY + 0.02 * B, 0, 0.05, 0, 0)
objTxtbox.Text = "Textbox"
Next B
Next A


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor