McadApplication

McadApplication

Anonymous
Not applicable
425 Views
8 Replies
Message 1 of 9

McadApplication

Anonymous
Not applicable
I'm starting to play around with the mcad object model and I can't even get
off the ground.

VBA keeps stopping with "Problem in loading application"

heres the line of code that it stops on:
Set mapp = ThisDrawing.Application.GetInterfaceObject("Mcad.Application")

Any help would be great.
Michael Browne
0 Likes
426 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Which version of MDT are you working with, Michael?

--
Get free software and more at http://www2.stonemedia.com/~franko

"Michael Browne" wrote in message
news:874upt$fdb1@adesknews2.autodesk.com...
> I'm starting to play around with the mcad object model and I can't even
get
> off the ground.
>
> VBA keeps stopping with "Problem in loading application"
>
> heres the line of code that it stops on:
> Set mapp = ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
>
> Any help would be great.
> Michael Browne
>
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
Are you running the VBA code in an MDT session?

--
Get free software and more at http://www2.stonemedia.com/~franko

"Michael Browne" wrote in message
news:8750qc$fct4@adesknews2.autodesk.com...
> MDT4
>
> I've selected the references:
> BRepAuto
> GeAuto
> McadAuto
> SymBBAuto
>
> everything shows up in the object browser
>
> I hope you have some idea.
>
> Frank Oquendo wrote in message <874vft$f992@adesknews2.autodesk.com>...
> >Which version of MDT are you working with, Michael?
> >
> >--
> >Get free software and more at http://www2.stonemedia.com/~franko
> >
> >"Michael Browne" wrote in message
> >news:874upt$fdb1@adesknews2.autodesk.com...
> >> I'm starting to play around with the mcad object model and I can't even
> >get
> >> off the ground.
> >>
> >> VBA keeps stopping with "Problem in loading application"
> >>
> >> heres the line of code that it stops on:
> >> Set mapp =
ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
> >>
> >> Any help would be great.
> >> Michael Browne
> >>
> >>
> >
> >
>
>
0 Likes
Message 4 of 9

Anonymous
Not applicable
MDT4

I've selected the references:
BRepAuto
GeAuto
McadAuto
SymBBAuto

everything shows up in the object browser

I hope you have some idea.

Frank Oquendo wrote in message <874vft$f992@adesknews2.autodesk.com>...
>Which version of MDT are you working with, Michael?
>
>--
>Get free software and more at http://www2.stonemedia.com/~franko
>
>"Michael Browne" wrote in message
>news:874upt$fdb1@adesknews2.autodesk.com...
>> I'm starting to play around with the mcad object model and I can't even
>get
>> off the ground.
>>
>> VBA keeps stopping with "Problem in loading application"
>>
>> heres the line of code that it stops on:
>> Set mapp = ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
>>
>> Any help would be great.
>> Michael Browne
>>
>>
>
>
0 Likes
Message 5 of 9

Anonymous
Not applicable
Sounds like you might be missing some registry entries. Run the SETUP from
your CD and choose "Reset Registry"

--
Get free software and more at http://www2.stonemedia.com/~franko

"Michael Browne" wrote in message
news:875189$fed5@adesknews2.autodesk.com...
> Yes.
>
> I've copied some of the sample code from the help file but nothing loads
>
> Sub GetAttributes()
> Dim mapp As McadApplication
> Dim util As McadUtility
> Set mapp =
> ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
> Set util = mapp.ActiveDocument.Utility
>
> Dim pick As McadPick
> Set pick = util.pick("Select geometry", mcGeometry)
>
> Dim geom As IMcadGeometry
> Set geom = util.GetGeometryFromPick(mcGeometry, False, pick)
>
>
> Dim atts As McadAttributes
> Set atts = geom.GetAttributes
>
> Dim att As McadAttribute
> For Each att In atts
> Debug.Print "Attribute: " & att.ClassName
>
> Dim count As Long
> count = 0
> While count < att.FieldCount
> Debug.Print vbTab & "Field: " & att.FieldName(count) & vbTab &
> "type = " & att.FieldType(count)
> Dim val As Variant
> val = att.FieldValue(count)
> If IsArray(val) Then
> Dim item As Variant
> For Each item In val
> Debug.Print vbTab & vbTab & item
> Next
> Else
> Debug.Print vbTab & vbTab & val
>
> End If
>
> count = count + 1
> Wend
> Next
> End Sub
>
>
>
>
0 Likes
Message 6 of 9

Anonymous
Not applicable
Yes.

