TheSwamp
Code Red => VB(A) => Topic started by: fxcastil on September 13, 2005, 05:35:32 PM
-
I have a drawing with multiple sheets (layout1-layout25.)
I am having problems creating a selection set of blocks on a specific layout.
I am using the AutoCad 2002 . I got the group filter code (410 layout names) from
an Autocad DXF reference manual. The filter code "410" is not working.
ReDim intFltrCode(2) As Integer
ReDim varFltrVal(6) As Variant
intFltrCode(0) = 0 : varFltrVal(0) = "INSERT" ' get simple block references
intFltrCode(1) = 2 : varFltrVal(1) = "BlockName" ' name of block to get
intFltrCode(2) = 410 : varFltrVal(3) = "Layout1" ' get blocks in layout1 only
' Fill selection set "selSetAll" with filtered data
objSelSet.Select Mode:=acSelectionSetAll, FilterType:=intFltrCode, FilterData:=varFltrVal
Does anyone know a way of creating a selection set of just blocks on a specific layout
using Lisp and the sendcommand ?
Fred C
-
I made a mistake in post the filter variables should have been as below in original post
The original question still applies
ReDim intFltrCode(2) As Integer
ReDim varFltrVal(2) As Variant
intFltrCode(0) = 0 : varFltrVal(0) = "INSERT" ' get simple block references
intFltrCode(1) = 2 : varFltrVal(1) = "BlockName" ' name of block to get
intFltrCode(2) = 410 : varFltrVal(2) = "Layout1" ' get blocks in layout1 only
Fred Castillo
-
Give up the 410 route...it doesn't work...even in Lisp.
I would suggest looping each layout's entities, that way if you come across your block you immediately know which layout it is on...or...create a filtered selection set for blocks, loop the selset and check the owner of the block reference, that way you can determine if it belongs to layout.
Here's another. You can reduce the number of places to look in your selection set by looking only at paperspace.
Here's an example:
Public Sub GrabPaperBlkRefs()
Dim iDxfCode(0 To 2) As Integer
Dim vDxfCodeVals(0 To 2) As Variant
Dim pSelSet As AcadSelectionSet
iDxfCode(0) = 0: vDxfCodeVals(0) = "INSERT"
iDxfCode(1) = 2: vDxfCodeVals(1) = "YourBlockNameGoesHere"
iDxfCode(2) = 67: vDxfCodeVals(2) = 1 ' Paperspace
Set pSelSet = ThisDrawing.PickfirstSelectionSet
pSelSet.Select acSelectionSetAll, , , iDxfCode, vDxfCodeVals
MsgBox "Block references found: " & pSelSet.Count, vbInformation, "Block Reference Count"
End Sub
Cheers,
Glenn.