[CONNECT C++] Adding a dimension style to an existing dimension with no style

Hi folks,

Simply question. I have a few thousand dimensions in a design file with no dimension style set (in fact, a lot of DGNs like this). I want to add a dimension style to them programmatically. I can't find a way to do this. My code works just fine if there is already a named dimension style attached to the element, but doesn't work when there isn't. Here is the code which applies the dimension style "dimStyleP" to the element descriptor "dimEdPP". Note I am using descriptors because the code is done within an mdlModify_elementSingle() operation.

    EditElementHandle	eeh ( *dimEdPP, FALSE, FALSE, modelRef );
	DimensionHandler*	dh = dynamic_cast < DimensionHandler* >( &( eeh.GetHandler () ) );

    // Check what the ID and style name is
	printf ("Dim style ID = %d dim name = '%s'\n", dimStyleP->GetID (), AString ( dimStyleP->GetName().GetWCharCP() ) );

	// This function may render the Element Descriptor invalid
	dh->ApplyDimensionStyle ( eeh, *dimStyleP, FALSE );

    // Now let's read them back form the element to ensure it worked
	ElementHandle	eh = eeh;
	DimensionStylePtr	readDimStyleP = dh->GetDimensionStyle ( eh );

    // Verify what the ID and style name is now
	printf ( "Dim style ID = %d dim name = '%s'\n", readDimStyleP.get()->GetID (), AString ( readDimStyleP.get ()->GetName ().GetWCharCP () ) );

	// Reset the descriptor 
	iRet = mdlElmdscr_duplicate ( dimEdPP, eeh.GetElementDescrP () );

From the first printf debug statement I can see that the dimension style name and ID are set on the destination style, but reading it back straight after the call to ApplyDimensionStyle() shows them as blank.

So it looks like ApplyDimensionStyle() can only set a dimension style if there is already one associated, but it can't/won't if there isn't.

Since there is no SetID() member function, there is no obvious way to set the dimension style ID. I also tried a direct hack of setting the elmSP->buf[ sizeof ( hdr ) ] but this changed the dimension style ID reported in the printf statement but "Analyze Element" still showed that no dimension style was attached. There seems to be some undocumented way that a dimension style gets "attached" to a dimension element that isn't exposed in the public SDK. Is there any way to do this? It must be more than just an Int32 for the dimension style ID that associates a dimension element to a dimension style.