Author Topic: Stumped!! Need assistance with X-Data  (Read 1679 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 335
  • I exist therefore I am!
Stumped!! Need assistance with X-Data
« on: September 29, 2006, 10:50:18 AM »
I need some assistance with this example. (see attached CAD drawing).
In this drawing there is one (1) closed LWPolyline with some form of XDATA attached to it. I am unable to read or extract the XDATA.
Can any of you guys take a crack at this and see if you can read and/or extract the XDATA?

Many thanks,

Autocad 2002
« Last Edit: September 29, 2006, 12:10:23 PM by CAB »
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

T.Willey

  • Needs a day job
  • Posts: 5237
Re: Stumped!! Need assistance
« Reply #1 on: September 29, 2006, 11:08:55 AM »
Try this.
Code: [Select]
(defun MyGetXData (Obj DataName / CodeType DataType)
; Retrive XData for an object

(vla-GetXData
 Obj
 (if DataName
  DataName
  ""
 )
 'CodeType
 'DataType
)
(if (and CodeType DataType)
 (mapcar
  '(lambda (a b)
   (cons a (variant-value b))
  )
  (safearray-value CodeType)
  (safearray-value DataType)
 )
)
)
Called like
Code: [Select]
(mygetxdata (vlax-ename->vla-object (car (entsel))) nil)Returned
Quote
Select object: ((1001 . "IRD") (1002 . "{") (1000 . "WISDM-_-ade") (1070 . 515)
(1071 . 1) (1004 . #<safearray...>) (1004 . #<safearray...>) (1002 . "}"))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1542
  • Moscow (Russia)
Re: Stumped!! Need assistance
« Reply #2 on: September 29, 2006, 11:16:40 AM »
Code: [Select]
ENTITIES
  0
POLYLINE
  5
91
  8
ROOM-LWPOLYLINE
 66
     1
 10
0.0
 20
0.0
 30
0.0
 70
     1
1001
IRD
1002
{
1000
WISDM-_-ade
1070
   515
1071
        1
1004
01003000300030003000300000004F00500045004E0020004F004600460049004300450000004E006500770030003100000054004500530054003000300031000000300031000000540054004F0000003000310000004F004600460000003400350030002000530071002E002000460074002E000000310030003700340032
1004
003200380039003300360000000000
1002
}
  0
VERTEX
  5
AD
  8
ROOM-LWPOLYLINE
 10
311.54098400732602
 20
8.792169053929598
 30
0.0
  0
VERTEX
  5
AE
  8
ROOM-LWPOLYLINE
 10
311.54098400732602
 20
224.7921690539296
 30
0.0
  0
VERTEX
  5
AF
  8
ROOM-LWPOLYLINE
 10
11.540984007326029
 20
224.7921690539296
 30
0.0
  0
VERTEX
  5
B0
  8
ROOM-LWPOLYLINE
 10
11.540984007326029
 20
8.792169053929598
 30
0.0
  0
SEQEND
  5
B1
  8
ROOM-LWPOLYLINE
  0
VIEWPORT
  5
7B
 67
     1
  8
0
 10
4.7994580606775941
 20
4.0218994936605128
 30
0.0
 40
12.74104996238982
 41
8.9929997457669462
 68
     1
 69
     1
1001
ACAD
1000
MVIEW
1002
{
1070
    16
1010
0.0
1020
0.0
1030
0.0
1010
0.0
1020
0.0
1030
1.0
1040
0.0
1040
8.9929997457669462
1040
4.7994580606775941
1040
4.0218994936605128
1040
50.0
1040
0.0
1040
0.0
1070
     0
1070
   100
1070
     1
1070
     1
1070
     0
1070
     0
1070
     0
1070
     0
1040
0.0
1040
0.0
1040
0.0
1040
0.5
1040
0.5
1040
0.5
1040
0.5
1070
     0
1002
{
1002
}
1002
}
  0
Stay home. Stay safe. Save lives.

MP

  • Seagull
  • Posts: 17630
Re: Stumped!! Need assistance with X-Data
« Reply #3 on: September 30, 2006, 07:12:06 AM »
Using elist I get this --

(
   (-1 . <Entity name: 7ef63ec8>)
   (0 . "LWPOLYLINE")
   (330 . <Entity name: 7ef63cf8>)
   (5 . "91")
   (100 . "AcDbEntity")
   (67 . 0)
   (410 . "Model")
   (8 . "Room-LWPolyline")
   (100 . "AcDbPolyline")
   (90 . 4)
   (70 . 1)
   (43 . 0.0)
   (38 . 0.0)
   (39 . 0.0)
   (10 311.541 8.79217)
   (40 . 0.0)
   (41 . 0.0)
   (42 . 0.0)
   (10 311.541 224.792)
   (40 . 0.0)
   (41 . 0.0)
   (42 . 0.0)
   (10 11.541 224.792)
   (40 . 0.0)
   (41 . 0.0)
   (42 . 0.0)
   (10 11.541 8.79217)
   (40 . 0.0)
   (41 . 0.0)
   (42 . 0.0)
   (210 0.0 0.0 1.0)
   (-3
        (
            "IRD"
            (1002 . "{")
            (1000 . "WISDM-_-ade")
            (1070 . 515)
            (1071 . 1)
            (1004 . "010030003000300030003000000...")
            (1004 . "003200380039003300360000000000")
            (1002 . "}")
        )
    )

)


Note, I manually trimmed down the first 1004 group (ergo the ...) lest it spill off the page.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

FengK

  • Guest
Re: Stumped!! Need assistance with X-Data
« Reply #4 on: October 01, 2006, 04:35:07 AM »
Do you have express tool installed? If so, try using command XDLIST.

V-Man

  • Bull Frog
  • Posts: 335
  • I exist therefore I am!
Re: Stumped!! Need assistance with X-Data
« Reply #5 on: October 02, 2006, 07:40:05 AM »

Thanks for all of the replies fellas. I got kind of busy this weekend and could not respond.
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012