converting Autocad bas to Inventor

converting Autocad bas to Inventor

Anonymous
Not applicable
493 Views
2 Replies
Message 1 of 3

converting Autocad bas to Inventor

Anonymous
Not applicable
What is the equivalent of ThisDrawing as used in AutoCAD

I have tried ThisDocument, and ThisApplication.ActiveDocument but they don't seem to
work

This is the line it hangs on with a Object doesn't support this property or method.

DlgName.hwndOwner = ThisDrawing.HWND


--
Kent Keller
http://kwik-mcad.scriptmania.com/
0 Likes
494 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi Kent,

The ThisDocument object only works in the macro "built in" to each document.

Inventor exposes windows handles a bit differently. The main IV window is
exposed through Inventor.Application.MainFrameHWND.

The handle to a particular IV window is exposed as a property of the View
(View.HWND). Because you can have multiple windows of the same document,
there is a views collection. The following simple macro prints out the
windows handle for the Inventor application and the first view of the
current document (using the ThisDocument object in that document's embedded
VBA project).


Public Sub Test()

Dim a As Inventor.Application
Dim b As Double

Set a = ThisApplication
Debug.Print a.MainFrameHWND
b = ThisDocument.Views(1).HWND
Debug.Print b

End Sub

Cheers,
Neil


"Kent Keller" wrote in message
news:ACEDCB121ED04AEF666D3DC621D88739@in.WebX.maYIadrTaRb...
> What is the equivalent of ThisDrawing as used in AutoCAD
>
> I have tried ThisDocument, and ThisApplication.ActiveDocument but they
don't seem to
> work
>
> This is the line it hangs on with a Object doesn't support this property
or method.
>
> DlgName.hwndOwner = ThisDrawing.HWND
>
>
> --
> Kent Keller
> http://kwik-mcad.scriptmania.com/
>
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks Neil

The MainFrameHWND appears to be what it needed.

--
Kent Keller
http://kwik-mcad.scriptmania.com/

"Neil Munro" wrote in message
news:CCDFE0A6F64DEAC51E921380423CFF7B@in.WebX.maYIadrTaRb...
> Hi Kent,
>
> The ThisDocument object only works in the macro "built in" to each document.
>
> Inventor exposes windows handles a bit differently. The main IV window is
> exposed through Inventor.Application.MainFrameHWND.
>
> The handle to a particular IV window is exposed as a property of the View
> (View.HWND). Because you can have multiple windows of the same document,
> there is a views collection. The following simple macro prints out the
> windows handle for the Inventor application and the first view of the
> current document (using the ThisDocument object in that document's embedded
> VBA project).
>
>
> Public Sub Test()
>
> Dim a As Inventor.Application
> Dim b As Double
>
> Set a = ThisApplication
> Debug.Print a.MainFrameHWND
> b = ThisDocument.Views(1).HWND
> Debug.Print b
>
> End Sub
>
> Cheers,
> Neil
>
>
> "Kent Keller" wrote in message
> news:ACEDCB121ED04AEF666D3DC621D88739@in.WebX.maYIadrTaRb...
> > What is the equivalent of ThisDrawing as used in AutoCAD
> >
> > I have tried ThisDocument, and ThisApplication.ActiveDocument but they
> don't seem to
> > work
> >
> > This is the line it hangs on with a Object doesn't support this property
> or method.
> >
> > DlgName.hwndOwner = ThisDrawing.HWND
> >
> >
> > --
> > Kent Keller
> > http://kwik-mcad.scriptmania.com/
> >
> >
> >
>
>
0 Likes