
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
In an ARX file we have the below code :
int upd_text(void) { acutPrintf(L"\nInside upd_text.\n"); ads_name ENT; struct resbuf *RB, *ARGS; // RB = ads_newrb(RTSTR); RB = acutNewRb(RTSTR); // ARGS = ads_getargs(); ARGS = acedGetArgs(); if (ARGS) { ENT[0] = ARGS->resval.rlname[0]; ENT[1] = ARGS->resval.rlname[1]; } else { // if ((RESULT = ads_entlast(ENT)) != RTNORM) { if ((RESULT = acdbEntLast(ENT)) != RTNORM) { // ads_printf(L"\nCannot find entity in drawing database.\n"); acutPrintf(L"\nCannot find entity in drawing database.\n"); return RESULT; } } // if ((RESULT = ads_getvar(L"CECOLOR",RB)) != RTNORM) { if ((RESULT = acedGetVar(L"CECOLOR",RB)) != RTNORM) { // ads_printf(L"\nCannot get current color.\n"); acutPrintf(L"\nCannot get current color.\n"); return RESULT; } if ((!wcscmp(RB->resval.rstring, L"1")) || (!wcscmp(RB->resval.rstring, L"2")) || (!wcscmp(RB->resval.rstring, L"3"))) { upd_color(ENT,-1,0, L"BAY", L"*"); upd_color(ENT,-1,0, L"GRP_CODE", L"*"); } // ads_relrb(RB); acutRelRb(RB); // ads_retvoid(); acedRetVoid(); return RTNORM; }
From VB.NET we are invoking it as below :
Public Shared Function upd_text(objID As ObjectId) As Integer Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim ed As Editor = doc.Editor Using dl As DocumentLock = doc.LockDocument() Using rb As New ResultBuffer() rb.Add(New TypedValue(CInt(LispDataType.Text), "upd_text")) rb.Add(New TypedValue(CInt(LispDataType.ObjectId), objID)) Dim rbRes As ResultBuffer = Application.Invoke(rb) End Using End Using End Function
We are getting the below error :
Autodesk.AutoCAD.Runtime.Exception: eInvalidInput
at Autodesk.AutoCAD.ApplicationServices.Core.Application.Invoke(ResultBuffer args)
at GSITE_NIMCAD.ARXWRAPPER.upd_text(ObjectId objID) in D:\Application Data\GSITE\Working 2017 Migration\GSITE_NIMCAD\ACAD_Mgr\ARXWRAPPER.vb:line 393
at GSITE_NIMCAD.GSITE_NIMCAD.Draft.add_blck(String bdir, String blk, Double rot, Double sc, Point3d insPoint) in D:\Application Data\GSITE\Working 2017 Migration\GSITE_NIMCAD\Draft\Draft.vb:line 1570
at GSITE_NIMCAD.GSITE_NIMCAD.Nimcad.mnuAddSym(ResultBuffer args) in D:\Application Data\GSITE\Working 2017 Migration\GSITE_NIMCAD\Nimcad.vb:line 2617
at GSITE_NIMCAD.GSITE_NIMCAD.NIMCAD_Commands.CMD_Lu_FloPlaInfoReCir() in D:\Application Data\GSITE\Working 2017 Migration\GSITE_NIMCAD\Commands\NIMCAD_Commands.vb:line 955
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
Could anybody explain why is this. It is working fine in AutoCad 2014. We are now upgrading it to AutoCad 2018.
Also We have another code :
Dim cmdTTEXT As String = "(TTEXT " + scal + " )" + vbCr '(TTEXT scal) Application.DocumentManager.MdiActiveDocument.SendStringToExecute(cmdTTEXT, True, False, False) '(command "dtext")
Here we are getting
error: no function definition: TTEXT
Is TTEXT deprecated. If so which function should we use. Please guide.
Thanks in Advance
Solved! Go to Solution.