Author Topic: LispFunction: how can I pass a list of integers from Lisp to ResultBuffer  (Read 1745 times)

0 Members and 1 Guest are viewing this topic.

CHACHA

  • Guest
Hi,

I am trying to pass lists of integers from Lisp to Resultbuffer. It seems that lists with two or three numbers are always converted to Point2d or Point3d. But if the first element of a list looks like a dxf group code and when the list is longer than two elements, then the TypedValue is constructed wrongly.

(myfunction '(1 2 3)) -> {((5009(1,2,3)))}
(myfunction '(10 20 30)) -> {((10,(20,30,0)))} is WRONG!
(myfunction '(10 20)) -> {((5002,(10,20)))} is OK!
(myfunction '(20 30 40)) -> {((5009,(20,30,40)))} is OK!
(myfunction '(10.0 20 30)) -> {((5009,(10,20,30)))} is OK!

I know that this can easily solved from the lisp side. But is there any other solution on the C# side? Can I switch off the automatic conversion to Point2d/Point3d and get a list of integers in my resbuf?

Regards
Tom

owenwengerd

  • Bull Frog
  • Posts: 452
There is no way to disable the conversion. The usual workaround is to force at least the first element of the list to be a floating point type as in your last example.

CHACHA

  • Guest
There is no way to disable the conversion. The usual workaround is to force at least the first element of the list to be a floating point type as in your last example.

Thank you. In BricsCAD lists of two or three integers are also converted to Point2d/3d-TypedValues, but first elements that look like dxf group codes are converted correctly.

The AutoCAD behaviour makes it quite difficult to write lisp-APIs für .NET applications.