Jump to content

Creating a specific selection set via vba - need help


dkiellor

Recommended Posts

Hey guys im new to this sort of thing and im having a little trouble. I am currently trying to put together a macro to export my titleblock info from all layout sheets to excel. i have found something very similar for the selection set but it only reads the modelspace. I cant seem to figure out why it only reads the modelspace either. is it part of the ThisDrawing.Utility variable? Is there anyway it could read all layouts in the drg?

Any help would be great.

Cheers

Dave

 

Here is the script i found earlier

 

Sub GetNamedInserts()

Dim entbref As AcadBlockReference

Dim TempObjSS As AcadSelectionSet

Dim intCode(2) As Integer

Dim varData(2) As Variant

Dim strName As String

 

strName = ThisDrawing.Utility.GetString(0, "titleblock: ")

SSInit

Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet")

intCode(0) = 0: varData(0) = "Insert"

intCode(1) = 67: varData(1) = 0

intCode(2) = 2: varData(2) = strName

TempObjSS.Select acSelectionSetAll, , , intCode, varData

MsgBox "There are " & TempObjSS.Count & " inserts referencing " & strName & " in Modelspace"

End Sub

 

Sub SSInit()

Dim SSS As AcadSelectionSets

Dim SS As AcadSelectionSet

Set SSS = ThisDrawing.SelectionSets

If SSS.Count > 0 Then

For Each SS In SSS

If SS.Name = "TempSSet" Then

SS.Delete

Exit For

End If

Next

End If

End Sub

Link to comment
Share on other sites

This setting "intCode(1) = 67: varData(1) = 0" restricts the selection process to ModelSpace only. To restict for Paperspace only it would be: "intCode(1) = 67: varData(1) = 1"

 

Depending on what will happen downstream, however, additional processing may be required to isolate a specific layout.

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