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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter for objects only in model space?

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
US
below is some code that selects objects that are on a specific layer. What code do I need to add for selecting only model space objects? I tried to use a set command to reference model space but this did not work. Any help is appreciated. I also want to take the model space selection set and create a block from the objects. Would i need to check the block table for the block if it exists in the drawing?

Sub scalebar()
Dim sstext As AcadSelectionSet
Dim entObj As AcadEntity
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
Dim mode As Integer
mode = acSelectionSetAll
Set sstext = ThisDrawing.SelectionSets.Add("SS2")
FilterType(0) = 8
FilterData(0) = "G-TTLB-PLBK"
sstext.Select mode, , , FilterType, FilterData
sstext.Delete
End Sub
 
Can I asak you what version of Autocad you are running?
 
here is the revised code. works now

Sub scalebar()
Dim sstext As AcadSelectionSet
Dim entObj As AcadEntity
Dim filtertype(1) As Integer
Dim FilterData(1) As Variant
Dim mode As Integer
mode = acSelectionSetAll
Set sstext = ThisDrawing.SelectionSets.Add("SS2")
filtertype(0) = 8
filtertype(1) = 67
FilterData(0) = "G-TTLB-PLBK"
FilterData(1) = "0"
sstext.Select mode, , , filtertype, FilterData
sstext.Delete
End Sub
 
I would like to create a block named "scalebar" from the selection set. i know i need to check for the block name before creating the block. If the block exists how do i handle any errors encountered with the block creation? The block will always be inserted at 0,0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top