X Data

X Data

Anonymous
Not applicable
438 Views
5 Replies
Message 1 of 6

X Data

Anonymous
Not applicable
Can anyone point me to example of how to get and set xdata in vba?...

Thanks,
Jade
0 Likes
439 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Checkout the SetXData and GetXData methods
in the AutoCAD help files.

Joe

"Jade Jacobsen" wrote in message
news:[email protected]...
> Can anyone point me to example of how to get and set xdata in vba?...
>
> Thanks,
> Jade
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
No topic available... Im using AutoCAD 2002 if that matters.
I have found the code I was needing though. Pretty slick.
Thanks,
Jade
"Joe Sutphin" wrote in message
news:[email protected]...
> Checkout the SetXData and GetXData methods
> in the AutoCAD help files.
>
> Joe
>
> "Jade Jacobsen" wrote in message
> news:[email protected]...
> > Can anyone point me to example of how to get and set xdata in vba?...
> >
> > Thanks,
> > Jade
> >
> >
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
Help From HELP file:

Sub Example_GetXData()
' This example creates a line and attaches extended data to that line.

' Create the line
Dim lineObj As AcadLine
Dim startPt(0 To 2) As Double, endPt(0 To 2) As Double
startPt(0) = 1#: startPt(1) = 1#: startPt(2) = 0#
endPt(0) = 5#: endPt(1) = 5#: endPt(2) = 0#
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)

ZoomAll

' Initialize all the xdata values. Note that first data in the list
should be
' application name and first datatype code should be 1001
Dim DataType(0 To 9) As Integer
Dim Data(0 To 9) As Variant
Dim reals3(0 To 2) As Double
Dim worldPos(0 To 2) As Double

DataType(0) = 1001: Data(0) = "Test_Application"

DataType(1) = 1000: Data(1) = "This is a test for xdata"

DataType(2) = 1003: Data(2) = "0" ' layer
DataType(3) = 1040: Data(3) = 1.23479137438413E+40 ' real
DataType(4) = 1041: Data(4) = 1237324938 ' distance
DataType(5) = 1070: Data(5) = 32767 ' 16 bit Integer
DataType(6) = 1071: Data(6) = 32767 ' 32 bit Integer

DataType(7) = 1042: Data(7) = 10 ' scaleFactor

reals3(0) = -2.95: reals3(1) = 100: reals3(2) = -20
DataType(8) = 1010: Data(8) = reals3 ' real

worldPos(0) = 4: worldPos(1) = 400.99999999: worldPos(2) = 2.798989
DataType(9) = 1011: Data(9) = worldPos ' world space
position


' Attach the xdata to the line
lineObj.SetXData DataType, Data

' Return the xdata for the line
Dim xdataOut As Variant
Dim xtypeOut As Variant
lineObj.GetXData "", xtypeOut, xdataOut

End Sub

"Jade Jacobsen" ?????
news:[email protected]...
> No topic available... Im using AutoCAD 2002 if that matters.
> I have found the code I was needing though. Pretty slick.
> Thanks,
> Jade
> "Joe Sutphin" wrote in message
> news:[email protected]...
> > Checkout the SetXData and GetXData methods
> > in the AutoCAD help files.
> >
> > Joe
> >
> > "Jade Jacobsen" wrote in message
> > news:[email protected]...
> > > Can anyone point me to example of how to get and set xdata in vba?...
> > >
> > > Thanks,
> > > Jade
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thank You
Jade
"Arno Weng" wrote in message
news:[email protected]...
> Help From HELP file:
>
> Sub Example_GetXData()
> ' This example creates a line and attaches extended data to that line.
>
> ' Create the line
> Dim lineObj As AcadLine
> Dim startPt(0 To 2) As Double, endPt(0 To 2) As Double
> startPt(0) = 1#: startPt(1) = 1#: startPt(2) = 0#
> endPt(0) = 5#: endPt(1) = 5#: endPt(2) = 0#
> Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)
>
> ZoomAll
>
> ' Initialize all the xdata values. Note that first data in the list
> should be
> ' application name and first datatype code should be 1001
> Dim DataType(0 To 9) As Integer
> Dim Data(0 To 9) As Variant
> Dim reals3(0 To 2) As Double
> Dim worldPos(0 To 2) As Double
>
> DataType(0) = 1001: Data(0) = "Test_Application"
>
> DataType(1) = 1000: Data(1) = "This is a test for xdata"
>
> DataType(2) = 1003: Data(2) = "0" ' layer
> DataType(3) = 1040: Data(3) = 1.23479137438413E+40 ' real
> DataType(4) = 1041: Data(4) = 1237324938 ' distance
> DataType(5) = 1070: Data(5) = 32767 ' 16 bit Integer
> DataType(6) = 1071: Data(6) = 32767 ' 32 bit Integer
>
> DataType(7) = 1042: Data(7) = 10 ' scaleFactor
>
> reals3(0) = -2.95: reals3(1) = 100: reals3(2) = -20
> DataType(8) = 1010: Data(8) = reals3 ' real
>
> worldPos(0) = 4: worldPos(1) = 400.99999999: worldPos(2) = 2.798989
> DataType(9) = 1011: Data(9) = worldPos ' world space
> position
>
>
> ' Attach the xdata to the line
> lineObj.SetXData DataType, Data
>
> ' Return the xdata for the line
> Dim xdataOut As Variant
> Dim xtypeOut As Variant
> lineObj.GetXData "", xtypeOut, xdataOut
>
> End Sub
>
> "Jade Jacobsen" ?????
> news:[email protected]...
> > No topic available... Im using AutoCAD 2002 if that matters.
> > I have found the code I was needing though. Pretty slick.
> > Thanks,
> > Jade
> > "Joe Sutphin" wrote in message
> > news:[email protected]...
> > > Checkout the SetXData and GetXData methods
> > > in the AutoCAD help files.
> > >
> > > Joe
> > >
> > > "Jade Jacobsen" wrote in message
> > > news:[email protected]...
> > > > Can anyone point me to example of how to get and set xdata in
vba?...
> > > >
> > > > Thanks,
> > > > Jade
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
when I list the xdata on the object this is what I get. Im guessing thats
why I cant retrieve any values back...

