help with ahalf done vba routine

help with ahalf done vba routine

Anonymous
Not applicable
297 Views
6 Replies
Message 1 of 7

help with ahalf done vba routine

Anonymous
Not applicable
I have asked this question before i know but i really need some help. I have ahalf finished project which i need to complete ASAP. If any one is willing to help please let me know and i will let you know further details
0 Likes
298 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
OK, shoot! :-))
PS: How soon you need to finish it?
0 Likes
Message 3 of 7

Anonymous
Not applicable
thanks for your response i would like to finish within a fortnight if possible. i have enclosed an explanation of what i want to achieve
0 Likes
Message 4 of 7

Anonymous
Not applicable
Can you send what you work from now?(.dvb and an example drawing).
I'm lost at this point:
"These are the steps required
1. user selects either 12.7 or 15.2 (option btn 1 or "
...but if I have the project I can better figure out.
0 Likes
Message 5 of 7

Anonymous
Not applicable
try this
0 Likes
Message 6 of 7

Anonymous
Not applicable
I saw (very quickly, I admit) that all data management is made in userform.
1. Pressing "GO" button insert a block in the drawing.
This is the part where you need help, ie let the user to input a rotation angle?
Public Function InsertTendonIdBlock() As AcadBlockReference
' Insert the block, creating a block reference
' and an attribute reference
Dim blockRefObj As AcadBlockReference
Dim inspt As Variant
inspt = ThisDrawing.Utility.GetPoint(, "select insertion point: ")
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
(inspt, "cable", 1#, 1#, 1#, 0)
Set InsertTendonIdBlock = blockRefObj

End Function 'there is no rotation here - should be?

2. Managing attributes is the problem? Making them visible\invisible, filling with data, etc???
Otherwise, the program seem to be very close to be finished.
0 Likes
Message 7 of 7

Anonymous
Not applicable
I think is better to declare Public Sub CreatingTendonId() as a function. In this way you do not permit to any user to run this independent from VBA Manager. This can cause very bad results in the entire drawing, by redefining the definition of the block and duplicating, etc, all attributes and component entities.
And to insert in this Sub, in line 3:
For Each BLOCKOBJ In ThisDrawing.Blocks
If BLOCKOBJ.Name = "cable" Then Exit Sub
Next BLOCKOBJ
In this case, we can modify this:
Private Sub CommandButton1_Click()
'Dim objlayer As ACAD_LAYER
'Dim objCurrentLayer As ACAD_LAYER
Dim objtemp As AcadBlock
Dim objblock As AcadBlockReference
Dim varatts As Variant
If TextBox2.Text = " " Then
MsgBox "you need to select strand size"
Else
Me.Hide
'Err.Clear
'Set objtemp = ThisDrawing.Blocks("cable")
'If Err.Number <> 0 Then
CreatingTendonId
'Set objtemp = ThisDrawing.Blocks("cable")
'Err.Clear
'End If

Set objblock = InsertTendonIdBlock
varatts = objblock.GetAttributes
On Error Resume Next
varatts(0).TextString = TextBox1.Text
varatts(1).TextString = ListBox1.Text
varatts(2).TextString = TextBox2.Text
varatts(3).TextString = TextBox3.Text
varatts(4).TextString = TextBox4.Text
'varatts(5).TextString =
'varatts(6).TextString =
varatts(7).TextString = lenTextBox.value
'varatts(8).TextString = OptionButton1.Text
'ThisDrawing.ActiveLayer = objCurrentLayer
End If
objblock.Update
lenTextBox.value = LengthOfTendon
If lenTextBox.value = 0# Then Exit Sub
Me.Show
End Sub
0 Likes