TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: V-Man on September 29, 2006, 10:50:18 AM

Title: Stumped!! Need assistance with X-Data
Post by: V-Man 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
Title: Re: Stumped!! Need assistance
Post by: T.Willey 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 . "}"))
Title: Re: Stumped!! Need assistance
Post by: ElpanovEvgeniy 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
Title: Re: Stumped!! Need assistance with X-Data
Post by: MP on September 30, 2006, 07:12:06 AM
Using elist (http://groups.google.ca/group/autodesk.autocad.customization/tree/browse_frm/thread/2926e988f6e58ebd/1cdf2b29defed5ae?rnum=11&hl=en&q=defun+c%3Aelist+puckett&_done=%2Fgroup%2Fautodesk.autocad.customization%2Fbrowse_frm%2Fthread%2F2926e988f6e58ebd%2F881851c55f011f6e%3Flnk%3Dst%26q%3Ddefun+c%3Aelist+puckett%26rnum%3D2%26hl%3Den%26#doc_7083d73b42e905c4) 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.
Title: Re: Stumped!! Need assistance with X-Data
Post by: FengK on October 01, 2006, 04:35:07 AM
Do you have express tool installed? If so, try using command XDLIST.
Title: Re: Stumped!! Need assistance with X-Data
Post by: V-Man 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.