VB.NET SetXData (Variant datatypes)

VB.NET SetXData (Variant datatypes)

Anonymous
Not applicable
1,769 Views
4 Replies
Message 1 of 5

VB.NET SetXData (Variant datatypes)

Anonymous
Not applicable
Hi,

In using Vb.Net I'm looking to set X Data in VB.net but when I pass the data to AutoCAD I get an error telling me I have an invalid data type. I understand that AutoCAD does not yet support .Net, but is there anyway to code this so I can send my data in AutoCAD since it seems to be looking for a variant data type??


I also know there is the same issue with selection set filter types and values since they are variant data types as well.
If there are any solutions no matter how messy I would love to have one for a moderate sized project I'm in the middle of, I really don't want to port it into VB6.

-Thanks
Bob
0 Likes
1,770 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
The trick with passing DXF codes is to use an array of type short and an
array of type object. A VB Integer maps to .NET's System.Int16 (Short). The
AutoCAD wrapper assembly will take care of mapping your .NET objects to VB
Variants.

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com
http://vbxtender.sourceforge.net
0 Likes
Message 3 of 5

Anonymous
Not applicable
"Triston" wrote in message
news:f10461f.-1@WebX.maYIadrTaRb...
> Hi,
> In using Vb.Net I'm looking to set X Data in VB.net but when I pass the
data to AutoCAD I get an error telling me I have an invalid data type. I
understand that AutoCAD does not yet support .Net, but is there anyway to
code this so I can send my data in AutoCAD since it seems to be looking for
a variant data type??

In VB.NET, the 'Integer' type is 32 bits.

In earlier versions of VB, an Integer was 16 bits,
so in VB.NET, anywhere that you used 'Array of Integer'
in VB6, you need to use an array of short, or Int16

> I also know there is the same issue with selection set filter types and
values since they are variant data types as well.
> If there are any solutions no matter how messy I would love to have one
for a moderate sized project I'm in the middle of, I really don't want to
port it into VB6.

While this isn't going to help you with your current
needs, work is already underway here on a native CLR/.NET
version of the ObjectARX API, that completely eliminates
the need to use ActiveX. After looking at the internals of
the RCW COM wrappers generated by TLBIMP, it became clear
to me that ActiveX is simply not the way to go. The main
reason is because the RCW unconditionally sinks all events
exposed by the ActiveX server. So, for example, anytime you
have a variable typed as AcadDocumentClass, the wrapper is
handling *all* AcadDocumentEvents. While it only fires those
that you've subscribed to, it is still handling all of the
events fired by AcadDocument, including the three high-
frequency ones (ObjectAdded/Modified/Erased).

Unfortunately, that's a major problem for any interprocess
use of .NET.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Frank,

Woo Hoo! Thanks I will give it a try. I thought I was going to have to convert my whole project back to VB 6.

Been trying to research that one for a while now!

-Triston
0 Likes
Message 5 of 5

Anonymous
Not applicable
The preceding was an unpaid commercial advertisement and does not
necessarily reflect the views of this group or it's owners. We now return
you to our regularly scheduled broadcast.

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com
http://vbxtender.sourceforge.net
0 Likes