[CONNECT Update 15 C++] - migration from v8i: Creating text in work DGN files

Hi all,

Ok, I've made a lot of progress in the last few months.  My current snag point is converting from using mdlText_create functionality to using TextBlocks.

Summary:

  • Old v8 Application creates complex elements out of lines, line strings, ellipses, shapes, and text
  • App writes the elements to work DGN files, creating between 30 and 100 individual part files that are referenced into an assembly.
  • CE uses textBlocks, can't reuse the old code.
  • Trying to make as few changes as possible, just a straight port over from MDL to C++ native code.

I've found many examples of how to add text to the active design file.  This program creates several files from a common seed.  Line geometry is being created (hooray) and updated properly in the files.  When they are referenced manually into an Assembly file (the active design file), everything is working as it should.

For each file, I create a chart that identifies the model, who created it (ran the program), date/time stamp, and creates a generic revision block in case of any manual revisions that need to be added.  This is populated using mdlText_create and sets level, color, line style, &c properties, which is then added to an Element Descriptor, which is appended to the workDGN after all of the bits are made for the rev block.  The parent routine calls ldWriteLine(...) and ldWriteText(...) to create the rev block.  Below is the base v8 routine that uses mdlText_create.

Public MSElementDescr *LDWriteText
(
	WChar           *sss,             /* String to print */
	double          sTS,              /* Text size */
	int             sF,               /* Font number */
	int             sJx,              /* Horizontal Justification (0-4) */
	int             sJy,              /* Vertical Justification (0-2) */
	Dpoint3d        *pt,              /* Origin */
	double          xrot,             /* Rotation about X axis */
	double          yrot,             /* Rotation about Y axis */
	double          zrot,             /* Rotation about Z axis */
	UInt32          *color,           /* Text Color */
	UInt32          *weight,          /* Text Weight */
	MSElementDescr  *addDes
)

{
	MSElement           partSegment;
	MSElementDescr      *partDescr;
	TextSizeParam       txSize;
	TextParam           txParm;
	RotMatrix           iMatrix, rMatrix;

	txSize.mode = TXT_BY_TILE_SIZE;
	txSize.size.width = sTS;
	txSize.size.height = sTS;
	txSize.aspectRatio = fc_1;
	txParm.font = sF;
	txParm.just = (sJx > -1 ? sJx * 3 + sJy : TXTJUST_CC);
	txParm.style = 0;
	txParm.viewIndependent = 0;

	mdlRMatrix_getIdentity(&iMatrix);
	mdlRMatrix_rotate(&rMatrix, &iMatrix, xrot, yrot, zrot);

	if (mdlText_create(&partSegment, NULL, sss, pt, &txSize, &rMatrix, &txParm, NULL) == SUCCESS)
	{
		mdlElement_setSymbology(&partSegment, color, weight, NULL);
		if (addDes == NULL)
		{
			mdlElmdscr_new(&partDescr, NULL, &partSegment);
			return partDescr;
		}
		else
		{
			partDescr = mdlElmdscr_appendElement(addDes, &partSegment);
			return partDescr;
		}
	}
}

This code is what's used to add the text to the complex element.

I'm attempting to update this code, limiting the changes to the function itself.  As mentioned, I have good examples of creating TextBlock elements.  I think I've got the element creation bits down, but I can't seem to find sample code that takes the EditElement (or EditElementHandle) and appends it to an Element Descriptor to make it a complex element.

I'm trying to use the API documentation and searching examples, but that's slow going (as manual searches are), so I thought I'd drop something here to see if anyone has a "Oh yeah, it's dead easy, look at this..." response. 

I know I probably don't have enough information here, but I don't know what else to add.  If I knew how to convert the EEH to a Part Descriptor, or append it to one, I think that would push me over the hump.

Thanks,

Gary