Getting current LDDT project

Getting current LDDT project

Anonymous
Not applicable
183 Views
4 Replies
Message 1 of 5

Getting current LDDT project

Anonymous
Not applicable
Does anyone out there, who is using LDDT2i, know how to get the current
project into a textbox? I want to take the current project that is shown at
the top of LDDT and put it into a textbox to record plots. The following
code works in VBA but does not work in VB6. Does anyone have a method that
does work?

Dim proj As String
proj = AeccApplication.ActiveProject.Name
TextBox1.Text = proj

Thanks for any help,
Jason Stevens
0 Likes
184 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi Jason,

This works for me in VB6 with references set to AutoCAD2000 and AutoCADLand:

Set appAcad = GetObject(, "AutoCAD.Application.15")
Set ldd = appAcad.GetInterfaceObject("Aecc.Application")
TEXTBOX=ldd.ActiveProject.Name

Bud Miller
www.BudCAD.com

"Jason Stevens" wrote in message
news:735913368D94B86D7A06A5DE954686DD@in.WebX.SaUCah8kaAW...
> Does anyone out there, who is using LDDT2i, know how to get the current
> project into a textbox? I want to take the current project that is shown
at
> the top of LDDT and put it into a textbox to record plots. The following
> code works in VBA but does not work in VB6. Does anyone have a method
that
> does work?
>
> Dim proj As String
> proj = AeccApplication.ActiveProject.Name
> TextBox1.Text = proj
>
> Thanks for any help,
> Jason Stevens
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Sorry,

Use ldd.path for the entire path

Bud

"Jason Stevens" wrote in message
news:735913368D94B86D7A06A5DE954686DD@in.WebX.SaUCah8kaAW...
> Does anyone out there, who is using LDDT2i, know how to get the current
> project into a textbox? I want to take the current project that is shown
at
> the top of LDDT and put it into a textbox to record plots. The following
> code works in VBA but does not work in VB6. Does anyone have a method
that
> does work?
>
> Dim proj As String
> proj = AeccApplication.ActiveProject.Name
> TextBox1.Text = proj
>
> Thanks for any help,
> Jason Stevens
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
That works great. Thank you very much.

Jason

Bud Miller wrote in message
news:BB85FF4F1D97163590CEF299CF115B59@in.WebX.SaUCah8kaAW...
> Sorry,
>
> Use ldd.path for the entire path
>
> Bud
>
> "Jason Stevens" wrote in message
> news:735913368D94B86D7A06A5DE954686DD@in.WebX.SaUCah8kaAW...
> > Does anyone out there, who is using LDDT2i, know how to get the current
> > project into a textbox? I want to take the current project that is
shown
> at
> > the top of LDDT and put it into a textbox to record plots. The
following
> > code works in VBA but does not work in VB6. Does anyone have a method
> that
> > does work?
> >
> > Dim proj As String
> > proj = AeccApplication.ActiveProject.Name
> > TextBox1.Text = proj
> >
> > Thanks for any help,
> > Jason Stevens
> >
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
This works great, now I am trying to fix it so if the drawing is not
associated with a project it will display a message saying so before it runs
my program. The problem is that when I run the VB program it causes a Fatal
Error when it tries to set ldd because the drawing is not associated with a
project. How would I check to make sure the drawing is associated with a
project without crashing LDDT2i?

Dim appAcad As Object
Dim ldd As Object

'On Error Resume Next
Set appAcad = GetObject(, "AutoCAD.Application.15")
Set ldd = appAcad.GetInterfaceObject("Aecc.Application")

If ldd.ActiveProject.Name = "" Then
MsgBox "Drawing is not associated with a project", vbOKOnly
TextBox1.Text = "No Project"
Exit Sub
Else
TextBox1.Text = ldd.ActiveProject.Name
End If

Thanks,
Jason

Bud Miller wrote in message
news:BB85FF4F1D97163590CEF299CF115B59@in.WebX.SaUCah8kaAW...
> Sorry,
>
> Use ldd.path for the entire path
>
> Bud
>
> "Jason Stevens" wrote in message
> news:735913368D94B86D7A06A5DE954686DD@in.WebX.SaUCah8kaAW...
> > Does anyone out there, who is using LDDT2i, know how to get the current
> > project into a textbox? I want to take the current project that is
shown
> at
> > the top of LDDT and put it into a textbox to record plots. The
following
> > code works in VBA but does not work in VB6. Does anyone have a method
> that
> > does work?
> >
> > Dim proj As String
> > proj = AeccApplication.ActiveProject.Name
> > TextBox1.Text = proj
> >
> > Thanks for any help,
> > Jason Stevens
> >
>
0 Likes