×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Making array of textboxes on draft in rectangle form

Making array of textboxes on draft in rectangle form

Making array of textboxes on draft in rectangle form

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources