Jump to content

Recommended Posts

Posted

After deciding to make use of dynamic attributed blocks, this has affected previous codes I had.

It appears dynamic blocks rename themselves and I have a code making use of a selection set which now doesn't work.

 

is there a way to alter this to use block effective names.

 

Hope someone can help, have attached the relevant part of my code.

 

Option Explicit

Sub BEWRef_Edit()
Dim intCode(1)              As Integer
Dim varData(1)              As Variant
Dim elem                    As AcadEntity
Dim bname                   As String
Dim oblkRef                 As AcadBlockReference
Dim oBlock                  As AcadBlock
Dim iCount As Integer
Dim TotalRef As Long
'Creates selection set of all Ref1_50 Blocks
intCode(0) = 0: varData(0) = "Insert"
intCode(1) = 2: varData(1) = "REF1_50"
'If None is Drawing - Exit
TotalRef = AllSS(intCode, varData)
   If TotalRef = 0 Then
       MsgBox ("There Are No References in Drg")
       Exit Sub
   End If
'Use selection set here

End Sub

Sub SSClear()
Dim SSS As AcadSelectionSets
  On Error Resume Next
  Set SSS = ThisDrawing.SelectionSets
     If SSS.count > 0 Then
        SSS.Item("TempSSet").Delete
     End If
End Sub

Function AllSS(Optional grpCode As Variant, Optional dataVal As Variant) As Integer
  Dim TempObjSS As AcadSelectionSet
  SSClear
  Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet")
        'pick selection set
  If IsMissing(grpCode) Then
     TempObjSS.Select acSelectionSetAll
  Else
     TempObjSS.Select acSelectionSetAll, , , grpCode, dataVal
  End If
  AllSS = TempObjSS.count
End Function

Posted

Change filter like this

 

intCode(0) = 0: varData(0) = "Insert"
intCode(1) = 2: varData(1) = "REF1_50,`*U*" 

 

Then loop trough selection set and process just blocks wich have effective name equal to "REF1_50"

 

~'J'~

Posted
Thanks for your time ! Cheers

You're welcome

Cheers :)

 

~'J'~

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...