I've copied some of the sample code from the help file but nothing loads

Sub GetAttributes()
Dim mapp As McadApplication
Dim util As McadUtility
Set mapp =
ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
Set util = mapp.ActiveDocument.Utility

Dim pick As McadPick
Set pick = util.pick("Select geometry", mcGeometry)

Dim geom As IMcadGeometry
Set geom = util.GetGeometryFromPick(mcGeometry, False, pick)

Dim atts As McadAttributes
Set atts = geom.GetAttributes

Dim att As McadAttribute
For Each att In atts
Debug.Print "Attribute: " & att.ClassName

Dim count As Long
count = 0
While count < att.FieldCount
Debug.Print vbTab & "Field: " & att.FieldName(count) & vbTab &
"type = " & att.FieldType(count)
Dim val As Variant
val = att.FieldValue(count)
If IsArray(val) Then
Dim item As Variant
For Each item In val
Debug.Print vbTab & vbTab & item
Next
Else
Debug.Print vbTab & vbTab & val

End If

count = count + 1
Wend
Next
End Sub
0 Likes
Message 7 of 9

Anonymous
Not applicable
I think I found it!!

I ran the MDT SP2 which must have rewriten some entries. It did work prior.

So I re-ran the McadAutoReg.exe to re-register the McadAuto stuff and it
works know.

I have one last question for you Frank;
How do I know what to put with in the GetInterfaceObject("????.????")

Thanks for your help Frank,
Michael Browne

Frank Oquendo wrote in message <8751b9$fcu11@adesknews2.autodesk.com>...
>Sounds like you might be missing some registry entries. Run the SETUP from
>your CD and choose "Reset Registry"
>
>--
>Get free software and more at http://www2.stonemedia.com/~franko
>
>"Michael Browne" wrote in message
>news:875189$fed5@adesknews2.autodesk.com...
>> Yes.
>>
>> I've copied some of the sample code from the help file but nothing loads
>>
>> Sub GetAttributes()
>> Dim mapp As McadApplication
>> Dim util As McadUtility
>> Set mapp =
>> ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
>> Set util = mapp.ActiveDocument.Utility
>>
>> Dim pick As McadPick
>> Set pick = util.pick("Select geometry", mcGeometry)
>>
>> Dim geom As IMcadGeometry
>> Set geom = util.GetGeometryFromPick(mcGeometry, False, pick)
>>
>>
>> Dim atts As McadAttributes
>> Set atts = geom.GetAttributes
>>
>> Dim att As McadAttribute
>> For Each att In atts
>> Debug.Print "Attribute: " & att.ClassName
>>
>> Dim count As Long
>> count = 0
>> While count < att.FieldCount
>> Debug.Print vbTab & "Field: " & att.FieldName(count) & vbTab
&
>> "type = " & att.FieldType(count)
>> Dim val As Variant
>> val = att.FieldValue(count)
>> If IsArray(val) Then
>> Dim item As Variant
>> For Each item In val
>> Debug.Print vbTab & vbTab & item
>> Next
>> Else
>> Debug.Print vbTab & vbTab & val
>>
>> End If
>>
>> count = count + 1
>> Wend
>> Next
>> End Sub
>>
>>
>>
>>
>
>
0 Likes
Message 8 of 9

Anonymous
Not applicable
Here are the ProgIDs for the four top-level objects in the MDT object model.
If there's an error, I'm sure 3T will be along shortly to point it out.

MCAD.Application
SymBBAuto.McadSymbolManager
Brep.Application
Ge.Application

--
Get free software and more at http://www2.stonemedia.com/~franko

