'===========================================================================
gbDebug = True
On Error Resume Next
If ThisDrawing.Dictionaries("IDALayers") Is Nothing Then
Set dicIDALayers = ThisDrawing.Dictionaries.Add("IDALayers")
On Error GoTo 0
Set laySprink = dicIDALayers.AddObject("sprink",
"AcDbLayerTableRecord")<===failure
MsgBox "Just made IDALayers dictionary!"
Exit Sub
End If
'===========================================================================
the error is "AcRxClassName entry is not in the system registry"
From the documentation it looks like perhaps dictionaries should only be
used for custom objects. Which explains the failure. If so, is there any
type of collection I can keep with the drawing to accomplish this?
Perhaps there is a way to access layers through the layer collection by some
sort of read-write key(other than the name) any ideas??
Albert
Tim Grote <TimG...@worldnet.att.net> wrote in message
news:7dlj3c$bh...@adesknews2.autodesk.com...
thanks for the tip, but now another question: How would I implement xrecords in
this fashion?
I have read the documentation in the help file on xrecords, but I'm still fairly
lost. Would I add one xrecord for each layer, or just to the layer table. Where
would I create this layer table?
For reference: I want to access a layer by something other than the name.
Whatever key I use, I would like it to be read write. Perhaps I could create
collection and imbed it in the drawing. This seems like it might cause a bit of
overhead though.
Thanks
Tim Grote
Here's some AutoCAD 2000 script that shows what I was suggesting. This
creates an xrecord in the named object dictionary that holds an array of
object ids. Object Ids of the layers.
Cheers,
Albert
Public Sub test()
Dim oDict As AcadDictionary
Set oDict = ThisDrawing.Dictionaries.Add("AsdkDict")
Dim oX As AcadXRecord
Set oX = oDict.AddXRecord("Layers")
Dim dtype() As Integer
Dim dvalue() As Variant
Dim nLayers As Integer
nLayers = ThisDrawing.Layers.Count()
ReDim dtype(nLayers)
ReDim dvalue(nLayers)
Dim oLayer As AcadLayer
Dim i As Integer
i = 0
For Each oLayer In ThisDrawing.Layers
dtype(i) = 1005
dvalue(i) = oLayer.Handle
i = i + 1
Next oLayer
oX.SetXRecordData dtype, dvalue
End Sub
AEI Staff <aeis...@aquaengr.com> wrote in message
news:36FFECE1...@aquaengr.com...