AnsweredAssumed Answered

Vertical or Horizontal linear dimensions, can the API get this? (drawing).

Question asked by Lars Ahlzen on Sep 27, 2018
Latest reply on Sep 27, 2018 by Lars Ahlzen

Hi

 

Well, it seems I have yet another problem that needs assistance. So I am trying to figure out how the API can know if a drawing dimension is vertical or horizontal.

Like the picture:

VERTorHorizont.JPG

 

 

 

 

 

 

 

 

 

 

 

 

I have taken some advice from this API help script http://help.solidworks.com/2019/english/api/swdimxpertapi/get_dimxpert_display_dimensions_and_feature_example_vb.htm and this thread Horizontal or Vertical Dimension?

 

What I thought would work is this:

 

Dim DisplayDim As SldWorks.DisplayDimension

For i = LBound(vDimensions) To UBound(vDimensions)

     Set currDim = vDimensions(i)

     Set DisplayDim = currDim.GetSpecificAnnotation

     DimName = currDim.GetName

 

     Select Case (DisplayDim.Type2)

          Case swDimensionType_e.swLinearDimension

          Debug.Print DimName & "  Display dimension type = linear"

 

          Case swDimensionType_e.swHorLinearDimension

          Debug.Print DimName & "  Display dimension type = horizontal linear"

 

          Case swDimensionType_e.swVertLinearDimension

          Debug.Print DimName & "  Display dimension type = vertical linear"

 

     Case Else

          Debug.Print DimName & "  Display dimension type = unknown"

     End Select

Next

 

But even though I am intentionally putting in a vertical dimension and a horizontal dimension instead of using the smart dimension tool it returns as only linear. Maybe the drawing environment doesn't know if it is vertical or horizontal and just use linear all the time compared to the part environment that is more specific when it comes to linear dimensions. Maybe?

 

I have also tried to find the arrows positions to see if the x values of both the arrows are the same (then it is vertical) or the y values are the same (then it is horizontal). But I guess you can't get those coordinates... If anybody else has any smart solution to this I am all ears.

 

P.S If anybody has seen my previous posts I can tell you that I am still working on the same script and it is getting quite good wiyh the help I have gotten from the community, so thank you for that.

Outcomes