Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

modifying objects within a block problem.

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
0
0
US
I may be way off base on the code. here is what i am trying to do. i want to select only block objects on certain layers. the selection set portion works fine pretty basic. the problem is within the section where i want to manipulate the arcs and splines within the blocks. i want to change the lintype. below is the code and what i believe to be the problem area in red.
Code:
Sub ChBlockEntProp()
   Dim ssblocks As AcadSelectionSet
   Dim objBlock As AcadBlock
   Dim objCadEnt As AcadEntity
   Dim FilterType(3) As Integer
   Dim FilterData(3) As Variant
   Set ssblocks = ThisDrawing.SelectionSets.Add("SS4")
   FilterType(0) = -4
   FilterData(0) = "<or"
   FilterType(1) = 8
   FilterData(1) = "a-hist"
   FilterType(2) = 8
   FilterData(2) = "a-hist-2000"
   FilterType(3) = -4
   FilterData(3) = "or>"
   ssblocks.SelectOnScreen FilterType, FilterData
   [COLOR=red]For Each objBlock In ThisDrawing.SelectionSets [/color]
    For Each objCadEnt In objBlock
        With objCadEnt
            If .ObjectName = "AcDbArc" Or .ObjectName = "AcDbSpline" Then
                .Linetype = "Continuous"
            End If
        End With
    Next
Next
Set objCadEnt = Nothing
Set objBlock = Nothing
   ssblocks.Delete
End Sub
 
Hi vbcad,

In case you haven't figured it out yet...

The red line is indeed part of your problem, for two reasons:
[ol]
[li]In your explanation, you wanted to select only block objects change your select statement to look more like the one in faq687-5792 - you don't need to use the routine but you'll want the DXF codes to select only blocks. If you don't, just modify your loop to test for [purple]BlockReference[/purple] objects.[/li]
[li]You must loop through your selection set, not the drawing selection sets (see below).[/li]
[/ol]

This now gives you strictly [purple]BlockReferences[/purple] which is different than a [purple]Block.[/purple] Your code should be modified to look like this:
Code:
Dim objBlkRef as AcadBlockReference
...
...

For Each objBlkRef In [b][red]ssblocks[/red][/b]
  Set objBlock = Thisdrawing.Blocks(objBlRef.Name)
    For Each objCadEnt In objBlock
      ...

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top