xrecords and types of data

Jason Piercey

Usenet Archive
Joined
Jun 30, 2003
Messages
868
Reaction score
0
Seems that the following works fine for strings, but not for anything else.

; creates an array
; [arrayType] - symbol, type of array. (vlax-vbinteger, vlax-vbstring, etc...) ; [dataTypes] - list, list of data ; return: safearray or nil ; example: (createArray vlax-vbinteger '(1 2 3)) (defun createArray (arrayType dataTypes / res) (if (setq res (vlax-safearray-fill (vlax-make-safearray arrayType (cons 0 (1- (length dataTypes))) ) dataTypes ) ) res )
)

; retrieves data from an xrecord object
; [xrecord] - vla-object, xrecord object
; return: list of dotted pairs or nil
; example:
; (setq dict (addDictionary *doc* "test"))
; (setq rec (addXrecord dict "test-xrecord"))
; (putXrecordData rec '(1 2 3) '("a" "b" "c"))
(defun getXrecordData (xrecord / types values)
(if
(vl-catch-all-error-p
(vl-catch-all-apply
(function
(lambda (vla-getxrecorddata xrecord 'types 'values))
)
)
)
nil
(mapcar
'cons
(vlax-safearray->list types)
(mapcar 'vlax-variant-value (vlax-safearray->list values)) ) )
)

(setq dict (vla-add (vla-get-dictionaries *doc*) "test")) #<VLA-OBJECT IAcadDictionary 02eb4b74>

(setq rec (vla-addxrecord dict "myrecord"))
#<VLA-OBJECT IAcadXRecord 02eb5f94>

(vla-setxrecorddata
rec
(createArray vlax-vbinteger '(1))
(createArray vlax-vbvariant '("a"))
)
nil

(getXrecordData rec)
((1 . "a"))

(setq rec1 (vla-addxrecord dict "myrecord1"))
#<VLA-OBJECT IAcadXRecord 02eb43b4>

(vla-setxrecorddata
rec1
(createArray vlax-vbinteger '(38))
(createArray vlax-vbvariant '(1.0))
)
; error: Automation Error. Description was not provided.

Anyone care to give me an education?

Thanks in advance
 
I'll have to try the ldata functions out sooner or later. I already have all my dictionary functions converted over to activex...
 
Luis,
Thanks. Perhaps I wasn't cleaning up my reactors properly. Are all your reactors/callbacks in separate namespace vlx's?
 
Doug Broad said:
I had some problems using (vlax-ldata-xxx) functions inside reactor callback functions. (Fatal errors and crashing such). I deactivated the calls to them and haven't had more problems. Have you ever run into anything like that?

LDATA from R14 turned out to be extremely buggy when the dwgs where opened in A2K, and there was no access to remove or to convert them. This bug even destroyed drawing files and rendered them unrecoverable.

When a very large customer of mine first discovered this bug, Autodesk (against better knowledge!) claimed that the fault was in my software and demanded that I stop selling my applications. Fortunately I could prove that this indeed was a bug inside AutoCAD and that my apps behaved well. Otherwise I would live under a bridge today :-( - as my customer had some 10,000 dwg files containing these buggy LDATA objects!

However, I stopped using LDATA ever since. Everything can be done just as well with dictionaries and xrecords.

Tom Berger
 
I was thinking the same thing just today, how is that handled
*exactly*? What are the differences between xrecords and ldata?
 
I don't remember exactly. Got a headache and have to get to bed. But if you add some ldata to anything, I think you can dictsearch the entity, chase down the 3xx codes, and it will show up as a "custom" "VL-O<something>" object.

My question remains as to whether your reactor crashes were due to using just ldata or a combination of ldata and (entxxx) functions. Maybe a VLA-Object wasn't localized?? Ah... remember that the (vlax-ldata-xxx) functions can get/put data to VLA-Objects as well as Enames.
 
John,
Sorry for delay in responding. I'm watching but can't form any conclusions now about vlax-ldata in reactors. I have a scale manager function that affects dimscale, ltscale, textsize... based on viewport scale, tilemode...

If a drawing was saved in paper space, I needed data stored in the drawing reminding the application of the current model scale. I tried vlax-ldata-xxx stuff and had crashes. That doesn't mean that that was necessarily causing the problems. It may have been a combination of things including the vlax-ldata that caused the problem. I do know that when I took the vlax-ldata stuff out, the problems ended. I haven't implemented a dictionary or xrecord scheme to replace it so I can't compare at this time. The reactor application did not use entget or entmod. It did use (getvar .. but only used (vla-setvariable.. and did not use setvar.

Other lisp programs loaded at startup may have used entget, entmod but do not actually run until the user (me) calls them. Some startup processes still use setvar.

Some of these things are very complex to track down and can only be done by me when things are slow.

Regards,
Doug
 
Hello All,

I would like to use the vlax-ldata-* functions - but have come up against an obstacle. I need to access the data saved from lisp with vlax-ldata-put in Visual Basic. The dictionary contains items named “vlo-VL” but I haven’t been able to extract any data from these.

The entity data list can be listed with entget, e.g.:

((-1 . &lt;Objektname: 405561f0&gt;) (0 . "VLO-VL") (5 . "1BDDE") (102 . "{ACAD_REACTORS") (330 . &lt;Objektname: 405561e0&gt;) (102 . "}") (330 . &lt;Objektname: 405561e0&gt;) (100 . "vlo_VL") (90 . -64512) (91 . 1) (92 . 0) (300 .
"2"))

….but the vlo-vl object does not seem to be exposed to VB.

I am currently working with Acad2002 – maybe things are different in 2004?

tia,

Peter
 
Nope, things haven't changed. A great reason to stay away from LData. Sorry.

--
R. Robert Bell, MCSE
www.AcadX.com

| Hello All,
| I would like to use the vlax-ldata-* functions - but have come up against an obstacle. I need to access the data saved from lisp with vlax-ldata-put in Visual Basic. The dictionary contains items named “vlo-VL” but I haven’t been able to extract any data from these. | | The entity data list can be listed with entget, e.g.:
|
| ((-1 . <Objektname: 405561f0>) (0 . "VLO-VL") (5 . "1BDDE") (102 . | "{ACAD_REACTORS") (330 . <Objektname: 405561e0>) (102 . "}") (330 . | <Objektname: 405561e0>) (100 . "vlo_VL") (90 . -64512) (91 . 1) (92 . 0) (300 . | "2")) | | ….but the vlo-vl object does not seem to be exposed to VB. | | I am currently working with Acad2002 – maybe things are different in 2004? | | tia, | | Peter |
 

Latest threads

Back
Top