Message 1 of 8
filter blocks

Not applicable
09-17-2008
05:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello guys,
I am lworking on a project that updates attributes. I have it working tcorrectly however I would like to modify a procedure so instead of filtering for 1 certain block, I would like it to search for another block if the first one is not found. I tried the if statement but it's not looking for the next block. I'm not at al familiar with filtering & group codes so I'm thinking maybe I'm missing some thing there. I currently have "Titleblock"
as the block to filter. If not found, I would like it to filter for TitlBlock2...and finally TitleBlock3. Could anyone point me in the right direction?
Code:
_____________________________
Private Sub UserForm_Initialize()
On Error Resume Next
ThisDrawing.SelectionSets("TBLK").Delete
Err.Clear
MultiPage1.Value = 0
Dim EntGrp(0) As Integer
Dim EntPrp(0) As Variant
Dim BlkObj As Object
Dim Pt1(0) As Double
Dim Pt2(0) As Double
'define error function
On Error GoTo Err_Control
'create a selection set
Set ssnew = ThisDrawing.SelectionSets.Add("TBLK")
'Filter for Group code 2, the block name
EntGrp(0) = 2
'The name of the block to filter for
'find the block
EntPrp(0) = "TitleBlock"
ssnew.Select acSelectionSetAll, Pt1, Pt2, EntGrp, EntPrp
'If a block is found
If ssnew.Count >= 1 Then
'Get the block's attributes
Tatts = ssnew.Item(0).GetAttributes
'display the attributes in the dialogue
formCop.TextBoxCntrNo1.Text = (LTrim(Tatts(0).TextString))
formCop.TextBoxContrName2.Text = (LTrim(Tatts(1).TextString))
formCop.TextBoxAddress3.Text = (LTrim(Tatts(2).TextString))
formCop.TextBoxAddress4.Text = (LTrim(Tatts(3).TextString))
formCop.TextBoxDrawnBy5.Text = (LTrim(Tatts(4).TextString))
formCop.TextBoxDate6.Text = (LTrim(Tatts(5).TextString))
formCop.TextBoxDwgTitle7.Text = (LTrim(Tatts(6).TextString))
formCop.TextBoxDwgNo8.Text = (LTrim(Tatts(7).TextString))
formCop.TextBoxType9.Text = (LTrim(Tatts(8).TextString))
formCop.TextBoxElevNo10.Text = (LTrim(Tatts(9).TextString))
formCop.TextBoxMachNo11.Text = (LTrim(Tatts(10).TextString))
formCop.TextBoxMainQty12.Text = (LTrim(Tatts(11).TextString))
formCop.TextBoxAuxQty13.Text = (LTrim(Tatts(12).TextString))
formCop.TextBoxRevNo14.Text = (LTrim(Tatts(13).TextString))
formCop.TextBoxRevDate15.Text = (LTrim(Tatts(14).TextString))
formCop.TextBoxRevInit16.Text = (LTrim(Tatts(15).TextString))
formCop.TextBoxRevDescr17.Text = (LTrim(Tatts(16).TextString))
formCop.TextBoxRevNo18.Text = (LTrim(Tatts(17).TextString))
formCop.TextBoxRevDate19.Text = (LTrim(Tatts(18).TextString))
formCop.TextBoxRevInit20.Text = (LTrim(Tatts(19).TextString))
formCop.TextBoxRevDescr21.Text = (LTrim(Tatts(20).TextString))
formCop.TextBoxRevNo22.Text = (LTrim(Tatts(21).TextString))
formCop.TextBoxRevDate23.Text = (LTrim(Tatts(22).TextString))
formCop.TextBoxRevInit24.Text = (LTrim(Tatts(23).TextString))
formCop.TextBoxRevDescr25.Text = (LTrim(Tatts(24).TextString))
formCop.TextBoxRevNo26.Text = (LTrim(Tatts(25).TextString))
formCop.TextBoxRevDate27.Text = (LTrim(Tatts(26).TextString))
formCop.TextBoxRevInit28.Text = (LTrim(Tatts(27).TextString))
formCop.TextBoxRevDescr29.Text = (LTrim(Tatts(28).TextString))
'turn to page 1
MultiPage1.Value = 0
'set the focus to TextBox1 and highlight the text
formCop.TextBoxCntrNo1.SetFocus
formCop.TextBoxCntrNo1.SelStart = 0
formCop.TextBoxCntrNo1.SelLength = Len(formCop.TextBoxCntrNo1.Text)
Else
'no attribute block, inform the user
MsgBox "No Title Block Attributes - Use Manual Edit..", vbCritical, "AfraLisp Title Block"
'delete the selection set
ThisDrawing.SelectionSets.Item("TBLK").Delete
End
End If
Exit Sub
Err_Control:
'disply error number and description
MsgBox Err.Number & " " & Err.Description
End
End Sub
_____________________________________________
I am lworking on a project that updates attributes. I have it working tcorrectly however I would like to modify a procedure so instead of filtering for 1 certain block, I would like it to search for another block if the first one is not found. I tried the if statement but it's not looking for the next block. I'm not at al familiar with filtering & group codes so I'm thinking maybe I'm missing some thing there. I currently have "Titleblock"
as the block to filter. If not found, I would like it to filter for TitlBlock2...and finally TitleBlock3. Could anyone point me in the right direction?
Code:
_____________________________
Private Sub UserForm_Initialize()
On Error Resume Next
ThisDrawing.SelectionSets("TBLK").Delete
Err.Clear
MultiPage1.Value = 0
Dim EntGrp(0) As Integer
Dim EntPrp(0) As Variant
Dim BlkObj As Object
Dim Pt1(0) As Double
Dim Pt2(0) As Double
'define error function
On Error GoTo Err_Control
'create a selection set
Set ssnew = ThisDrawing.SelectionSets.Add("TBLK")
'Filter for Group code 2, the block name
EntGrp(0) = 2
'The name of the block to filter for
'find the block
EntPrp(0) = "TitleBlock"
ssnew.Select acSelectionSetAll, Pt1, Pt2, EntGrp, EntPrp
'If a block is found
If ssnew.Count >= 1 Then
'Get the block's attributes
Tatts = ssnew.Item(0).GetAttributes
'display the attributes in the dialogue
formCop.TextBoxCntrNo1.Text = (LTrim(Tatts(0).TextString))
formCop.TextBoxContrName2.Text = (LTrim(Tatts(1).TextString))
formCop.TextBoxAddress3.Text = (LTrim(Tatts(2).TextString))
formCop.TextBoxAddress4.Text = (LTrim(Tatts(3).TextString))
formCop.TextBoxDrawnBy5.Text = (LTrim(Tatts(4).TextString))
formCop.TextBoxDate6.Text = (LTrim(Tatts(5).TextString))
formCop.TextBoxDwgTitle7.Text = (LTrim(Tatts(6).TextString))
formCop.TextBoxDwgNo8.Text = (LTrim(Tatts(7).TextString))
formCop.TextBoxType9.Text = (LTrim(Tatts(8).TextString))
formCop.TextBoxElevNo10.Text = (LTrim(Tatts(9).TextString))
formCop.TextBoxMachNo11.Text = (LTrim(Tatts(10).TextString))
formCop.TextBoxMainQty12.Text = (LTrim(Tatts(11).TextString))
formCop.TextBoxAuxQty13.Text = (LTrim(Tatts(12).TextString))
formCop.TextBoxRevNo14.Text = (LTrim(Tatts(13).TextString))
formCop.TextBoxRevDate15.Text = (LTrim(Tatts(14).TextString))
formCop.TextBoxRevInit16.Text = (LTrim(Tatts(15).TextString))
formCop.TextBoxRevDescr17.Text = (LTrim(Tatts(16).TextString))
formCop.TextBoxRevNo18.Text = (LTrim(Tatts(17).TextString))
formCop.TextBoxRevDate19.Text = (LTrim(Tatts(18).TextString))
formCop.TextBoxRevInit20.Text = (LTrim(Tatts(19).TextString))
formCop.TextBoxRevDescr21.Text = (LTrim(Tatts(20).TextString))
formCop.TextBoxRevNo22.Text = (LTrim(Tatts(21).TextString))
formCop.TextBoxRevDate23.Text = (LTrim(Tatts(22).TextString))
formCop.TextBoxRevInit24.Text = (LTrim(Tatts(23).TextString))
formCop.TextBoxRevDescr25.Text = (LTrim(Tatts(24).TextString))
formCop.TextBoxRevNo26.Text = (LTrim(Tatts(25).TextString))
formCop.TextBoxRevDate27.Text = (LTrim(Tatts(26).TextString))
formCop.TextBoxRevInit28.Text = (LTrim(Tatts(27).TextString))
formCop.TextBoxRevDescr29.Text = (LTrim(Tatts(28).TextString))
'turn to page 1
MultiPage1.Value = 0
'set the focus to TextBox1 and highlight the text
formCop.TextBoxCntrNo1.SetFocus
formCop.TextBoxCntrNo1.SelStart = 0
formCop.TextBoxCntrNo1.SelLength = Len(formCop.TextBoxCntrNo1.Text)
Else
'no attribute block, inform the user
MsgBox "No Title Block Attributes - Use Manual Edit..", vbCritical, "AfraLisp Title Block"
'delete the selection set
ThisDrawing.SelectionSets.Item("TBLK").Delete
End
End If
Exit Sub
Err_Control:
'disply error number and description
MsgBox Err.Number & " " & Err.Description
End
End Sub
_____________________________________________