Hi doch das markieren geht geht aber das ist etwas hakelig.
http://ww3.cad.de/foren/ubb/Forum259/HTML/002111.shtml#000006Ich geb zu der code ist noch arg suboptimal. (Aus der Rubrik da wollt Thomas noch mal weiterstriocken)
Unter 64 bit muss noch etwas angepasst werden, ESC kann man nicht mehr über sendcommand schicken. :/ Application.update macht mitunter auch probleme.
Sub selection_set_activate_by_xdata(ByVal selectionset As AcadSelectionSet)
'to set the entitys active you has first usually to use the
'selectionset.select function
'otherwise the selectionset can not be activated
'ensure nothing is selectef
Application.UPDATE
' If SLOPEFORM.CURRENTGROUP.value = "" Then Exit Sub
Dim GROUP As AcadGroup
Dim Entity As AcadEntity
Dim HANDLE As Long
Dim xDataType() As Integer
Dim xDataValue() As Variant
ReDim xDataType(1)
ReDim xDataValue(1)
Dim XAPPNAME As String
'kill the last selection first
selection_previous_delete
'mark all entitys inside selectionset with a temporary xdata mark
XAPPNAME = "SEL"
xDataType(0) = 1001
xDataValue(0) = XAPPNAME
xDataType(1) = 1000
xDataValue(1) = "1"
For Each Entity In selectionset
Entity.SetXData xDataType, xDataValue
Next
Dim state As Object
'ensure acad is bored
Set state = GetAcadState
Do Until state.IsQuiescent
DoEvents
Set state = GetAcadState
Loop
'use a lisp function to select the desired xdata marked elements,
'cmd1 should be also possible with plain VBA just got the filter not created
CMD1 = Chr(27) & Chr(27) & "(setq #filter (ssget " & Chr(34) & "x" & Chr(34) & "'((-3 (" & Chr(34) & XAPPNAME & Chr(34) & ")))))" & vbCr
'activate last selectionset from cmd1
CMD2 = (Chr(27) & Chr(27) & "_PSELECT" & vbLf & "_P" & vbLf & vbCr)
s = CMD1 & CMD2
s = Replace(s, Chr(27), "")
On Error Resume Next
ThisDrawing.SendCommand s
'remove temporary xdata
ReDim Preserve xDataType(0)
ReDim Preserve xDataValue(0)
For Each Entity In selectionset
Entity.SetXData xDataType, xDataValue
Next
End Sub
Sub select_block_similar()
Dim Entity As AcadEntity
Dim blockref As AcadBlockReference
Dim bpname As String
Application.UPDATE
Selection_set_delete_all
Dim selectionset As AcadSelectionSet
Dim SSNAME As String
SSNAME = bpname & time()
Set selectionset = Selection_set_create(SSNAME)
bpname = "Betonschwelle"
For Each Entity In ThisDrawing.modelspace
If LCase(Entity.ObjectName) = "acdbblockreference" Then
Set blockref = Entity
If InStr(blockref.EffectiveName, bpname) > 0 Then
Call selectionset_add_entity(selectionset, Entity)
End If
End If
Next
Call selection_set_activate_by_xdata(selectionset)
End Sub
------------------
Wer es nicht versucht, hat schon verlorn 
Und bei 3 Typos gibts den vierten gratis !
<<< for sale !
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP