Jump to content

Using VBA to window crossing to erase objects.


muck

Recommended Posts

  • 3 weeks later...

I use selection set

 

Dim Block As AcadBlockReference
For Each Paperino In ThisDrawing.SelectionSets
    If Paperino.name = "BOM" Then
       ThisDrawing.SelectionSets("BOM").Delete
    Exit For
    End If
 Next
Dim PT1(0 To 2) As Double
Dim PT2(0 To 2) As Double
 PT1(0) = 0#   'X
 PT1(1) = 0#   'Y
 PT1(2) = 0#   'Z
 
 PT2(0) = 170# 'X1
 PT2(1) = 260# 'Y1
 PT2(2) = 0# '  Z1
 
 GC(0) = 0
 GC(1) = 2
 GV(0) = "INSERT"
 '---------------------------------------------------
 'Revise the block name "tendnum1" for your application
   GV(1) = "$Conf*"
 intCode(0) = 0: 
 intCode(1) = 2: 
 '---------------------------------------------------
 ThisDrawing.SelectionSets.Add ("BOM")
 Set Ssnew = ThisDrawing.SelectionSets("BOM")
 Ssnew.Select acSelectionSetCrossing, PT2, PT1, intCode, GV
 
 For Each Entity In Ssnew
       Set Block = Entity
       BlockName = Block.name
       If Left$(BlockName, 5) = "$Conf" Then
       Block.Delete
next

Link to comment
Share on other sites

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...