argumenttype INT <> FLOAT

Started by Fred Tomke, March 17, 2010, 05:26:52 AM

Previous topic - Next topic

Fred Tomke

Hello, I tried several ways to get OLEColor values:

This is the way it worked in ObjectDCL:
Befehl: (odcl_getcolorvalue 118 37 147)
9643382


When calling this expression OpenDCL produces an ARX exception
Befehl: (dcl_getolecolorvalue 118 37 147)
nil


When I put this into a list, I get an error because of wrong argument type
Befehl: (dcl_getolecolorvalue (list 118 37 147))
; Fehler: Fehler bei ADS-Anforderung


Knowing that AutoCAD tries to interpret the first integer of a list as a groupcode I tried to give it as a float
Befehl: (dcl_getolecolorvalue (list 118.0 37 147))
9643382


1. Is it really not possible to force AutoCAD not to try interpreting the first list item as a group code? Because may are many cases when lists of integers can be passed as an argument.
2. I may be wrong but: Shouldn't this also work?
Code (autolisp) Select
(dcl_getolecolorvalue 118 37 147)

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

I've fixed the exception, and I also added code to correctly interpret colors that have 110 - 118 red values. In my tests, all three of your approaches now work without error.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Thanks Owen, where do you know from that only the red values between 110 and 118 produces errors? I remember an error of Calendar control when passing 2010 instead of 2010.0 as year value. Of course 2010 is not a valid red value for GetOLEColorValue but my question is more general. I mean, maybe there are other functions that will accept lists of integers (I do just not know by now) and may fail, too.
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

The only way to know for sure which values fail is to try them. One could guess based on the DXF code documentation, but the only way to be sure is to see if AutoCAD interprets the 3-integer list as a DXF value.
Owen Wengerd (Outside The Box) / ManuSoft