Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
Solved! Go to Solution.