I will try to give some general guidance on what might help.
Just so that you know this appears to be a fairly aggressive project.
You would most likely want to use code something like the following:
[code] in class module
Option Explicit
Private p_SSet As AcadSelectionSet
Private p_HasEntities As Boolean
Private p_Layer As AcadLayer
Private p_Dwg As AcadDocument
Private Sub Class_Initialize()
p_HasEntities = False
If Application.Documents.Count = 0 Then ' There are no open documents return an error
Err.Raise Number:=vbObjectError + 1, Source:="clsSet.Initialize", _
Description:="No Open Document"
Exit Sub
End If
p_Dwg = ThisDrawing
End Sub
Private Sub Class_Terminate()
p_SSet.Clear ' empty the set
p_SSet.Delete ' delete the set
End Sub
Public Property Get Layer() As AcadLayer
If p_HasEntities Then ' class has been loaded
Set Layer = p_Layer
Else
Set Layer = Null
End If
End Property
Public Property Set Layer(ByVal l_Layer As AcadLayer)
Set p_Layer = l_Layer ' set layer
LoadSet
End Property
Private Sub LoadSet()
Dim l_SSet As AcadSelectionSet
Dim SSFound As Boolean
Dim SSetName As String
Dim SSFilterType(0) As Integer
Dim SSFilterData(0) As Variant
If Not p_HasEntities Then Exit Sub
If ThisDrawing.SelectionSets.Count >= 128 Then ' There are more than 128 selection sets
return error
Err.Raise Number:=vbObjectError + 3, Source:="clsSet.LoadSet", _
Description:="Can not Create Selection Set 128 Already Exist"
End If
SSetName = "clsSet" ' Should be unique in your drawing
SSFound = False ' Start with no Selection Set Found
For Each l_SSet In p_Dwg.SelectionSets ' Parse Collection
If l_SSet.Name = SSetName Then ' Found a hit
SSFound = True ' Tell the rest of the program about it
Exit For ' Stop Parsing we found what we want
End If
Next l_SSet
If Not SSFound Then ' There is no selection set we want
Set l_SSet = ThisDrawing.SelectionSets.Add(SSetName) ' So Make it
End If
Set p_SSet = l_SSet ' Set to class varialbe
p_SSet.Clear ' Empty set first
SSFilterType(0) = 8 ' Filter on Entity Layer
SSFilterData(0) = p_Layer.Name ' Layer name to select
p_SSet.Select acSelectionSetAll, , , SSFilterType, SSFilterData ' Fill set with all
entities on layer
p_HasEntities = True ' tell the rest of the class we have enties
End Sub
Public Sub Move()
If Not p_HasEntities Then Exit Sub ' can work with an empty set
' Code to work with the entiteis in p_sset goes here
'
End Sub
[\code]
You can use this as a start.
Phil Custer, P.E.
Custer Services, Inc.
custer@landfillgas.com
On Thu, 18 Jan 2007 04:52:20 +0000, satyareddy <> wrote:
>thanks ..
>
>i am putting a pseudo code here...
>
>create a class named "clscar"
>
>copy the objects on a layer to the selection ssetcar.
>define the properties-set all the objects in the ssetcar to the property clscar.objs
>define methods like clscar.move , clscar .rotate.etc..
>
>now i defined a class..
>i now want to create an instance of the class car like
>dim objcar as new clscar.
>
>and access its properties and methods..
>like car.move..
>i hope atleast this time i am making some sense
>
>
>thanks in advance..
>Asty