Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing Dimension Orientation(With some aligneddimensiontype dimensions)

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
bwangNYAKX
880 Views, 4 Replies

Drawing Dimension Orientation(With some aligneddimensiontype dimensions)

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
Labels (1)
4 REPLIES 4
Message 2 of 5
yan.gauthier
in reply to: bwangNYAKX

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 

Message 3 of 5
bwangNYAKX
in reply to: yan.gauthier

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?

Message 4 of 5
yan.gauthier
in reply to: bwangNYAKX

if Not DrawingView.ParentView is nothing then

    'Means this view is a projected view

end if

Message 5 of 5
bwangNYAKX
in reply to: yan.gauthier

Thank you so much!!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report