Replies: 1 comment 1 reply
-
|
Its C++ .vs Python weirdness, from what I understand Python does not have the concept of char, short, long. C++ only sees an integer coming from CPython. There are some cases where the value is less than 32,767, but the type still must be kDxfInt32. There’s a couple of other places where I do try to convert based on the value, like Looking at this class specifically, it looks like it can be improved, I can change it to..?.. PyDbEvalVariant::PyDbEvalVariant(Adesk::Int32 lVal)
: PyRxObject(new AcDbEvalVariant(lVal), true, false)
{
//try to convert
}
PyDbEvalVariant::PyDbEvalVariant(Adesk::Int32 lVal, bool isShort)
: PyRxObject(new AcDbEvalVariant(lVal), true, false)
{
//user confirms if the above fails
if (isShort)
{
impObj()->clear();
impObj()->restype = AcDb::kDxfInt16;
impObj()->resval.rint = Adesk::Int16(lVal);
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does it make sense to ask the user if a number is an Int16? Wouldn't it be better to set isShort based on the value passed in?
PyRx/PyRxCore/PyDbEval.cpp
Lines 89 to 98 in 3070f8c
https://github.com/CEXT-Dan/PyRx/blob/3070f8c602f1cd195b6d5353b887ab113a0a0a59/pyrx/PyDb.pyi#L14650-L14651
Beta Was this translation helpful? Give feedback.
All reactions