* Registered Application Name: TEST
* Code 1000, ASCII string: TABLE_ID
* Code 1071, 32-bit signed long integer: 1
* Code 1071, 32-bit signed long integer: 80001
* Code 1070, 16-bit integer: 5; error: An error has occurred inside the
*error*
functionno function definition: ACET-STR-FORMAT

Why do I get the error???

"Arno Weng" wrote in message
news:[email protected]...
> Help From HELP file:
>
> Sub Example_GetXData()
> ' This example creates a line and attaches extended data to that line.
>
> ' Create the line
> Dim lineObj As AcadLine
> Dim startPt(0 To 2) As Double, endPt(0 To 2) As Double
> startPt(0) = 1#: startPt(1) = 1#: startPt(2) = 0#
> endPt(0) = 5#: endPt(1) = 5#: endPt(2) = 0#
> Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)
>
> ZoomAll
>
> ' Initialize all the xdata values. Note that first data in the list
> should be
> ' application name and first datatype code should be 1001
> Dim DataType(0 To 9) As Integer
> Dim Data(0 To 9) As Variant
> Dim reals3(0 To 2) As Double
> Dim worldPos(0 To 2) As Double
>
> DataType(0) = 1001: Data(0) = "Test_Application"
>
> DataType(1) = 1000: Data(1) = "This is a test for xdata"
>
> DataType(2) = 1003: Data(2) = "0" ' layer
> DataType(3) = 1040: Data(3) = 1.23479137438413E+40 ' real
> DataType(4) = 1041: Data(4) = 1237324938 ' distance
> DataType(5) = 1070: Data(5) = 32767 ' 16 bit Integer
> DataType(6) = 1071: Data(6) = 32767 ' 32 bit Integer
>
> DataType(7) = 1042: Data(7) = 10 ' scaleFactor
>
> reals3(0) = -2.95: reals3(1) = 100: reals3(2) = -20
> DataType(8) = 1010: Data(8) = reals3 ' real
>
> worldPos(0) = 4: worldPos(1) = 400.99999999: worldPos(2) = 2.798989
> DataType(9) = 1011: Data(9) = worldPos ' world space
> position
>
>
> ' Attach the xdata to the line
> lineObj.SetXData DataType, Data
>
> ' Return the xdata for the line
> Dim xdataOut As Variant
> Dim xtypeOut As Variant
> lineObj.GetXData "", xtypeOut, xdataOut
>
> End Sub
>
> "Jade Jacobsen" ?????
> news:[email protected]...
> > No topic available... Im using AutoCAD 2002 if that matters.
> > I have found the code I was needing though. Pretty slick.
> > Thanks,
> > Jade
> > "Joe Sutphin" wrote in message
> > news:[email protected]...
> > > Checkout the SetXData and GetXData methods
> > > in the AutoCAD help files.
> > >
> > > Joe
> > >
> > > "Jade Jacobsen" wrote in message
> > > news:[email protected]...
> > > > Can anyone point me to example of how to get and set xdata in
vba?...
> > > >
> > > > Thanks,
> > > > Jade
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes