AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using AxDb15 Library to access Schedule Data

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
665 Views, 15 Replies

Using AxDb15 Library to access Schedule Data

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
15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: Anonymous

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
>
>
Message 3 of 16
Anonymous
in reply to: Anonymous

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
> >
> >
>
>
Message 4 of 16
Anonymous
in reply to: Anonymous

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
>> >
>> >
>>
>>
Message 5 of 16
Anonymous
in reply to: Anonymous

Hi Michael,

I'm using ADT 3.3; Win2000. Also, I've got a case open w/ Autodesk, ADN
support. If they come up with a solution I'll post it.

This is crucial to me because I'm writing a util to read data out of
facility drawings. If I resort to just opening the drawings in the editor a
process that takes minutes turns into a process that takes hours.

Trevor

"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
> >> >
> >> >
> >>
> >>
>
Message 6 of 16
Anonymous
in reply to: Anonymous

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
> >> >
> >> >
> >>
> >>
>
Message 7 of 16
Anonymous
in reply to: Anonymous

"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
> > >> >
> > >> >
> > >>
> > >>
> >
>
>
Message 8 of 16
Anonymous
in reply to: Anonymous

That bites!!
However, I only have several drawings to access. Probably 10 at the
most, but it sounds like opening the drawings isn't an option for you.
Perhaps you can export the data at the Save Event or something. Or
process the drawings in batch at night.


Trevor Taylor was heard to say:

> 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
>> >> >
>> >> >
>> >>
>> >>
>>
Message 9 of 16
Anonymous
in reply to: Anonymous

We'll just batch them at night and use the Windows Scheduler to set up a
regularly scheduled dump. It does bite though. This is my third major ADT
customization project in a row that has been "bitten" by some some weakness
or flaw in the ADT Schedule api.


"michael montagne" wrote in message
news:A9ED5F1EF5AE714F79D892E1C7217475@in.WebX.maYIadrTaRb...
> That bites!!
> However, I only have several drawings to access. Probably 10 at the
> most, but it sounds like opening the drawings isn't an option for you.
> Perhaps you can export the data at the Save Event or something. Or
> process the drawings in batch at night.
>
>
> Trevor Taylor was heard to say:
>
> > 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
> >> >> >
> >> >> >
> >> >>
> >> >>
> >>
>
Message 10 of 16
Anonymous
in reply to: Anonymous

Michael & Trevor:

Well,
The attached lisp routine will return a list of pairs: (roomname .
roomnumber). 3 things to consider: 1. You need to know which property set
the information is in - i.e. the first one, the second one, etc. - this will
become clear when you examine the dxf code of the extension dictionaries
attached to a space "entity". 2. You will need to know the dxf code of the
propsets - see above, and 3. I know it's not VBA, but it works. If this is
a "closed" routine, meaning you don't need to contend with a number of
different vars. then this might work.

Let me know if it was any use . . .

jb
Message 11 of 16
Anonymous
in reply to: Anonymous

Hi Trevor.

There is a logged defect in ADT 3.3 where the AecSchedulePropertySets.Item method crashes when passed any object that does not have
the Applicaton property set. Since you are iterating the objects through the AxDbDocument.ModelSpace collection, the application
object is nothing.

I've tried a few things, but the only work-around in ADT 3.3 is use the AcadDocument object from acad.tlb.

This defect is fixed in ADT 2004.

Jim Paquette
Autodesk, Inc.
Message 12 of 16
Anonymous
in reply to: Anonymous

That is great...no more dxf hacking or xreffing to
speed things up.

 

RLB


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi
Trevor.

There is a logged defect in ADT 3.3 where the
AecSchedulePropertySets.Item method crashes when passed any object that does
not have
the Applicaton property set. Since you are iterating the objects
through the AxDbDocument.ModelSpace collection, the application
object is
nothing.

I've tried a few things, but the only work-around in ADT 3.3
is use the AcadDocument object from acad.tlb.

This defect is fixed in
ADT 2004.

Jim Paquette
Autodesk,
Inc.

Message 13 of 16
Anonymous
in reply to: Anonymous

Jim,

This is terrific. Of all the ADT APIs that need to be bullet-proof, the
schedule API is most critical because it's the very one that will want to be
accessed externally so link drawing data to databases and other
applications.

I've just converted a client's extensive database of facilities drawings
(polylines & dumb blocks) to Areas and Schedule tags so that I can link room
usage to a database. By using the area objects their drawings will be much
smarter, more dependable, faster and easier to use. It's too bad it has to
take several hours to open all of the drawings just to get at that data, but
at least they CAN get their data now.

Thanks,

Trevor


"James Paquette (Autodesk)" wrote in message
news:F7DAF35D436A0B473CEE9D32302F94EE@in.WebX.maYIadrTaRb...
> Hi Trevor.
>
> There is a logged defect in ADT 3.3 where the AecSchedulePropertySets.Item
method crashes when passed any object that does not have
> the Applicaton property set. Since you are iterating the objects through
the AxDbDocument.ModelSpace collection, the application
> object is nothing.
>
> I've tried a few things, but the only work-around in ADT 3.3 is use the
AcadDocument object from acad.tlb.
>
> This defect is fixed in ADT 2004.
>
> Jim Paquette
> Autodesk, Inc.
>
>
Message 14 of 16
Anonymous
in reply to: Anonymous

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
> > > >> >
> > > >> >
> > > >>
> > > >>
> > >
> >
> >
>
>
Message 15 of 16
Anonymous
in reply to: Anonymous

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
> > > > >> >
> > > > >> >
> > > > >>
> > > > >>
> > > >
> > >
> > >
> >
> >
>
>
Message 16 of 16
Anonymous
in reply to: Anonymous

I can safely report that the ObjectDBX does work in ADT2004. Here is the
working code:
Remember to regsvr the libraries then change your calls to the AxDbdocument
and the schedule application getinterface to reflect the new progids. Can
someone check this against the shipping product? I haven't received mine
yet.

New Working Code below:

Sub GetPropSetVals()

'References: AutoCAD/ObjectDBX Common 16 Library
' AEC Schedule 4 Object Library
Dim axDoc As New AXDBLib.AxDbDocument
Dim time4, time3
time3 = Now
Set axDoc = Application.GetInterfaceObject("ObjectDBX.AxDbDocument.16")
axDoc.Open "F:\NewScheduleOverride\A-FP03-C.dwg"
time4 = Now
MsgBox "DBXDoc opened in " & Second(time4 - time3) & " seconds"
Dim myObject As Object
Dim object As AcadObject
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
Set SchedApp =
Application.GetInterfaceObject("AecX.AecScheduleApplication.4")
On Error Resume Next
For Each myObject In axDoc.ModelSpace
If TypeName(myObject) = "IAecArea" Then
count = count + 1
Set myArea = myObject
Set myObject = 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

Set axDoc = Nothing

End Sub


Richard Binning

"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
> > > > >> >
> > > > >> >
> > > > >>
> > > > >>
> > > >
> > >
> > >
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost