ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mechanical 2014: ObjectId to AcDbObjectId from .NET to objectARX Through Wrapper

0 REPLIES 0
Reply
Message 1 of 1
SCTINFORMATICA
567 Views, 0 Replies

Mechanical 2014: ObjectId to AcDbObjectId from .NET to objectARX Through Wrapper

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

 

 

 

 


                                        

SCT Informatica
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost