We've found a bug in mdlPattern_addAssociative (and in mdlPattern_addAssociative2 as well). If you use code like this:
memset(&patPar, 0, sizeof(patPar));
patPar.modifiers |= PATMOD_SPACE1;
patPar.modifiers |= PATMOD_ANGLE1;
patPar.modifiers |= PATMOD_COLOR;
patPar.space1 = 5000;
patPar.angle1 = fc_pi / 4;
patPar.color = 3;
rc = mdlPattern_addAssociative(edPP, 0, 0, &patPar, NULL, NULL, PATTERN_HATCH, mdlModelRef_getActive());
the function returns SUCCESS, BUT at first glance it seems like no pattern have been added to the shape (edPP). But if you use the "Show Pattern Attributes" tool you will se that PA (pattern angle) is zero and PD (pattern distance) is zero as well.
In V8i SS3 this works just fine...
Sunand Sandurkar said:I copied your code as-is and was able to place hatches successfully
In which version of MicroStation? This problem seems to be strongly related to version.
Regards, Jon Summers LA Solutions
I'm VERY surprised that you can attach the pattern with the code listed. As Jon points out the problem is strongly related to version. Please check the code on the released version.
The reason for using mdlElmdscr_add instead of mdlElmdscr_rewrite is that the original shape might come from a reference file (when using my original application)
I've attached to .dgn files PatternTest_SS3.dgn and PatternTest_SS4.dgn showing the results when running the test in the two versions.
Works for me too. This also explains why this occurred in ss2 while compiling with the ss3 SDK.
Was this fixed ever publicly released for MicroStation V8i? I still cannot extract the pattern modifiers correctly in SELECTSeries 10 (v8.11.09.908). Calling the function mdlPattern_extractAssociative2() always give me a pattern modifier of zero, even though I can read the actual patterning values (angle, cell name, spacing, etc) after calling the function. This makes it impossible to read a pattern element reliably from the SDK in SS4.
--Piers PorterAltiva Software
Yes, it was fixed in v188.8.131.522, BUT in version 184.108.40.2065 the bug was introduced again... Because of this, we got two versions of the application that works with patterning...