PromptEntityOptions opt
= new PromptEntityOptions
("\nSelect an Alignment"); opt.SetRejectMessage("\nObject must be an alignment.\n");
opt
.AddAllowedClass(typeof(Alignment
),
true); ObjectId testAlignID = ed.GetEntity(opt).ObjectId;
Alignment oAlignment = trans.GetObject(testAlignID, OpenMode.ForRead) as Alignment;
ObjectId testLayerID = oAlignment.LayerId;
ObjectId testSurfaceId = doc.GetSurfaceIds()[0];
ObjectId testStyleId = doc.Styles.ProfileStyles[0];
ObjectId testLabelSetId = doc.Styles.LabelSetStyles.ProfileLabelSetStyles[0];
//--------------------------------------------------------------------------------------------------
try
{
//The following line works when function is called directly from a command, fails when called from the WPF window.
ObjectId otherprofileId = Profile.CreateFromSurface("Other Profile", testAlignID, testSurfaceId, testLayerID, testStyleId, testLabelSetId);