Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem Attaching Object Data to Entities

25 views
Skip to first unread message

matt_1ca

unread,
Apr 1, 2005, 7:15:33 PM4/1/05
to
I have a program written in VB that reads a text file and pumps in the contents of that text file in a drawing.

The acadTexts that are created are attached by the program to an object data table. The program runs perfect on both AutoDesk Map 2004 and AutoDesk Map 2005.

Quite recently though I was asked to make it run on a new machine which has neither AutoDesk Map 2004 nor AutoDesk Map 2005. The only thing that is in that machine is AutoDesk Land Desktop 2005.

After testing the program in AutoDesk Land Desktop I ended up with this:
The program ran from start to end without issuing any errors. At first glance it would seem like everything is okay but if you really look at it -- it is not okay.

The reason why it is not okay is that all the entities pumped which normally should be attached to an object data table
now are not attached to any table at all i.e. they all seemed to have lost all their object data despite the fact that the program did not give any warning of any error.

My boss argues that what runs in AutoDesk Map 2004 and AutoDesk Map 2005 should run as well in AutoDesk Land Desktop as Land Desktop is "sitting on AutoDesk Map and AutoCAD". I know that what he is saying is true -- but in terms of nuts and bolt -- what in the world is happening -- does anyone know how I can tweak my code so that it will work with both AutoDesk Map and Land Desktop ?

Has anybody seen this problem before? Please guide me in anyway you can.

Thank you so much for all the kind help you can give.

Matt

Norman Yuan

unread,
Apr 2, 2005, 12:44:38 PM4/2/05
to
Iam not sure I can give you an answer, because I do not have Acad Land
Desktop. But your program must use AcadMAP speicific components to
create/access object data table. These components's interface is exposed
through AMVBAPI.tlb, so that you can set reference to it in your program, if
you use early bound. Does Acad Land Desktop comes with those Acad Map
components? or AcadMap and Acad Land Desktop share the same components on
object data table regard? On the Cad Land Desktop computer, start Acad->VBA
IDE->Menu Tools->References...", do you see "AcadMap" or "Autodesk Map 2004"
listed in the Refeences dialog box? It is intersting that no error is
raised. How do you do the error handling? If you used a lot "On Error Resume
Next", then you need reconsider the error handling logic to catch the
errors.

Maybe someone else, who know exactly whether Cad Land Desktop contains Acad
Map object data components or not, could give a straight Yes/No answer,
hopefully.

"matt_1ca" <nos...@address.withheld> wrote in message
news:6184877.111240096...@jiveforum1.autodesk.com...

Norman Yuan

unread,
Apr 2, 2005, 12:49:10 PM4/2/05
to
I just visited another NG (autodesk.map.general) and there is a post on
April 1st, 2005 with subject "Map vs Desktop". According to the posted
reply, my guess is correct, the object data table cannot be recognised by
Land Desktop.

"matt_1ca" <nos...@address.withheld> wrote in message
news:6184877.111240096...@jiveforum1.autodesk.com...

Jeff Mishler

unread,
Apr 2, 2005, 5:37:21 PM4/2/05
to
Hi Norman,
You have confused the 2 posts. Matt was asking about LAND Desktop, which is
built on top of Map, which means his code should work. The post you refer to
is inquiring about ARCHITECTURAL Desktop which does NOT use Map in any way.

--
Jeff
check out www.cadvault.com
"Norman Yuan" <Not...@NotReal.not> wrote in message
news:424edafe$1_2@newsprd01...

matt_1ca

unread,
Apr 3, 2005, 10:56:13 AM4/3/05
to
Hello Norman,

Thanks for your answer.

> if you use early bound. Does Acad Land Desktop comes
>with those Acad Map components?

The very first program version of the Map 2005/2004 compatible program that I built crashed everytime I ran it in Land Desktop 2005. It crashed right at the very start when my program tries to link to the drawing and so did not really do anything.

'---- Start of old connection code ----------
On Error Resume Next
Err.Clear
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then 'need to create object
Set acadApp = CreateObject("AutoCAD.Application")
End If

acadApp.Visible = True
Set ThisDrawing = acadApp.ActiveDocument

acadApp.WindowState = acMax
ThisDrawing.WindowState = acMax

Set amP = ThisDrawing.Application.GetInterfaceObject("autocadmap.application.2")

End If

'------ End old connection code

The error that is generated when I run my Exe is something like application ~ failed . So I tried to use late binding for the AutocadMap connection portion(s) and when I did all of a sudden the program run from start to finish without issuing any error at all.

The way I have revised the old connection so that it got rid of crashing is as shown below:

On Error Resume Next
Err.Clear
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then 'need to create object
Set acadApp = CreateObject("AutoCAD.Application")
End If

acadApp.Visible = True
Set ThisDrawing = acadApp.ActiveDocument

acadApp.WindowState = acMax
ThisDrawing.WindowState = acMax

Err.Clear
Set amP = ThisDrawing.Application.GetInterfaceObject("autocadmap.application.2")
If Err Then 'the version of autocadmap is not 2004
Set amP = ThisDrawing.Application.GetInterfaceObject("autocadmap.application.3")
End If

At first when you are running said program in Land Desktop you would be tempted to be happy seeing that the program now runs about 2 to 3 times faster than it does in Map 2004/2005 -- it turns out though that the reason is because it does not attach any object data to the created text at all.
And so is really a reason to be sad.

As would be the typical flow for this type of program steps are:

1. Create the odtable to hold data if it does not exist yet
2. Pump and name acadtext into the drawing
3. Use AttachTo method on created acadtext in step 2 to
attach said text in the odtable

Looks like the program executes without any problems only step 2 in the above pseudocode, thus the increased execution speed and fails but does not report anything for step 1 and 3.

Matt

matt_1ca

unread,
Apr 7, 2005, 8:48:46 PM4/7/05
to
Well actually at least this is what I thought initially but now it turns out that unless the program has an Autodesk Map 2004 in the References, the program will fail and will not attach object data to the text entities created by the program.

I realized this when I found out that all the machines where my program runs either has both AutoCAD Map 2004 and AutoCAD Map 2005 or just AutoCAD Map 2004.

Today, the company bought 3 additional new machines, installed AutoCAD Map 2005 in them (i.e no AutoCAD Map 2004) and when I run the program in those new machines the program fails like it does for AutoCAD LandDesktop 2005 i.e. the program does not attach data to the acadtexts for those three new machines.

To me it is starting to look like a versioning issue and I would appreciate very much ideas you might have in this regard.

Matt

0 new messages