Programming with Delphi or VB[A]

Programming with Delphi or VB[A]

Anonymous
Not applicable
281 Views
7 Replies
Message 1 of 8

Programming with Delphi or VB[A]

Anonymous
Not applicable
Thilo,

The 10x difference in performance is not due to language or compiling, but to
"in process" vs "cross process" automation. VBA runs in the same process space
as ACAD. Delphi (and VB) can, too. It involves making a DLL instead of an EXE. I
don't use Delphi, but this may point you in the right direction.

Mark Holder
0 Likes
282 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Dear everybody!
I've got a difficult question about using a programing language.
I want to write small programs in order to automate our design office. For
this I have to make a descision, which programing language I should use.
I've tested Borland Delphi 4.0 and VBA which is already included in AutoCAD
2000.
During my test phase I found huge differences in the runtime between these
language. Simmilar code needs in Delphi about 10 times more time than in
VBA. Normally I would say, that the compiled code of Delphi must be quicker
than the interpreted code from VBA.
So there is my question:
Is there anybody, who can help me solving this problem and give me
informations about getting the Delphi code quicker. I want to use the Delphi
code, because I like compiled code a little bit more than interpreted code.
I think one big problem in Delphi is the case, that I often call properties
from ACADobjects. For example the start or endpoints of ACADLines, the angle
or the length of these lines. Is it better to create a userdefined record
with this properties in it and go on working with this record. But in this
case there will be no binding between the record and the Acadobjects.

For your help I want to say tzhanks in advance

Thilo
0 Likes
Message 3 of 8

Anonymous
Not applicable
The difference in performance is not related to what language
you're using. The difference lies in the fact that your client
is not in the same process as AutoCAD, which means that it must
use OLE Marshalling and interprocess-communication, which is
what makes it so slow.

The best possible performance that I've seen aside from C++,
is with a Delphi in-process automation controller. To do this,
you must know how to build a Delphi ActiveX DLL that exposes
an Automation interface. Then, you can load the DLL into AutoCAD
by using a small VBA macro that calls GetInterfaceObject(). Once
your DLL is loaded, it can do anything it wants, and it will run
about 10x faster than the same code running in a standalone .EXE.

Visit my web site at the URL below for more info. You'll find an
example of an in-process client that runs faster than its VB or VBA counterparts.

Thilo Broeker wrote:
>
> Dear everybody!
> I've got a difficult question about using a programing language.
> I want to write small programs in order to automate our design office. For
> this I have to make a descision, which programing language I should use.
> I've tested Borland Delphi 4.0 and VBA which is already included in AutoCAD
> 2000.
> During my test phase I found huge differences in the runtime between these
> language. Simmilar code needs in Delphi about 10 times more time than in
> VBA. Normally I would say, that the compiled code of Delphi must be quicker
> than the interpreted code from VBA.
> So there is my question:
> Is there anybody, who can help me solving this problem and give me
> informations about getting the Delphi code quicker. I want to use the Delphi
> code, because I like compiled code a little bit more than interpreted code.
> I think one big problem in Delphi is the case, that I often call properties
> from ACADobjects. For example the start or endpoints of ACADLines, the angle
> or the length of these lines. Is it better to create a userdefined record
> with this properties in it and go on working with this record. But in this
> case there will be no binding between the record and the Acadobjects.
>
> For your help I want to say tzhanks in advance
>
> Thilo

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 4 of 8

Anonymous
Not applicable
Two follow up questions:
1. Can this be done this with a VB ActiveX DLL?
2. Can you show a modeless form in Acad by using this technique?

Thanks,
Toby

Tony Tanzillo wrote in message <380CAD54.12A48C76@worldnet.att.net>...
>The difference in performance is not related to what language
>you're using. The difference lies in the fact that your client
>is not in the same process as AutoCAD, which means that it must
>use OLE Marshalling and interprocess-communication, which is
>what makes it so slow.
>
>The best possible performance that I've seen aside from C++,
>is with a Delphi in-process automation controller. To do this,
>you must know how to build a Delphi ActiveX DLL that exposes
>an Automation interface. Then, you can load the DLL into AutoCAD
>by using a small VBA macro that calls GetInterfaceObject(). Once
>your DLL is loaded, it can do anything it wants, and it will run
>about 10x faster than the same code running in a standalone .EXE.
>
>Visit my web site at the URL below for more info. You'll find an
>example of an in-process client that runs faster than its VB or VBA
counterparts.
>
>Thilo Broeker wrote:
>>
>> Dear everybody!
>> I've got a difficult question about using a programing language.
>> I want to write small programs in order to automate our design office.
For
>> this I have to make a descision, which programing language I should use.
>> I've tested Borland Delphi 4.0 and VBA which is already included in
AutoCAD
>> 2000.
>> During my test phase I found huge differences in the runtime between
these
>> language. Simmilar code needs in Delphi about 10 times more time than in
>> VBA. Normally I would say, that the compiled code of Delphi must be
quicker
>> than the interpreted code from VBA.
>> So there is my question:
>> Is there anybody, who can help me solving this problem and give me
>> informations about getting the Delphi code quicker. I want to use the
Delphi
>> code, because I like compiled code a little bit more than interpreted
code.
>> I think one big problem in Delphi is the case, that I often call
properties
>> from ACADobjects. For example the start or endpoints of ACADLines, the
angle
>> or the length of these lines. Is it better to create a userdefined record
>> with this properties in it and go on working with this record. But in
this
>> case there will be no binding between the record and the Acadobjects.
>>
>> For your help I want to say tzhanks in advance
>>
>> Thilo
>
>--
>/*********************************************************/
>/* Tony Tanzillo Design Automation Consulting */
>/* Programming & Customization for AutoCAD & Compatibles */
>/* ----------------------------------------------------- */
>/* tony.tanzillo@worldnet.att.net */
>/* http://ourworld.compuserve.com/homepages/tonyt */
>/*********************************************************/
0 Likes
Message 5 of 8

