Angular Dimension Between Two Sketch Lines

Angular Dimension Between Two Sketch Lines

danijel.radenkovic
Collaborator Collaborator
1,369 Views
3 Replies
Message 1 of 4

Angular Dimension Between Two Sketch Lines

danijel.radenkovic
Collaborator
Collaborator

Hello,

I am searcing for the way to create angular dimension between two lines, but I have a little problem. Please take a look to the code for the more info.

 

Option Explicit

Public Sub AngleBetweenTwoSketchLines()
    
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
                    
    Dim oDef As PartComponentDefinition
    Set oDef = oDoc.ComponentDefinition
    
    Dim oSketch As PlanarSketch
    Set oSketch = oDef.Sketches.Add(oDef.WorkPlanes(3))
    
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    
    Dim oOriginPoint As SketchPoint
    Set oOriginPoint = oSketch.AddByProjectingEntity(oDef.WorkPoints.Item(1))
            
    Dim oSketchLine1 As SketchLine
    Set oSketchLine1 = oSketch.SketchLines.AddByTwoPoints(oOriginPoint, oTG.CreatePoint2d(0, 15))
       
    Dim oSketchLine2 As SketchLine
    Set oSketchLine2 = oSketch.SketchLines.AddByTwoPoints(oOriginPoint, oTG.CreatePoint2d(15, 15))
          
    Dim oAngleDim As DimensionConstraint
    Set oAngleDim = oSketch.DimensionConstraints.AddThreePointAngle(oSketchLine1.EndSketchPoint, oOriginPoint, oSketchLine2.EndSketchPoint, oTG.CreatePoint2d(100, 100), False)
    Dim PI As Single
    PI = 4 * Math.Atn(1)
    oAngleDim.Parameter.Value = ((30) * PI) / 180
    ' Inventor will create OUTSIDE angular dimension not between lines
    ' I can use: oAngleDim.Parameter.Value = ((180 - 30) * PI) / 180 to get that I want
    ' BUT as input I am using only inner angles not outer so I can't always make manual check will it dimension righ or wrong
    oDoc.Update
    ThisApplication.ActiveView.Fit
             
End Sub
Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Accepted solutions (1)
1,370 Views
3 Replies
Replies (3)
Message 2 of 4

danijel.radenkovic
Collaborator
Collaborator

Up.

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Message 3 of 4

ekinsb
Alumni
Alumni
Accepted solution

It behavs similar to how the command behaves.  The quadrant that is dimensioned is based on which quadrant the dimension text is orginally placed in.  You're using (100,100) as the dimension text location which happens to be right on the second line and Inventor is somewhat arbitrarily choosing to dimension the outside angle.  If I change it to (90,100) then the inside angle is what's controlled.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 4 of 4

danijel.radenkovic
Collaborator
Collaborator

Hello Mr. Ekins,

Now I understand how it works.

Thank you very much! Smiley Happy

 

 

Regards

Danijel

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes