Hi Community,
I developed an application for Mechanical 2014. This app does something in .NET (c#) and the I need to reuse an old procedure in ObjectArx and the procedure works fine in mechanical 2013.
The problem is that I need to know the AcDbObjectId id.
.NET
ObjectId[] idArray;
//populate and iterate
btacmwrap.Class1 cl = new btacmwrap.Class1();
cl.partparS("key", "value", idArray[i].OldId.ToString());
Wrap DLL
void partparS(String ^a,String ^b, String ^c)
{
wrss uj;
CString s;
//call ObjectArx function
uj.partparS(CString(a),CString(b), CString(c));
}
ObjectARX
void setPartDataS(CString a,CString b, CString c)
{
try
{
long id;
Adesk::IntPtr puntatore(_wtoi(c));
AcDbObjectId refArray2 = refArray2.setFromOldId(puntatore);
if( !refArray2.isValid())
{
acutPrintf(_T("\nId not valid\n"));
return;
}
if (refArray2.isNull())
{
acutPrintf(_T("\nId NULL\n"));
return;
}
if (refArray2.isErased())
{
acutPrintf(_T("\nId erased\n"));
return;
}
Adesk::UInt32 numIt;
CMapStringToString valueMap;
Acad::ErrorStatus es ;
int tmpNumIt;
CString prompt, tmp;
CMapStringToString newValueMap;
newValueMap.SetAt(a,b);
es = acmBomMgr->setPartData(refArray2,newValueMap);
if( Acad::eOk != es ) {
acutPrintf(_T("\nError returned for set part data (%d).\n"),es);
return;
}
}
catch(...)
{
MessageBox(NULL,L"Eccezione in setParData",L"setParData",MB_ICONERROR);
}
}
Result: The ID is not valid.
and if I try to pass idArray[i].OldIdPtr.ToInt64() in .NET, the setPartData(...) in ObjectArx doesn't work and return eInvalidInput.
I also try to pass HANDLE but there's no way and I don't know where is the bug.
Please, help me.
Thank you,
Mario