AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OD Column Definition DefaultValue()

0 REPLIES 0
Reply
Message 1 of 1
butwhy42
420 Views, 0 Replies

OD Column Definition DefaultValue()

I've been trying to read OD definitions and displaying it's contents (C++, Map SDK 2012). So far it works just fine, however getting default values of a column has proven to be a pain. Apparently, if column value isn't actully set, DefaultValue() returns the value of a previous column:

     Column0: 'SomeValue'

     Column1: ''

 

Calling DefaultValue() returns SomeValue in both cases, when it obviously shoudn't. Also, IsValid() returns true in both cases and the standard _adeattachdata command displays fields correctly. I'm guessing it's an API bug, as there's not a whole lot of room for mistakes here, but anything's possible.

 

Relevant code:

AcMapODTable * table;
// fetch the table pointer
AcMapODTableDefinition t_def(table->Definition());
for(int i = 0; i < t_def.Count(); ++i)
{
	AcMapODColumnDefinition c_def;
	t_def.GetColumn(c_def, i);
	if(!c_def.IsValid())
	{
		acutPrintf(_T("ERROR: invalid column definition.\n"));
		continue;
	}
	AcMapValue val(c_def.DefaultValue());
	switch(val.Type())
	{
		case AcMap::kCharacter:
			acutPrintf(_T("%s\n"), static_cast<const ACHAR *>(val));
			break;
		case AcMap::kInteger:
			acutPrintf(_T("%i\n"), static_cast<int>(val));
			break;
		case AcMap::kPoint:
			{
				AcGePoint3d & p(static_cast<AcGePoint3d>(val));
				acutPrintf(_T("%lf,%lf,%lf\n"), p.x, p.y, p.z);
			}
			break;
		case AcMap::kReal:
			acutPrintf(_T("%lf\n"), static_cast<double>(val));
			break;
		default:
			acutPrintf(_T("ERROR: unknown type.\n"));
			break;
	}
}

 

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