.NET

Reply
Contributor
Posts: 19
Registered: ‎04-10-2009
Message 1 of 3 (228 Views)

cao.dbconnect, read labels from xref

228 Views, 2 Replies
02-02-2012 04:09 AM

Hi everybody...

I'm trying to read and update labels from Xrefs.

The meaning of it is to Reload all Labels in the Xrefs before I plot any Layout.

Autocad is working in SingleDrawing mode.

What do I have to do to bring xDB and dbConn together so I can "read/reload" the Labels?



Here is a snippet of my code (which doesn't work as expected) :smileysad:

Thank you for any kind of help.

(System: Win 7 64bit, Autocad 2012 64bit, VB express 2010)

 

Dim xDB As New Database(False, False)

xDB.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, False, "")

           

Dim acApp As Autodesk.AutoCAD.Interop.AcadApplication = DirectCast(Application.AcadApplication, Autodesk.AutoCAD.Interop.AcadApplication)

Dim acDoc As Autodesk.AutoCAD.Interop.AcadDocument = Application.DocumentManager.GetDocument(xDB).AcadDocument

           

Dim dbConn As CAO.DbConnect = acApp.GetInterfaceObject("CAO.DBConnect.16")

           

Dim lbls As CAO.LabelTemplates = dbConn.GetLabelTemplates()

           

Dim lnks As CAO.LinkTemplates = dbConn.GetLinkTemplates()



ADN Support Specialist
Posts: 288
Registered: ‎04-30-2009
Message 2 of 3 (224 Views)

Re: cao.dbconnect, read labels from xref

02-02-2012 05:12 AM in reply to: mendesva

What is the problem you are facing? Usually when creating Database to ReadDwgFile we use

 

Dim xDB As New Database(False, True)

 

Can you try that?

Regards,



Augusto Goncalves
Autodesk Developer Network
Contributor
Posts: 19
Registered: ‎04-10-2009
Message 3 of 3 (218 Views)

Re: cao.dbconnect, read labels from xref

02-02-2012 05:42 AM in reply to: augusto.goncalves

Thank you for your reply Augusto,

I tried both: Database(False, False) and Database(False, True)

 

I don't know where exactly the problem is. All I know is that this two lines of code don't bring any result.

Dim lbls As CAO.LabelTemplates = dbConn.GetLabelTemplates()

Dim lnks As CAO.LinkTemplates = dbConn.GetLinkTemplates()

lbls ans lkns are empty!

So I guess dbConn.GetLabelTemplates() doesn't read from acDoc.

What do I have to do/change so lbls and lnks represent the labels and links in my Xref?

Thanks

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community