Anonymous
Not applicable
Toby - Yes, and I don't know.

I'm not sure whether VB can display a modeless form in
AutoCAD (I seem to recall a problem there, but don't
know the precise details - Denis Gagne has something
that supposedly allows it somehow).

For modeless forms, I recommend Jorge's Dockable
container. It lets you display an ActiveX control
in a modeless/dockable window.

Toby Jutras wrote:
>
> Two follow up questions:
> 1. Can this be done this with a VB ActiveX DLL?
> 2. Can you show a modeless form in Acad by using this technique?
>
> Thanks,
> Toby
>
> Tony Tanzillo wrote in message <380CAD54.12A48C76@worldnet.att.net>...
> >The difference in performance is not related to what language
> >you're using. The difference lies in the fact that your client
> >is not in the same process as AutoCAD, which means that it must
> >use OLE Marshalling and interprocess-communication, which is
> >what makes it so slow.
> >
> >The best possible performance that I've seen aside from C++,
> >is with a Delphi in-process automation controller. To do this,
> >you must know how to build a Delphi ActiveX DLL that exposes
> >an Automation interface. Then, you can load the DLL into AutoCAD
> >by using a small VBA macro that calls GetInterfaceObject(). Once
> >your DLL is loaded, it can do anything it wants, and it will run
> >about 10x faster than the same code running in a standalone .EXE.
> >
> >Visit my web site at the URL below for more info. You'll find an
> >example of an in-process client that runs faster than its VB or VBA
> counterparts.
> >
> >Thilo Broeker wrote:
> >>
> >> Dear everybody!
> >> I've got a difficult question about using a programing language.
> >> I want to write small programs in order to automate our design office.
> For
> >> this I have to make a descision, which programing language I should use.
> >> I've tested Borland Delphi 4.0 and VBA which is already included in
> AutoCAD
> >> 2000.
> >> During my test phase I found huge differences in the runtime between
> these
> >> language. Simmilar code needs in Delphi about 10 times more time than in
> >> VBA. Normally I would say, that the compiled code of Delphi must be
> quicker
> >> than the interpreted code from VBA.
> >> So there is my question:
> >> Is there anybody, who can help me solving this problem and give me
> >> informations about getting the Delphi code quicker. I want to use the
> Delphi
> >> code, because I like compiled code a little bit more than interpreted
> code.
> >> I think one big problem in Delphi is the case, that I often call
> properties
> >> from ACADobjects. For example the start or endpoints of ACADLines, the
> angle
> >> or the length of these lines. Is it better to create a userdefined record
> >> with this properties in it and go on working with this record. But in
> this
> >> case there will be no binding between the record and the Acadobjects.
> >>
> >> For your help I want to say tzhanks in advance
> >>
> >> Thilo
> >
> >--
> >/*********************************************************/
> >/* Tony Tanzillo Design Automation Consulting */
> >/* Programming & Customization for AutoCAD & Compatibles */
> >/* ----------------------------------------------------- */
> >/* tony.tanzillo@worldnet.att.net */
> >/* http://ourworld.compuserve.com/homepages/tonyt */
> >/*********************************************************/

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 6 of 8

Anonymous
Not applicable
Tony-Toby,

A VB form cannot be shown in a process that does
not support communication with its corresponding
modeless window but this is possible with Delphi

As a workaround, I've experimented some Modeless
controls that I wrote using Win32 api functions or Delphi.
I've been using the Win32 technique for a while without
any problem in both R14 and A2K. I would have to spend
some time to ameliorate my subclassing procedure
before thinking of a large distribution.

Showing a modeless Window in A2K is easier and
can be achieved directly from the vba IDE. Although
this thechnique is not safe and easy of use compared
to an ocx.

