ObjectARX

Reply
Active Member
janossycs
Posts: 9
Registered: ‎06-20-2012
Message 1 of 5 (437 Views)
Accepted Solution

LISP Global variable -> ObjectARX 2013

437 Views, 4 Replies
11-23-2012 07:41 AM

Hello,

 

another question: how can I get global string variable for a process then save it? I want to put the LISP global string variable *CI_Ido* into str string variable using the getsym function. I have an rstring, and I want to convert to a string:

 

int rc;
struct resbuf *rb;
string longT,
str;
rc = ads_getsym(_T("*CI_Ido*"), &rb); if (rc == RTNORM && rb->restype == RTSTR) { str = rb->resval.rstring; /* this my question */ if (str.length()==17) { longT = str.substr(14,4) + "." + str.substr(1,4); rb = ads_buildlist(RTSTR, longT, 0); rc = ads_putsym(_T("*CI_Valt*"), rb); ads_rett(); } else { ads_retnil(); } } else { ads_retnil(); } ads_relrb(rb);

 many thanks,

Csaba

Not string but wstring

TRY MY SOLUTION

[code]

ACHAR *
/*FCN*/lspfn_setq(ACHAR *variabile,const ACHAR *value)
{ int rc;
  if (variabile==NULL)
      {
          ads_retnil();
         return(variabile);
      };

  struct resbuf *rb;
  rb = ads_buildlist(RTSTR, value, NULL);
  rb.rbnext=nil;
  rc = ads_putsym(variabile, rb);        
  if (RTNORM==ads_retstr(rb->resval.rstring))
    { ads_relrb(rb);
      ads_retstr(value);
      return(value);
    };
  ads_relrb(rb);
  ads_retnil();
  return(NULL);
};


int
/*FCN*/test()
{   int rc;
    struct resbuf *rb;
    ACHAR str2[12];
    rc = ads_getsym(_T("*CI_Ido*"), &rb);
    if (rc!=RTNORM)
          { ads_retnil(); return(rc);};

    iF (rb==NULL)
          { ads_retnil();
            return(RTERROR);
          };

     if (rb->restype != RTSTR)
          { ads_retnil();
            return(RTCAN);
          };

     if (rb->resval.rstring==NULL)
          { ads_retnil();
            return(RTREJ);
          };

     rc=_tcslen(rb->resval.rstring);
     if (rc!=17)
          { ads_retnil();
            return(RTFAIL);
          };
                   // here maximum speed  and codesize it si little
       str2[0]=rb->resval.rstring[14];
       str2[1]=rb->resval.rstring[15];
       str2[2]=rb->resval.rstring[16];
       str2[3]=rb->resval.rstring[17];
       str2[4]=_T('.');  // here maximum  speed  and codesize it si little
       str2[5]=rb->resval.rstring[01];
       str2[6]=rb->resval.rstring[02];
       str2[7]=rb->resval.rstring[03];
       str2[8]=rb->resval.rstring[05];
       str2[9]=_T('\0');
       str2[10]=_T('\0');
       str2[11]=_T('\0');
      lspfn_setq(_T("*CI_Valt*"), str2);
      ads_rett();
      ads_relrb(rb);
      return(RTNORM);
}
[/code]

Distinguished Mentor
owenwengerd
Posts: 645
Registered: ‎08-06-2002
Message 2 of 5 (426 Views)

Re: LISP Global variable -> ObjectARX 2013

11-23-2012 10:53 AM in reply to: janossycs

What exactly is the problem? Build error? Runtime error? Crash?

--
Owen Wengerd
ManuSoft
Moderator
Alexander.Rivilis
Posts: 1,433
Registered: ‎04-09-2008
Message 3 of 5 (414 Views)

Re: LISP Global variable -> ObjectARX 2013

11-24-2012 10:06 AM in reply to: janossycs

Not string but wstring


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
diagodose2009
Posts: 263
Registered: ‎12-04-2009
Message 4 of 5 (407 Views)

Re: LISP Global variable -> ObjectARX 2013

11-24-2012 02:53 PM in reply to: janossycs

TRY MY SOLUTION

[code]

ACHAR *
/*FCN*/lspfn_setq(ACHAR *variabile,const ACHAR *value)
{ int rc;
  if (variabile==NULL)
      {
          ads_retnil();
         return(variabile);
      };

  struct resbuf *rb;
  rb = ads_buildlist(RTSTR, value, NULL);
  rb.rbnext=nil;
  rc = ads_putsym(variabile, rb);        
  if (RTNORM==ads_retstr(rb->resval.rstring))
    { ads_relrb(rb);
      ads_retstr(value);
      return(value);
    };
  ads_relrb(rb);
  ads_retnil();
  return(NULL);
};


int
/*FCN*/test()
{   int rc;
    struct resbuf *rb;
    ACHAR str2[12];
    rc = ads_getsym(_T("*CI_Ido*"), &rb);
    if (rc!=RTNORM)
          { ads_retnil(); return(rc);};

    iF (rb==NULL)
          { ads_retnil();
            return(RTERROR);
          };

     if (rb->restype != RTSTR)
          { ads_retnil();
            return(RTCAN);
          };

     if (rb->resval.rstring==NULL)
          { ads_retnil();
            return(RTREJ);
          };

     rc=_tcslen(rb->resval.rstring);
     if (rc!=17)
          { ads_retnil();
            return(RTFAIL);
          };
                   // here maximum speed  and codesize it si little
       str2[0]=rb->resval.rstring[14];
       str2[1]=rb->resval.rstring[15];
       str2[2]=rb->resval.rstring[16];
       str2[3]=rb->resval.rstring[17];
       str2[4]=_T('.');  // here maximum  speed  and codesize it si little
       str2[5]=rb->resval.rstring[01];
       str2[6]=rb->resval.rstring[02];
       str2[7]=rb->resval.rstring[03];
       str2[8]=rb->resval.rstring[05];
       str2[9]=_T('\0');
       str2[10]=_T('\0');
       str2[11]=_T('\0');
      lspfn_setq(_T("*CI_Valt*"), str2);
      ads_rett();
      ads_relrb(rb);
      return(RTNORM);
}
[/code]

Active Member
janossycs
Posts: 9
Registered: ‎06-20-2012
Message 5 of 5 (389 Views)

Re: LISP Global variable -> ObjectARX 2013

11-26-2012 01:47 AM in reply to: diagodose2009

The error was: no operator "=" matches this operand.

The wstring type has resolved it, and this one is the easyest way for me, but I will test the 2nd solution and build in.

Maybe you ask why I need ObjectARX for this process, why not enough LISP, because it's a test and I need to compare the results of LISP and ObjectARX.

Thanks for everyone the answer!

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.