I need to use positional representations in our drawings in order to get proper views. However, when I try to get a workpoint's coordinates from the view using the workpointLocation method it returns the coordinates of the workpoint before the positional representation was applied which isn't useful.
A workaround that I've used previously is to create a centre mark for the workpoint and then get the coordinates of the centre mark using the IvExtGetCentermarkPosition function. This returns the drawing sheet coordinates of the workpoint but in this case what I need are the view coordinates of the workpoint (for creating dimensions using the IvExtCreateLinearDim and IvExtCreateAngularDim functions).
Does anyone know if there is any way to get the correct view coordinates of a workpoint when using a positional representation in a drawing?
Matt
Solved! Go to Solution.
Solved by mmeetsma. Go to Solution.
Try this way:
Dim newPoint As Point = IvExtGetCentermarkPosition(yourCenterMark, "in")
Dim newPointX As Number = localX(newPoint , world? := False)
Dim newPointY As Number = localY(newPoint , world? := False)
No joy. This just returns the X and Y coordinates from the drawing sheet. I need the coordinates from the view.
Matt
Ok. Try this way:
Method workpointLocation(workpointPart As Part, workpointName As String) As Point
Dim modelPoint As Point = model.occurrenceWorkPoint(workpointPart, workpointName, :All)
workpointLocation = iv_modelToView(self(), modelPoint)
End Method
That looks like the default workpointLocation method. It will only return the coordinates of the workpoint from the actual model instead of from the positional representation.
Way back in the Intent 1.2 days the workpointLocation method did work because the occurrenceWorkPoint method that it calls had an optional paramter to send it a positional representation to use. That optional parameter has been removed since then.
Matt
I get some very different results here. Are you using constraints or frame based positioning?
This is the drawing without the positional representation applied:
And this is the drawing with the positional representation applied:
Matt
I used constraints in my previous example, because it easy to adjust on Intent level.
I'm stuck on frame based with no easy path back to constraints at this point. Also, it looks like your example just moved a single part in the assembly while I need to rotate the entire assembly which may be affecting things differently.
Why you don't use edges(vertices) to define dimensions? Why working points?
A lot of legacy design and code that I'm not interested in reworking to use entities instead of workpoints. Also, I don't think that IvLinearDimension and IvAngularDImension can properly handle all of the dimensions that we need.
Matt
You can modify existing designs of linear and angular dimensions as you need using API. Just for example, see attached file.
Child rule example:
Child OverallLength As :IvLinearDimension
part1 = yourPart
entity1 = yourEntity
textOrigin = funcpointLnrDimOffset(:Up, 1) ' (:Up, :Down, :Right, :Left)
formattedText = "<DimensionValue/>"
dimType = :horizontal ' (:vertical, :horizontal, :aligned, :arcLength, :symmetric, :diametric)
centerText? = True
End Child
Sometimes to build something need destroy something
Steps to work around this issue are:
1. Create a centre mark for the workpoint that you need to get coordinates from. Set visiblity to false so that it doesn't appear in the drawing.
2. Use the IvExtGetCentermarkPosition function to get the drawing sheet space coordinates of the workpoint via the centre mark created in step 1.
3. Use the DrawingView.SheetToDrawingViewSpace method in the Inventor API to transform the sheet space coordinates from step 2 to the correct drawing view space coordinates.
Matt