I tried Jorge's container and it has real nice features.
It would be interesting if it was also built as a control
(that we could site on a VB/VBA form or a Delphi TForm)
instead of requiring ocx(es).

Denis

By the way, can we instantiate a new Dockable container
without using the command line?

Tony Tanzillo a écrit dans le message
<380CD210.FC06D98D@worldnet.att.net>...
>Toby - Yes, and I don't know.
>
>I'm not sure whether VB can display a modeless form in
>AutoCAD (I seem to recall a problem there, but don't
>know the precise details - Denis Gagne has something
>that supposedly allows it somehow).
>
>For modeless forms, I recommend Jorge's Dockable
>container. It lets you display an ActiveX control
>in a modeless/dockable window.
>
>Toby Jutras wrote:
>+>
>> Two follow up questions:
>> 1. Can this be done this with a VB ActiveX DLL?
>> 2. Can you show a modeless form in Acad by using this technique?
>>
>> Thanks,
>> Toby
>>
>> Tony Tanzillo wrote in message <380CAD54.12A48C76@worldnet.att.net>...
>> >The difference in performance is not related to what language
>> >you're using. The difference lies in the fact that your client
>> >is not in the same process as AutoCAD, which means that it must
>> >use OLE Marshalling and interprocess-communication, which is
>> >what makes it so slow.
>> >
>> >The best possible performance that I've seen aside from C++,
>> >is with a Delphi in-process automation controller. To do this,
>> >you must know how to build a Delphi ActiveX DLL that exposes
>> >an Automation interface. Then, you can load the DLL into AutoCAD
>> >by using a small VBA macro that calls GetInterfaceObject(). Once
>> >your DLL is loaded, it can do anything it wants, and it will run
>> >about 10x faster than the same code running in a standalone .EXE.
>> >
>> >Visit my web site at the URL below for more info. You'll find an
>> >example of an in-process client that runs faster than its VB or VBA
>> counterparts.
>> >
>> >Thilo Broeker wrote:
>> >>
>> >> Dear everybody!
>> >> I've got a difficult question about using a programing language.
>> >> I want to write small programs in order to automate our design office.
>> For
>> >> this I have to make a descision, which programing language I should
use.
>> >> I've tested Borland Delphi 4.0 and VBA which is already included in
>> AutoCAD
>> >> 2000.
>> >> During my test phase I found huge differences in the runtime between
>> these
>> >> language. Simmilar code needs in Delphi about 10 times more time than
in
>> >> VBA. Normally I would say, that the compiled code of Delphi must be
>> quicker
>> >> than the interpreted code from VBA.
>> >> So there is my question:
>> >> Is there anybody, who can help me solving this problem and give me
>> >> informations about getting the Delphi code quicker. I want to use the
>> Delphi
>> >> code, because I like compiled code a little bit more than interpreted
>> code.
>> >> I think one big problem in Delphi is the case, that I often call
>> properties
>> >> from ACADobjects. For example the start or endpoints of ACADLines, the
>> angle
>> >> or the length of these lines. Is it better to create a userdefined
record
>> >> with this properties in it and go on working with this record. But in
>> this
>> >> case there will be no binding between the record and the Acadobjects.
>> >>
>> >> For your help I want to say tzhanks in advance
>> >>
>> >> Thilo
>> >
>> >--
>> >/*********************************************************/
>> >/* Tony Tanzillo Design Automation Consulting */
>> >/* Programming & Customization for AutoCAD & Compatibles */
>> >/* ----------------------------------------------------- */
>> >/* tony.tanzillo@worldnet.att.net */
>> >/* http://ourworld.compuserve.com/homepages/tonyt */
>> >/*********************************************************/
>
>--
>/*********************************************************/
>/* Tony Tanzillo Design Automation Consulting */
>/* Programming & Customization for AutoCAD & Compatibles */
>/* ----------------------------------------------------- */
>/* tony.tanzillo@worldnet.att.net */
>/* http://ourworld.compuserve.com/homepages/tonyt */
>/*********************************************************/
0 Likes
Message 7 of 8

Anonymous
Not applicable
Denis - The dockable container can't be a control,
because it works by hosting a control.

You can use the AutoCAD.AcadDockableContainer
interface to manipulate the collection of
dockable containers.

There's a mailing list for AcadDockableContainer,
that you can subscribe to. See Jorge's recent post
for the details on subscribing.

