TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: T.Willey on July 11, 2006, 07:19:38 PM

Title: XRecord restrictions
Post by: T.Willey on July 11, 2006, 07:19:38 PM
I'm trying to help someone on the Adesk Ng.  What it looks like he is wanting to do, is add entity code data to a dictionary object as xrecords.  I posted one routine that I use to do this, but he said that it error'ed, and when I tested it with entity code, it did.  Enough back ground I hope.

My question is, Can you input a list into an Xrecord?  My first thought is no, but would like input from people with more experience than I have in this area.  If needs be, I can post the code that I shared.

Thanks in advance for any/all help.
Title: Re: XRecord restrictions
Post by: T.Willey on July 11, 2006, 07:44:48 PM
Here is a quick code that I can up with to see if that was the problem, and right now it seems to work, but I haven't the time to test if correctly.  I will get back at this tomorrow, but here is the code if anyone wants to see it.  It can be written better, but I just wanted to get something working.
Code: [Select]
(defun MakeVariant (Lst)

(vlax-make-variant
 (vlax-safearray-fill
  (vlax-make-safearray
   vlax-vbVariant
   (cons 0 (1- (length Datalist)))
  )
  (mapcar
   '(lambda (x)
    (if (equal (type x) 'LIST)
     (vlax-make-variant
      (vlax-safearray-fill
       (vlax-make-safearray
        vlax-vbVariant
        (cons 0 (1- (length x)))
       )
       x
      )
     )
     x
    )
   )
   Lst
  )
 )
)
)

I know it should be recursive, but when I tried it first it didn't work, I think I can do it now, but don't have the time. :-)
Title: Re: XRecord restrictions
Post by: LE on July 11, 2006, 07:46:47 PM
nevermind...... (where is the remove button.... )
Title: Re: XRecord restrictions
Post by: Jeff_M on July 11, 2006, 08:01:53 PM
Luis, they are trying to use ActiveX and, as Tim discovered, you must convert all lists to variants.

Tim, I don't think you would need to make it recursive for this application since an Entity list will never be nested beyond the point/vector types.

Oops, Luis withdrew his response......but I'll leave this for Tim anyway.
Title: Re: XRecord restrictions
Post by: Jeff_M on July 11, 2006, 08:03:17 PM
(where is the remove button.... )
Good question, LE! We used to have a delete, didn't we?
Title: Re: XRecord restrictions
Post by: LE on July 11, 2006, 10:02:14 PM
(where is the remove button.... )
Good question, LE! We used to have a delete, didn't we?

Yes....  :-(

It may be part of the update for the site.... BTW, I had previously the option to "Remove the topic" available on this one (that I did not started), very strange.
Title: Re: XRecord restrictions
Post by: LE on July 11, 2006, 10:04:37 PM
Luis, they are trying to use ActiveX and, as Tim discovered, you must convert all lists to variants.

Tim, I don't think you would need to make it recursive for this application since an Entity list will never be nested beyond the point/vector types.

Oops, Luis withdrew his response......but I'll leave this for Tim anyway.

Sorry;

I was out of the scope... that's why.....  :-(
Title: Re: XRecord restrictions
Post by: MP on July 11, 2006, 11:21:01 PM
Tim, I don't think you would need to make it recursive for this application since an Entity list will never be nested beyond the point/vector types.

Wondering aloud <<but I took a sleeping pill about 1/2 hour ago, so I could be daffy in the head>> what about xdata?

Having said that, without the benefit of understanding the application I fnd the notion of  storing entity data in xrecords a bit superfluous. I can only guess that the application is performing some kind of roll-back activities.
Title: Re: XRecord restrictions
Post by: Jeff_M on July 12, 2006, 01:15:03 AM
Well, I don't have Autocad here to check but I was under the impression Xrecord data types were only allowed up to ~369 . Xdata starts at 1000 so that would preclude them from being in the Xrecord. Or am I not recalling correctly?
Title: Re: XRecord restrictions
Post by: MP on July 12, 2006, 06:08:36 AM
That makes sense Jeff, surely more than my last couple posts.

 :ugly:

Title: Re: XRecord restrictions
Post by: T.Willey on July 12, 2006, 11:17:07 AM
I have no idea what the OP on the Adesk Ng wanted help for.  I was only trying to find an answer to the problem, since I didn't know the answer, and I wanted to.

I can only guess that the application is performing some kind of roll-back activities.
This is my guess also.

Well, I don't have Autocad here to check but I was under the impression Xrecord data types were only allowed up to ~369 . Xdata starts at 1000 so that would preclude them from being in the Xrecord. Or am I not recalling correctly?
I think you are right Jeff.
Title: Re: XRecord restrictions
Post by: MP on July 12, 2006, 11:31:55 AM
Sorry Tim, didn't mean to sound so negative. Terse Post + Under The Influence.
Title: Re: XRecord restrictions
Post by: T.Willey on July 12, 2006, 11:39:29 AM
Sorry Tim, didn't mean to sound so negative. Terse Post + Under The Influence.
No problem at all Michael.  I didn't take it that way.