I'm using SW2017 SP3, and I'm trying to dimension a flat pattern metal sheet on a drawing document.
The whole macro does a little more than that, so below is a short version of what I want (and was supposed to achieve):
What I have:
- The flat pattern view;
- All the bend lines visible;
- A list with the horizontal bend lines and another one with the vertical ones (the macro does that);
- The extreme vertexes (bottom-left; bottom-right; up-left; up-right) (the macro does that).
When I want to add the dimension on this view, I've tried both methods that the SW documentation mentions that should work:
1. Select the baseline, call the function, and then select all the entities I want to dimension before calling Part.SetPickMode. Also, when I record a macro of the process this is the code SW gives me. But that doesn't come close to work, it just creates de 0 point.
2. Then, I've tried to select all the entities that I want (and keep then selected, of course) before calling the function. This method gives me the 0 point and the final point (both the initial and end vertexes that I mentioned before), but it just ignores the bend lines selected.
boolstatus = Drawing.Extension.SelectByID2("Drawing View2", "DRAWINGVIEW", 0, 0, 0, True, 0, Nothing, 0)
If v > 0 Then
For j = 0 To UBound(verArray)
Set swLine = verArray(j)
swLine.Select4 True, Nothing ¹
Next
End If
swVertexLeft.Select4 True, Nothing
swVertexRight.Select4 True, Nothing
longwarnings = Drawing.Extension.AddOrdinateDimension(3, 0.100794347591096, 9.53150503563162E-02, 0)
Drawing.SetPickMode
'longstatus = Drawing.AutoDimension(2, 2, -1, 3, 1) ²
Drawing.ClearSelection2 True
¹ I've also tried to use SelectByID2, the result is pretty much the same.
² When I use AutoDimension, SW recognizes and dimension all the bendlines, but it does so in a kind-of-random way that can cause me some problems, such as overwriting dimension lines over bendlines.
Has anybody experienced the same behavior? Is that a SW flaw or am I missing something here?
Thanks for you help, I'm knocking my head around it for a month now.
SolidworksApi/macros