Submitted by jchen on Tue, 12/09/2014 - 15:17
Forums:
I'm currently trying to pull all the dimensions from a drawing into an Excel file, and I am also trying to get their X and Y coordinates (ex A1, C3 etc etc.)
Is it possible to do this with Journaling?
Would this be part of "Annotations.Dimension"?
Thank you so much!

re: dimension coordinates
You can get the dimension's coordinate information through the dimension object's .AnnotationOrigin property. This will report the numerical values of the X and Y position of the dimension.
However, given your example, A1 or C3, I assume you are looking for the sheet zone that contains the dimension. I could not find a direct way to get this information from the API (you can get this information for drafting views through the drawingSheet.GetSheetZoneReference or drawingSheet.GetZoneReference methods). I wrote some code that will query the drawing sheet's borders and zones and calculate the position of the dimension. The return value is in the format: {sheet number}{vertical zone letter}{horizontal zone number}; this is similar to the output from the drawingSheet object's .GetSheetZoneReference method.
Hi. Thanks for your help
Hi. Thanks for your help with this. Is there a private message function? I have some follow up questions and need help that I'd prefer not to ask on the public forum.
Thanks!
re: private message
Unfortunately we don't have a private message function; honestly, the forum itself was tacked on as almost an afterthought. However, you can email me directly at info@nxjournaling.com
What is the reference point
What is the reference point for .AnnotationOrigin? If the annotation (a dimension in my case) is considered a rectangle, which 'corner' is the origin?
re: annotation reference point
When you edit an annotation through the GUI, you can specify the "alignment position". There are three options for the horizontal alignment (left, center, and right) and three options for the vertical alignment (top, middle, and bottom), yielding a total of nine options for the alignment position.
When programming, you can access the annotation object's .AnnotationOrigin property; this property will report the location of the alignment position for the annotation object. The result may not be on a corner. You can calculate a "box" around the annotation by changing the alignment position to a corner (e.g. bottom left), making note of the origin, changing the alignment position to the opposite corner (e.g. top right) and making note of the new origin location.
Thanks! Are you sure that the
Thanks! Are you sure that the AlignmentPosition property changes the (X,Y) coordinate of the .AnnotationOrigin for the dimension? If I want to write a function to calculate the "area" of any dimension label, could I do something like this?
For a dim called myDimension:
Dim letteringPreferences1 As Annotations.LetteringPreferences
letteringPreferences1 = myDimension.GetLetteringPreferences()
letteringPreferences1.AlignmentPosition = Annotations.AlignmentPosition.TopLeft
letteringPreferences1.AlignmentPosition = Annotations.AlignmentPosition.TopLeft
Dim x1 As Integer = myDimension.AnnotationOrigin.X
Dim y1 As Integer = myDimension.AnnotationOrigin.Y
letteringPreferences1.AlignmentPosition = Annotations.AlignmentPosition.BottomRight
Dim x2 As Integer = myDimension.AnnotationOrigin.X
Dim y2 As Integer = myDimension.AnnotationOrigin.Y
To define the "area" could I do:
Dim area as New System.Drawing.Rectangle(x1,y1,(x2-x1),(y2-y1))
re: alignment position
Yes, changing the alignment position will change the coordinates returned from the .AnnotationOrigin property.
In theory, your code strategy will work but you will have to iron out the specifics (I don't think what you posted will work as-is).
I strongly suspect that the System.Drawing.Rectangle is NOT going to do what you want it to in this case, although not knowing what you are up to, I could be wrong on this point.
I'm finding that changing the
I'm finding that changing the alignment position does not change the coordinates returned from the .AnnotationOrigin property.
If you believe it does, would you mind posting some code that could retrieve the coordinates of the corners that define the "rectangle" that is the dimension?
re: alignment position
I can't post any code at the moment, but the code that you posted above won't work because you have not committed the changes back to the dimension object. After you change the alignment option, you will have to call myDimension.SetLetteringPreferences() before attempting to retrieve the .AnnotationOrigin.
Some rough pseudocode would be:
What version of NX are you using?
I'm currently on NX8.5. Here
I'm currently on NX8.5. Here is the code I have been working on. Essentially I want to check candidate locations for the balloon before placing it down, to avoid/minimize collisions with other features on the page. I'm trying to do so by representing the balloon and dimensions as rectangle, and checking for collisions with the .IntersectsWith method.
I realize this might be a lot to read through, but if you could shed any light on what might be going wrong, it would be very helpful! Right now the code runs but the balloons are not being placed in the right places.
This method is working
This method is working perfectly for my dimensions, but there is one issue. For dimensions in which the text is oriented vertically, the origin (x,y) of all four corners is the same point for some reason. Do you know why this might be the case?
re: vertical text
I doubt that is the intended behavior of vertical text. I'd suggest contacting GTAC and filing an Incident Report (IR). If they agree that it is a bug in the program, they will fix it in a future NX patch or version. In the meantime, they might be able to offer a work-around for your situation.