Message 1 of 9
Blocks on the same layer To group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
My script in VBA works perfect. Now i try to do the same with NET, but nothing happens.
here is the code:
Public Function CreateSelectionSet(ByVal SelectionSet As AcadSelectionSet, _
ByVal FilterCode As Integer, _
ByVal FilterValue As String) As Boolean
Dim iFilterCode(0) As Integer
Dim vFilterValue(0) As Object
iFilterCode(0) = FilterCode
vFilterValue(0) = FilterValue
SelectionSet.Select(AcSelect.acSelectionSetAll, , , iFilterCode, vFilterValue) '<-VB.NET
'SelectionSet.Select acSelectionSetAll, , , iFilterCode, vFilterValue '<- VBA
If SelectionSet.Count Then
CreateSelectionSet = True
End If
End Function
<Autodesk.AutoCAD.Runtime.CommandMethod("GROUPLAYER")> _
Public Sub GroupLayer()
On Error GoTo ErrTrap
Dim objEnts() As AcadEntity
Dim intIndex As Integer
Dim objGrp As AcadGroup
Dim LayerName As String
Dim oBlkRef As AcadBlockReference
Dim basePnt As Object
ThisDrawing.Utility.GetEntity(oBlkRef, basePnt, "Layer zu Gruppe -> Objekt wählen...")
LayerName = oBlkRef.Layer
Dim iType(0) As Integer
Dim objSS As AcadSelectionSet
iType(0) = 8
On Error Resume Next
'delete any previous selection set
ThisDrawing.SelectionSets("Entities").Delete()
'create our new selection set
objSS = ThisDrawing.SelectionSets.Add("Entities")
'get the actual entities for the selection set
CreateSelectionSet(objSS, iType(0), LayerName)
'Gruppe erstellen
ReDim objEnts(objSS.Count - 1)
For intIndex = LBound(objEnts) To UBound(objEnts)
objEnts(intIndex) = objSS(intIndex)
Next intIndex
objGrp = ThisDrawing.Groups.Add("*")
objGrp.AppendItems(objEnts)
ErrTrap:
Err.Clear()
End SubI can select something, but nothing happens...
where is the error?