Drawing Dimension Orientation(With some aligneddimensiontype dimensions)

Drawing Dimension Orientation(With some aligneddimensiontype dimensions)

bwangNYAKX
Contributor Contributor
1,254 Views
4 Replies
Message 1 of 5

Drawing Dimension Orientation(With some aligneddimensiontype dimensions)

bwangNYAKX
Contributor
Contributor

Hi Friends,

 

I have a VBA code that calculate the footprint of a system by multiplying the largest horizontal dimension on the base view and that on the right view. The code loop through all the drawing dimension object and for each one it checks whether it's orientation (By checking DimensionTypeEnum). If horizontal, it will record and find the largest value for base view and right view respectively(By checking the x of dimension origin).

 

This code runs well for many drawings but not all because on some drawings, some dimensions are kAlignedDimension Type for some reasons(We have thousands of drawings made by different people).

 

My questions are:  

1. Can I do anything else/extra to check the orientation of the drawing dimensions?

2.  I know drawing dimension object is under sheet object directly instead of the view object. Is there anyway I can know whether a dimension is on base view or right view, other than checking the coordinates of the dimension origin point?

 

I am not that knowledgeable in Inventor API. Thank you guys in advance.

 

 

 

Dim odrawingdim As LinearGeneralDimension
Dim oSheet As Sheet
Set oSheet = oDocument.ActiveSheet
Dim oL_FP, oW_FP As Double
                        oL_FP = 0
                         oW_FP = 0
 
                          For Each odrawingdim In oSheet.DrawingDimensions

                              If odrawingdim.DimensionType = kHorizontalDimensionType Then
                                    If odrawingdim.Text.Origin.X < (oSheet.Width / 2) And odrawingdim.OverrideModelValue > oL_FP Then
                                            oL_FP = odrawingdim.OverrideModelValue     
                                    ElseIf odrawingdim.Text.Origin.X > (oSheet.Width / 2) And odrawingdim.OverrideModelValue > oW_FP Then
                                            oW_FP = odrawingdim.OverrideModelValue
                                    End If       
                               End If
                          Next
0 Likes
Accepted solutions (1)
1,255 Views
4 Replies
Replies (4)
Message 2 of 5

yan.gauthier
Advocate
Advocate
Accepted solution

Hi,

 

Maybe you could use the DimensionLine value ?

 

If typeof odrawingdim.DimenisonLine is LineSegment2D then
    if odrawingdim.DimensionLine.Direction.X = 1 then
    'Dimension is Horizontal
    else if odrawingdim.DimensionLine.Direction.Y = 1 then
    'Dimension is vertical
    end if
end if

 

cheers 

0 Likes
Message 3 of 5

bwangNYAKX
Contributor
Contributor

That works(after adding direction.x=-1 as well), thanks so much buddy!

 

Do you by any chance know the answer to my second question? How to check if a view is a base view or a projected view?

0 Likes
Message 4 of 5

yan.gauthier
Advocate
Advocate

if Not DrawingView.ParentView is nothing then

    'Means this view is a projected view

end if

0 Likes
Message 5 of 5

bwangNYAKX
Contributor
Contributor

Thank you so much!!

0 Likes