inserting xdata in an existing entity : how to do?

Topics relating to AutoLisp and SDS.

Moderators: CMS Inc, avaernes

Post Reply
efernal
Valued Contributor
Posts: 28
Joined: Thu Jul 05, 2007 6:42 pm
Contact:

inserting xdata in an existing entity : how to do?

Post by efernal » Fri Mar 25, 2011 12:32 pm

// this is not working...
// any suggestions?

Code: Select all

#include "Memorial_Icad.h"

void cmd_blocos()
{
	sds_point p1 = {0.0, 0.0, 0.0};
	sds_point p2 = {100.0, 100.0, 100.0};

	sds_command(RTSTR, "_.LINE",
		        RT3DPOINT, p1,
				RT3DPOINT, p2,
				RTSTR, "",
				RTNONE);

	sds_name ent;
	sds_entlast(ent);

	struct sds_resbuf *ENT = NULL, rb;

    ENT = sds_entget(ent);

	sds_regapp("VAMOSVER");

	rb.restype = -3;

	ENT->rbnext = &rb;

	rb.restype = 1001;
	rb.resval.rstring = "VAMOSVER";

	ENT->rbnext = &rb;

	rb.restype = 1000;
    rb.resval.rstring = "Testando entrada de dados...";
	rb.rbnext = NULL;

	ENT->rbnext = &rb;
	ENT->rbnext = NULL;

	sds_alert("Tryint to entmod last LINE...");

	sds_entmod(ENT);

	struct sds_resbuf *eb = NULL;
	
	for(eb=ENT;eb!=NULL;eb=eb->rbnext)
		sds_printf("\n-> Restype = %d", eb->restype);

	if (ENT != NULL) 
		sds_relrb(ENT);

	if(eb != NULL)
		sds_relrb(eb);

	ENT = 0;
	eb = 0;

}
efernal
Valued Contributor
Posts: 28
Joined: Thu Jul 05, 2007 6:42 pm
Contact:

BINGO!!!

Post by efernal » Sat Mar 26, 2011 9:42 am

Code: Select all

#include "Memorial_Icad.h"

void cmd_blocos()
{
	sds_point p1 = {0.0, 0.0, 0.0};
	sds_point p2 = {100.0, 100.0, 100.0};

	sds_command(RTSTR, "_.LINE",
		        RT3DPOINT, p1,
				RT3DPOINT, p2,
				RTSTR, "",
				RTNONE);

	sds_name ent;
	sds_entlast(ent);

	struct sds_resbuf *ENT = NULL, *rb3, *rb1001, *rb1000;

    ENT = sds_entget(ent);

	sds_regapp("VAMOSVER");

	struct sds_resbuf *eb = NULL;

	rb3 = sds_buildlist(-3, 0);
	rb1001 = sds_buildlist(1001, "VAMOSVER", 0);
	rb1000 = sds_buildlist(1000, "testando inserção de xdata...", 0);

	rb1001->rbnext = rb1000;
	rb3->rbnext = rb1001;

	ENT->rbnext = rb3;

	sds_relrb(rb3);
	sds_relrb(rb1001);
	sds_relrb(rb1000);

	rb3 = 0;
	rb1001 = 0;
	rb1000 = 0;

	sds_entmod(ENT);

	for(eb=ENT;eb!=NULL;eb=eb->rbnext)
		sds_printf("\n-> Restype = %d", eb->restype);

	if (ENT != NULL) 
		sds_relrb(ENT);

	if(eb != NULL)
		sds_relrb(eb);

	ENT = 0;
	eb = 0;
}
Post Reply