Trevor, I ran into this same problem while trying to put together a demo
using Excel for our management. I wanted to show how our estimators could
access data inside our drawings via a user interface that was more suited to
them and not a trained CAD technician. I got around it by directly
accessing the extension dictionary attached to the object. The property
sets are a dictionary stored in the retrieved extension dictionary. I want
to say that it's named "AEC_SCHEDULE_PROPERTIES", but its been a very long
time since I wrote that code so check this. Because dictionaries hold
objects, at some point, once you get past the problem area, you can jump
back into using the schedule API and leave that nasty dictionary access
stuff behind.
I'll see if I can dig up the example code, although I'm thinking that I lost
it in a recent computer upgrade.
--
Bobby C. Jones
www.AcadX.com
"Trevor Taylor" wrote in message
news:FAB4CE30E4E7ACC358F830CAAF59DFBB@in.WebX.maYIadrTaRb...
> Good idea! Hadn't thought of XREFing. I'm going to try this. However,
the
> problem with these drawings is that they are bloated with so much
irrelevant
> data that they may take a while just to attach. ObjectDBX is ideal
because
> it just points to the database.
>
> Trevor
>
>
> "Richard Binning" wrote in message
> news:4B68FC6DBEDA01B92FBFCFEFA42603CC@in.WebX.maYIadrTaRb...
> >
> > "I went back and checked my code", he said wiping the egg off his face,
> "and
> > found that I had not been using the AxDb15 for schedule data just
regular
> > dictionary activity." However, I played with it this evening and I may
> have
> > found an alternative to batch processing it late at night.
> >
> > While looking at some schedule data code, I realized that I WAS able to
> > access the schedule property set data with no problems if I traversed
the
> > XrefDatabase. So, since an xref can be attached read and detached much
> > faster than that same file can be opened in AutoCAD, I put together the
> > following:
> >
> > (My tests indicate xref load times in the range of 2 seconds versus 10
> > seconds to open the same file)
> >
> > Sub GetPropSetValsXref()
> > On Error GoTo ERRORHANDLER
> >
> > ' Define external reference to be inserted
> > Dim acadobj As AcadObject
> > Dim xrefInserted As AcadExternalReference
> > Dim insertionPnt(0 To 2) As Double
> > Dim PathName As String
> > Dim tempBlock As AcadBlock
> > Dim myblock As AcadBlock
> > Dim myArea As AecArea
> > Dim SchedApp As AecScheduleApplication
> > Dim cPropSets As AecSchedulePropertySets
> > Dim PropSet As AecSchedulePropertySet
> > Dim cProps As AecScheduleProperties
> > Dim Prop As AecScheduleProperty
> > Dim count As Integer
> > Dim varTime1
> > Dim varTime2
> >
> > insertionPnt(0) = 1
> > insertionPnt(1) = 1
> > insertionPnt(2) = 0
> > PathName = "c:\temp\areas.dwg"
> >
> > ' Add the external reference
> > varTime1 = VBA.Now
> > Set xrefInserted = ThisDrawing.ModelSpace. _
> > AttachExternalReference(PathName, "XREF_IMAGE", _
> > insertionPnt, 1, 1, 1, 0, False)
> > varTime2 = VBA.Now
> > Debug.Print "The external reference is attached in " &
> Second(varTime2 -
> > varTime1) & " seconds" & vbCrLf
> > Set SchedApp =
> > Application.GetInterfaceObject("AecX.AecScheduleApplication")
> > Set myblock = ThisDrawing.Blocks("XREF_IMAGE")
> > For Each tempBlock In myblock.XRefDatabase.Blocks
> > For Each acadobj In tempBlock
> > If TypeName(acadobj) = "IAecArea" Then
> > count = count + 1
> > Set myArea = acadobj
> > Set acadobj = Nothing
> > Set cPropSets = SchedApp.PropertySets(myArea)
> > If (cPropSets.count > 0) Then
> > 'THE FOLLOWING LINE NO LONGER CRASHES:...
> > Set PropSet = cPropSets.Item("AecArea")
> > Set cProps = PropSet.Properties
> > Set Prop = cProps.Item("Number")
> > Debug.Print "Number: " & Prop.Value
> > End If
> > End If
> > Next acadobj
> > Next tempBlock
> > ' Detach the external reference definition since we don't need it
> > anymore
> > ThisDrawing.Blocks.Item("XREF_IMAGE").Detach
> > Debug.Print vbCrLf & "The external reference is detached."
> > Exit Sub
> > ERRORHANDLER:
> > MsgBox Err.Description
> > End Sub
> >
> >
> > Hope that Helps,
> >
> > RLB
> >
> > "Trevor Taylor" wrote in message
> > news:469F33A535870E35C920B1934F2635F7@in.WebX.maYIadrTaRb...
> > > The verdict is in:
> > >
> > > Our case reference: 871460 (Click to update or review)
> > > Title: Accessing AecSchedule Properties using Object DBX
> > > (AxDb15.dll)
> > >
> > >
> > > Dear Trevor,
> > >
> > > I have contacted our development team and asked about accessing
> > AecSchedule
> > > functionality from AxDb15. The answer is that it is not possible. It
> is
> > > available through ActiveXVBA object model for ADT. Sorry for the
> > > inconvenience this might be causing.
> > >
> > >
> > >
> > > "michael" wrote in message
> > > news:9DB5015202DC16C59731480FA6C82AFB@in.WebX.maYIadrTaRb...
> > > > Exactly the same problem here. Fatal error and some memory address
at
> > the
> > > > set= line. I'm using win98 and ADT3.0 right now so I'm hoping it
> works
> > > > netter on ADT3.3 and Win2000, I'll know that tomorrow. What are you
> > using
> > > > Trevor? There is a past thread similar to this that suggests it
will
> > work
> > > > (search for "dbx", but also suggests opening each drawing invisibly.
> > > > Surely not a speedy or elegant. I'll be watching this thread
closely
> > and
> > > > pposting my findings as well.
> > > >
> > > >
> > > >
> > > > On Sat, 08 Mar 2003 07:23:57 +0000, Trevor Taylor wrote:
> > > >
> > > > > I've tried the GetInterfaceObject function, but success eludes me.
> I
> > > know
> > > > > it must be something simple. I can't set an On Error statement
> > because
> > > no
> > > > > trappable error is generated. AutoCAD crashes as soon as I try to
> > > access an
> > > > > item in the PropertySets collection. Interestingly, when I put my
> > > > > PropertySets object (cPropSets) in the watch window I can see that
> the
> > > > > collection has no objects when I'm trying to access from
ObjectDBX,
> > even
> > > > > though a correct count property and "Owner" object is displayed.
If
> > not
> > > > > using ObjectDBX, there is an Item for each PropertySet attached to
> the
> > > > > object.
> > > > >
> > > > > "Richard binning" wrote in message
> > > > > news:C2E92520C3C1EE4A41F7236C9EBA1289@in.WebX.maYIadrTaRb...
> > > > >> I have used the ObjectDBX to access schedule data successfully.
I
> > > would
> > > > > try
> > > > >> setting On Error Resume Next prior to your set statement that
> > crashes,
> > > > > then
> > > > >> add a loop to check for error.
> > > > >> You're going to have to walk through this a line at a time to
find
> > the
> > > > >> answer.
> > > > >>
> > > > >> I'm pretty sure that you need to use VBScript syntax to get the
DBX
> > > > >> reference not VB syntax using New.
> > > > >>
> > > > >> Try this:
> > > > >> Dim axDoc As AXDB15Lib.AxDbDocument
> > > > >> Set axDoc =
> Application.GetInterfaceObject("ObjectDBX.AxDbDocument")
> > > > >>
> > > > >> then try the open method...
> > > > >>
> > > > >> Hope that helps,
> > > > >>
> > > > >> Richard Binning
> > > > >> THC
> > > > >>
> > > > >>
> > > > >>
> > > > >> "Trevor Taylor (IMAGINiT)" wrote in
message
> > > > >> news:C80FE88B14376FA22355143F1D56EC1A@in.WebX.maYIadrTaRb...
> > > > >> > Have any of you used the ObjectDBX library to access schedule
> data?
> > > I'm
> > > > >> not
> > > > >> > having much luck. Can anyone help me to see the light?
> > > > >> >
> > > > >> > My app crashes when I try to get the Propsets:
> > > > >> >
> > > > >> > Sub GetPropSetVals()
> > > > >> >
> > > > >> > 'References: ObjectDBX 1.0 Library
> > > > >> > ' AEC Schedule 3.3 Object Library
> > > > >> > Dim axDoc As New AXDB15Lib.AxDbDocument
> > > > >> >
> > > > >> > axDoc.Open "c:\temp\areas.dwg"
> > > > >> >
> > > > >> > Dim object As AcadObject
> > > > >> > Dim SchedApp As New AecScheduleApplication
> > > > >> > Dim cPropSets As AecSchedulePropertySets
> > > > >> > Dim PropSet As AecSchedulePropertySet
> > > > >> > Dim cProps As AecScheduleProperties
> > > > >> > Dim prop As AecScheduleProperty
> > > > >> > Dim count As Integer
> > > > >> >
> > > > >> > For Each object In axDoc.ModelSpace
> > > > >> > If TypeName(object) = "IAecArea" Then
> > > > >> > count = count + 1
> > > > >> > Set cPropSets = SchedApp.PropertySets(object)
> > > > >> >
> > > > >> > If (cPropSets.count > 0) Then
> > > > >> > 'THE FOLLOWING LINE CRASHES:...
> > > > >> > Set PropSet = cPropSets.Item("AecArea")
> > > > >> > Set cProps = PropSet.Properties
> > > > >> > Set prop = cProps.Item("Number")
> > > > >> > Debug.Print "Number: " & prop.Value
> > > > >> > End If
> > > > >> > End If
> > > > >> > Next
> > > > >> >
> > > > >> > Set axDoc = Nothing
> > > > >> >
> > > > >> > End Sub
> > > > >> >
> > > > >> > TIA,
> > > > >> >
> > > > >> > Trevor Taylor
> > > > >> >
> > > > >> >
> > > > >>
> > > > >>
> > > >
> > >
> > >
> >
> >
>
>