In VBA, to set the Alignment mode in DimensionStyle from "View" to "True", we use
DimensionStyle.Alignment = MsdDimAlignment.True
When we are in .NET API, we use:
DimensionStyle.SetIntegerProp(2, DimStyleProp.General_Alignment_INTEGER);
and apply it to DimensionCreateData.
However, the dimension element is not working as true alignment. What did I miss?
Unknown said:However, the dimension element is not working as true alignment. What did I miss?
Hi,
did you try to replace the modified DimensionStyle in the dgn file using something like this:
DimensionStyle.Replace(null,null);
Please let us know if this helps.
Best regards,Artur
Dear Artur,
Yes, I have tried your suggestion but it was not working. After many trial & error, I found that if I move the dimension element in CE5, it will change back to correct shape, but a different(wrong) shape in V8i.
The Left was the preferred shape and the Right one was the incorrect shape generated by .NET API.
I attached the dgn for your reference.
dgn.zip
thank you for providing the DGN example. From what I can see the position of handle1 seems to be off the correct position:
Without knowing the code example used to create this dimension it is difficult to say what needs to be changed to obtain a better result.The "Fit Options" settings has influence in positioning the dimension text/terminator, do you get different results disabling fit:
It would be great if could upload a testcase containing you source code which created this dimension element.For reference I have posted here a code example with title: "Create dimension element with true Alignment"
What I meant in last post was to use "move element" tool to move the dimension element, but not moving the handle of dimension element.
You will finally see a correct shape in CE5 and incorrect shape in V8i.
Thank you for your code example, compared with your example and I found that I didn't use:
DTransform3d dtrans = new DTransform3d(dmat); TransformInfo transform = new TransformInfo(dtrans); dimElement.ApplyTransform(transform);
dimElement.SetRotationMatrix(dmat);
Unknown said:What I meant in last post was to use "move element" tool to move the dimension element, but not moving the handle of dimension element.
I can see the different behavior with moving the element (not handle) between V8i and CONNECT. I just noticed the position of the handle before moving the element, and that´s not where I would expect it.But the resulting dimension element does not allow to determine what exactly caused the creation of this element without knowing the source code.Providing a test case containing the source code could help to understand this issue.
Thanks,
Artur
Unknown said: But the resulting dimension element does not allow to determine what exactly caused the creation of this element without knowing the source code.
But the resulting dimension element does not allow to determine what exactly caused the creation of this element without knowing the source code.
//<----Dimension---> DgnFile dgnFile = Session.Instance.GetActiveDgnFile(); DgnModel dgnModel = Session.Instance.GetActiveDgnModel(); DimensionStyle oDimStyle = DimensionStyle.GetSettings(dgnFile); DgnTextStyle txtStyle = DgnTextStyle.GetSettings(dgnFile); LevelHandle levelHandle = dgnFile.GetLevelCache().GetLevelByName('Default'); Symbology symb = new Symbology(); DirectionFormatter dirFormatter = new DirectionFormatter(dgnModel); oDimStyle.SetIntegerProp(2, DimStyleProp.General_Alignment_INTEGER); oDimStyle.SetBooleanProp(true, DimStyleProp.ExtensionLine_ShowAny_BOOLINT); oDimStyle.Replace(null, null); DimensionCreateData DimensionCreateData = new DimensionCreateData(oDimStyle, txtStyle, symb, levelHandle.LevelId, dirFormatter); DimensionElement dimEle = new DimensionElement(dgnModel, DimensionCreateData, DimensionType.SizeArrow); //Set Rotation double a = Math.Atan2(Converts.ToUOR(1000), Converts.ToUOR(1000)); DMatrix3d oMatrix = new DMatrix3d(Math.Cos(a), Math.Sin(a), 0, Math.Sin(a), Math.Cos(a), 0, 0, 0, 1); dimEle.SetRotationMatrix(oMatrix); //Set dimension Points dimEle.InsertPoint(calc.TranslateD(0, 0, 0), null, oDimStyle, 0); dimEle.InsertPoint(calc.TranslateD(Converts.ToUOR(1000), Converts.ToUOR(1000), 0), null, oDimStyle, 1); dimEle.SetHeight(Converts.ToUOR(500)); dimEle.ApplyDimensionStyle(oDimStyle, true); dimEle.AddToModel();
As I have not solved how to get the active dimension style's parameters (when no external dimension style created), with these code and a new dgn file you may generate a error dimension element with error parameter.or like thisJust use the previously uploaded dgn to prevent this kind of unknown errors.