"Michael Browne" wrote in message
news:8751um$fcv8@adesknews2.autodesk.com...
> I think I found it!!
>
> I ran the MDT SP2 which must have rewriten some entries. It did work
prior.
>
> So I re-ran the McadAutoReg.exe to re-register the McadAuto stuff and it
> works know.
>
> I have one last question for you Frank;
> How do I know what to put with in the GetInterfaceObject("????.????")
>
> Thanks for your help Frank,
> Michael Browne
>
> Frank Oquendo wrote in message <8751b9$fcu11@adesknews2.autodesk.com>...
> >Sounds like you might be missing some registry entries. Run the SETUP
from
> >your CD and choose "Reset Registry"
> >
> >--
> >Get free software and more at http://www2.stonemedia.com/~franko
> >
> >"Michael Browne" wrote in message
> >news:875189$fed5@adesknews2.autodesk.com...
> >> Yes.
> >>
> >> I've copied some of the sample code from the help file but nothing
loads
> >>
> >> Sub GetAttributes()
> >> Dim mapp As McadApplication
> >> Dim util As McadUtility
> >> Set mapp =
> >> ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
> >> Set util = mapp.ActiveDocument.Utility
> >>
> >> Dim pick As McadPick
> >> Set pick = util.pick("Select geometry", mcGeometry)
> >>
> >> Dim geom As IMcadGeometry
> >> Set geom = util.GetGeometryFromPick(mcGeometry, False, pick)
> >>
> >>
> >> Dim atts As McadAttributes
> >> Set atts = geom.GetAttributes
> >>
> >> Dim att As McadAttribute
> >> For Each att In atts
> >> Debug.Print "Attribute: " & att.ClassName
> >>
> >> Dim count As Long
> >> count = 0
> >> While count < att.FieldCount
> >> Debug.Print vbTab & "Field: " & att.FieldName(count) &
vbTab
> &
> >> "type = " & att.FieldType(count)
> >> Dim val As Variant
> >> val = att.FieldValue(count)
> >> If IsArray(val) Then
> >> Dim item As Variant
> >> For Each item In val
> >> Debug.Print vbTab & vbTab & item
> >> Next
> >> Else
> >> Debug.Print vbTab & vbTab & val
> >>
> >> End If
> >>
> >> count = count + 1
> >> Wend
> >> Next
> >> End Sub
> >>
> >>
> >>
> >>
> >
> >
>
>
0 Likes
Message 9 of 9

Anonymous
Not applicable
Thanks for your help Frank. As always, much appreciated.

Frank Oquendo wrote in message <8752jd$fcu15@adesknews2.autodesk.com>...
>Here are the ProgIDs for the four top-level objects in the MDT object
model.
>If there's an error, I'm sure 3T will be along shortly to point it out.
>
>MCAD.Application
>SymBBAuto.McadSymbolManager
>Brep.Application
>Ge.Application
>
>--
>Get free software and more at http://www2.stonemedia.com/~franko
>
>"Michael Browne" wrote in message
>news:8751um$fcv8@adesknews2.autodesk.com...
>> I think I found it!!
>>
>> I ran the MDT SP2 which must have rewriten some entries. It did work
>prior.
>>
>> So I re-ran the McadAutoReg.exe to re-register the McadAuto stuff and it
>> works know.
>>
>> I have one last question for you Frank;
>> How do I know what to put with in the GetInterfaceObject("????.????")
>>
>> Thanks for your help Frank,
>> Michael Browne
>>
>> Frank Oquendo wrote in message <8751b9$fcu11@adesknews2.autodesk.com>...
>> >Sounds like you might be missing some registry entries. Run the SETUP
>from
>> >your CD and choose "Reset Registry"
>> >
>> >--
>> >Get free software and more at http://www2.stonemedia.com/~franko
>> >
>> >"Michael Browne" wrote in message
>> >news:875189$fed5@adesknews2.autodesk.com...
>> >> Yes.
>> >>
>> >> I've copied some of the sample code from the help file but nothing
>loads
>> >>
>> >> Sub GetAttributes()
>> >> Dim mapp As McadApplication
>> >> Dim util As McadUtility
>> >> Set mapp =
>> >> ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
>> >> Set util = mapp.ActiveDocument.Utility
>> >>
>> >> Dim pick As McadPick
>> >> Set pick = util.pick("Select geometry", mcGeometry)
>> >>
>> >> Dim geom As IMcadGeometry
>> >> Set geom = util.GetGeometryFromPick(mcGeometry, False, pick)
>> >>
>> >>
>> >> Dim atts As McadAttributes
>> >> Set atts = geom.GetAttributes
>> >>
>> >> Dim att As McadAttribute
>> >> For Each att In atts
>> >> Debug.Print "Attribute: " & att.ClassName
>> >>
>> >> Dim count As Long
>> >> count = 0
>> >> While count < att.FieldCount
>> >> Debug.Print vbTab & "Field: " & att.FieldName(count) &
>vbTab
>> &
>> >> "type = " & att.FieldType(count)
>> >> Dim val As Variant
>> >> val = att.FieldValue(count)
>> >> If IsArray(val) Then
>> >> Dim item As Variant
>> >> For Each item In val
>> >> Debug.Print vbTab & vbTab & item
>> >> Next
>> >> Else
>> >> Debug.Print vbTab & vbTab & val
>> >>
>> >> End If
>> >>
>> >> count = count + 1
>> >> Wend
>> >> Next
>> >> End Sub
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>
0 Likes