Denis Gagne wrote:
>
> Tony-Toby,
>
> A VB form cannot be shown in a process that does
> not support communication with its corresponding
> modeless window but this is possible with Delphi
>
> As a workaround, I've experimented some Modeless
> controls that I wrote using Win32 api functions or Delphi.
> I've been using the Win32 technique for a while without
> any problem in both R14 and A2K. I would have to spend
> some time to ameliorate my subclassing procedure
> before thinking of a large distribution.
>
> Showing a modeless Window in A2K is easier and
> can be achieved directly from the vba IDE. Although
> this thechnique is not safe and easy of use compared
> to an ocx.
>
> I tried Jorge's container and it has real nice features.
> It would be interesting if it was also built as a control
> (that we could site on a VB/VBA form or a Delphi TForm)
> instead of requiring ocx(es).
>
> Denis
>
> By the way, can we instantiate a new Dockable container
> without using the command line?
>
> Tony Tanzillo a écrit dans le message
> <380CD210.FC06D98D@worldnet.att.net>...
> >Toby - Yes, and I don't know.
> >
> >I'm not sure whether VB can display a modeless form in
> >AutoCAD (I seem to recall a problem there, but don't
> >know the precise details - Denis Gagne has something
> >that supposedly allows it somehow).
> >
> >For modeless forms, I recommend Jorge's Dockable
> >container. It lets you display an ActiveX control
> >in a modeless/dockable window.
> >
> >Toby Jutras wrote:
> >+>
> >> Two follow up questions:
> >> 1. Can this be done this with a VB ActiveX DLL?
> >> 2. Can you show a modeless form in Acad by using this technique?
> >>
> >> Thanks,
> >> Toby
> >>
> >> Tony Tanzillo wrote in message <380CAD54.12A48C76@worldnet.att.net>...
> >> >The difference in performance is not related to what language
> >> >you're using. The difference lies in the fact that your client
> >> >is not in the same process as AutoCAD, which means that it must
> >> >use OLE Marshalling and interprocess-communication, which is
> >> >what makes it so slow.
> >> >
> >> >The best possible performance that I've seen aside from C++,
> >> >is with a Delphi in-process automation controller. To do this,
> >> >you must know how to build a Delphi ActiveX DLL that exposes
> >> >an Automation interface. Then, you can load the DLL into AutoCAD
> >> >by using a small VBA macro that calls GetInterfaceObject(). Once
> >> >your DLL is loaded, it can do anything it wants, and it will run
> >> >about 10x faster than the same code running in a standalone .EXE.
> >> >
> >> >Visit my web site at the URL below for more info. You'll find an
> >> >example of an in-process client that runs faster than its VB or VBA
> >> counterparts.
> >> >
> >> >Thilo Broeker wrote:
> >> >>
> >> >> Dear everybody!
> >> >> I've got a difficult question about using a programing language.
> >> >> I want to write small programs in order to automate our design office.
> >> For
> >> >> this I have to make a descision, which programing language I should
> use.
> >> >> I've tested Borland Delphi 4.0 and VBA which is already included in
> >> AutoCAD
> >> >> 2000.
> >> >> During my test phase I found huge differences in the runtime between
> >> these
> >> >> language. Simmilar code needs in Delphi about 10 times more time than
> in
> >> >> VBA. Normally I would say, that the compiled code of Delphi must be
> >> quicker
> >> >> than the interpreted code from VBA.
> >> >> So there is my question:
> >> >> Is there anybody, who can help me solving this problem and give me
> >> >> informations about getting the Delphi code quicker. I want to use the
> >> Delphi
> >> >> code, because I like compiled code a little bit more than interpreted
> >> code.
> >> >> I think one big problem in Delphi is the case, that I often call
> >> properties
> >> >> from ACADobjects. For example the start or endpoints of ACADLines, the
> >> angle
> >> >> or the length of these lines. Is it better to create a userdefined
> record
> >> >> with this properties in it and go on working with this record. But in
> >> this
> >> >> case there will be no binding between the record and the Acadobjects.
> >> >>
> >> >> For your help I want to say tzhanks in advance
> >> >>
> >> >> Thilo
> >> >
> >> >--
> >> >/*********************************************************/
> >> >/* Tony Tanzillo Design Automation Consulting */
> >> >/* Programming & Customization for AutoCAD & Compatibles */
> >> >/* ----------------------------------------------------- */
> >> >/* tony.tanzillo@worldnet.att.net */
> >> >/* http://ourworld.compuserve.com/homepages/tonyt */
> >> >/*********************************************************/
> >
> >--
> >/*********************************************************/
> >/* Tony Tanzillo Design Automation Consulting */
> >/* Programming & Customization for AutoCAD & Compatibles */
> >/* ----------------------------------------------------- */
> >/* tony.tanzillo@worldnet.att.net */
> >/* http://ourworld.compuserve.com/homepages/tonyt */
> >/*********************************************************/

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 8 of 8

Anonymous
Not applicable
At first I've to say thank you to everybody who helps me solving my problems
and give me some more points of view for my decision. Special thanks to Tony
Tanzillo and Mark Holder for their forwarding answers to my questions.

Thilo
0 Likes