- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Learning about sketching in a part file, I've run into a few issues that I wanted to reach out for development feedback on.
Issue #1 - ExitEdit
I'm finding I don't need the "ExitEdit" option when completing a sketch, using it only creates an error. I've found one example that used the "Solve" option prior to calling the exit, but this does not prevent the error.
oSketch.Solve oSketch.ExitEdit
In my current task, I need to create two separate sketches prior to creating the feature and it assumed I'd need the exit feature before starting the next sketch. Turns out I don't, but I'm curious why/where this option would be needed. Attempting to use these exit features currently yields the following error:
Issue #2 - Bad value results
I'm using a sketch to derive a value for me I've not found a trig formula for as yet. I need to find the resulting angle based upon some geometric references to an arc length from a known point in space. Creating a derived sketch and placing a driven dimension seems like a simple approach, however the value result of the driven dimension doesn't match the displayed result. Here's the code snippet:
'Create derived sketch to obtain needed values oWorkPlane = oCompDef.WorkPlanes("XY Plane") oSketch = oCompDef.Sketches.Add(oWorkPlane) 'create sketch on workplane oSketch.Name = "Derived Sketch" oBot = oSketch.AddByProjectingEntity(oArc(0)) oBot.Construction = True oCP1 = oSketch.AddByProjectingEntity(oArc(0).CenterSketchPoint) 'center point of outer edge radius oCP2 = oSketch.AddByProjectingEntity(oCompDef.WorkAxes.Item("Hole Axis")) 'center of hole location oLine(0) = oSketch.SketchLines.AddByTwoPoints(oCP1, oTG.CreatePoint2d(oQuad.X - 2, oQuad.Y)) oLine(1) = oSketch.SketchLines.AddByTwoPoints(oLine(0).EndSketchPoint, oCP2) oLine(2) = oSketch.SketchLines.AddByTwoPoints(oLine(1).EndSketchPoint, oTG.CreatePoint2d(oQuad.X + 2, oQuad.Y)) oLine(3) = oSketch.SketchLines.AddByTwoPoints(oLine(2).EndSketchPoint, oLine(0).StartSketchPoint) oGC = oSketch.GeometricConstraints oGC.AddCoincident(oLine(0).EndSketchPoint, oBot) 'constrain to outer edge radius oGC.AddCoincident(oLine(2).EndSketchPoint, oBot) 'constrain to outer edge radius oGC.AddEqualLength(oLine(1),oLine(2)) 'ensure orientation is symmetrical oTmp = oSketch.DimensionConstraints.AddTwoLineAngle(oLine(1),oLine(2),oQuad, False) 'create right angle constraint oTmp.Parameter.Value = 90 * PI / 180 oTmp = oSketch.DimensionConstraints.AddTwoLineAngle(oLine(0),oLine(3),oQuad, True) 'create driven angle to find angle result Dim oDrAngle As Double = oTmp.Parameter.Value MsgBox(oDrAngle) 'oSketch.Solve 'oSketch.ExitEdit
The driven angle result is stored to the variable "oDrAngle" and displays in radians as follows:
And converts to 4.395 degrees
Passing along the value to the revolve cut feature falls short of the desired intersection points, verifying that the value is clearly short of the intended location.
Can anyone explain why the value is not being returned correctly and what needs to be done in order to reach the correct value?
Solved! Go to Solution.