CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2017
    Posts
    1

    Extended data with ODA library

    Hi!

    I have read about extended data for some time and I am currently trying to store the value of the attributes of a block (the block used is the standard that opens with the CAD, a block to make the electrical design) in the extended data, but I am encountering difficulties. The program is not doing anything the way I did and it's been a while since I'm trying to modify this code, but I do not know what I could do differently. This is trying to put in the extended data the value of the insertion point of the block and then the part of all the attributes of the block (but this still barely started because I am well lost).
    If anyone can help me I really appreciate it and I notice that I am very lay person myself, I learned c ++ a short time ago and now I am venturing into this library to program to CAD.


    I'm programming in C ++ in Visual Studio using the ODA library to make applications for CAD.

    Code:
    int testEED()
    {
    
    	const CString string = "Select a block: ";
    	CString code = "POINTS_APP";
    
    	fdt_point objPoint;
    	fdt_name ename;
    	fdt_name nextName;
    	fdt_point point;
    
    	OdDbObjectId objID;
    
    	ACTIVE_DOCUMENT()->GetFxAPI()->fdt_entselW(string, ename, point); 
    	ACTIVE_DOCUMENT()->GetFxAPI()->GetObjectId(ename, objID);
    	ACTIVE_DOCUMENT()->GetFxAPI()->fdt_entnext(ename, nextName);
    	
    	fdt_resbufW * objList = new fdt_resbufW();
    	objList->restype = RTSTR;
    	objList->resval.rstring = _T("*");
    
    	fdt_resbufW * objEnt = ACTIVE_DOCUMENT()->GetFxAPI()->fdt_entgetxW(ename, objList); //entget
    	fdt_resbufW * aux = objEnt;
    	fdt_resbufW * aux2 = ACTIVE_DOCUMENT()->GetFxAPI()->fdt_entgetxW(nextName, objList);
    	ACTIVE_DOCUMENT()->GetFxAPI()->fdt_regappW(code); //registrar código com regapp: "CODE"
    	while(aux2 != NULL)
    	{
    		if(aux2->restype == 10)
    		{
    			objPoint[0] = aux2->resval.rpoint[0];
    			objPoint[1] = aux2->resval.rpoint[1];
    			objPoint[2] = aux2->resval.rpoint[2];
    		}
    		aux2 = aux2->rbnext;
    	}
    	while(aux->rbnext!=NULL)
    	{
    		aux = aux->rbnext;
    	}
    	
    	fdt_resbufW * objListApp = new fdt_resbufW();
    	objListApp->restype = RTSHORT;
    	objListApp->resval.rint = -3;
    	
    	objListApp->rbnext = new fdt_resbufW();
    	objListApp->rbnext->restype = 1001; //appname
    
    	objListApp->rbnext->resval.rstring = _T("POINTS_APP");
    	
    	objListApp->rbnext->rbnext = new fdt_resbufW();
    	objListApp->rbnext->rbnext->restype = 1010; //3D point
    	objListApp->rbnext->rbnext->resval.rpoint[0] = objPoint[0];
    	objListApp->rbnext->rbnext->resval.rpoint[1] = objPoint[1];
    	objListApp->rbnext->rbnext->resval.rpoint[2] = objPoint[2];
    	aux->rbnext = objListApp;
    	ACTIVE_DOCUMENT()->GetFxAPI()->fdt_entmodW(objEnt);
    
    	return 0;
    
    }
    Last edited by 2kaud; March 31st, 2017 at 07:02 AM. Reason: Changed tags to code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured