Create a grouped hole with a pattern


With C# i am trying to create a grouped hole with a pattern in Microstation Connect v10 update 14. So far with no success.

Because a grouped hole does not have the ClosedElement interface i cannot use the SetPattern method.

Creating a grouped hole without a pattern is succesful:


   // Create some complex elements: outermost and holes. All have property NotFilled and are on the same level
   var outermost = Application.CreateComplexStringElement1(ref elementArray);
   var holes[] = new Element[] { Application.CreateComplexStringElement1(ref elementArray) };

   foreach (var hole in holes)
      mdlElmdscr_initOrAddToChain(&outEdPP2, hole.MdlElementDescrP());

   mdlElmdscr_createShapeWithHoles(&outEdPP2, outermost.MdlElementDescrP(), holeEdP);

   // Create element
   var groupedHole = Application.MdlCreateElementFromElementDescrP(outEdPP);

   // Add to the designfile
   Application.ActiveModelReference.AddElement(groupedHole);

   // Create pattern params e.g.
   var patternParams = new PatternParams();
   patternParams.PrimaryAngle = Math.PI/4;
   patternParams.PrimarySpacing = 20.0;
   patternParams.Modifiers = PatternParamsModifierFlags.Angle1 | PatternParamsModifierFlags.Space1;

   var result = mdlPattern_addAssociative(&outEdPP2, -1, -1, ref patternParams, 0, 0, 0, MicroStationGlobals.Instance.Application.ActiveModelReference.MdlModelRefP());

result is 0 (SUCCESS). outEdPP2 will have another value.

A grouped hole does appear in the designfile, but it has no pattern.

In MicroStation the property 'Pattern' says 'None', but I can create it manualy.

Any help would be appreciated.

Parents Reply Children