How would one add a sketchpoint to a midpoint of an arc? For a SketchLine its easy...
oSketch.GeometricConstraints.AddMidpoint oSketchPoint, oSketchLine
However, I can't see how to do the same operation to find the midpoint of a SketchArc. The interface of course has a selection filter for this so I assume the API can do the same?
-AP
Does anyone know about this? I'm trying to constrain a line endpoint to the vertex/midpoint of a sketch arc and can't seem to find a way to do it.
-Thomas
Hi Thomas,
I have some bad new that this is not currently possible using the API. Inventor was enhanced at some point to support creating a midpoint to an arc and the API was not updated at the time to support this so the API currently only supports creating midpoing constraints to the centers of lines.
I have logged a change request (1503866) for an enhancement to support this but don't know when it might be implemented.
Thanks for getting back to me on this. I was pulling my hair out trying to find a way to use the midpoint method. I'd be really interested to know how the construction line that runs from end to end on an "overall slot" is made. Have any ideas?
Is there a way to reference the arc as a line segment?
Thanks again for the help.
- Thomas
There's nothing special going to create the overall slot. It's just using the existing set of constraints. Here's a sample program that creates the identical result using the API.
Public Sub BuildSlot() Dim sk As PlanarSketch If Not TypeOf ThisApplication.ActiveEditObject Is Sketch Then MsgBox "A sketch must be active." Exit Sub Else Set sk = ThisApplication.ActiveEditObject End If Dim tg As TransientGeometry Set tg = ThisApplication.TransientGeometry Dim line1 As SketchLine Dim arc1 As SketchArc Dim line2 As SketchLine Dim arc2 As SketchArc Set line1 = sk.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(10, 0)) Set arc1 = sk.SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(10, 2), line1.EndSketchPoint, tg.CreatePoint2d(10, 4)) Set line2 = sk.SketchLines.AddByTwoPoints(arc1.EndSketchPoint, tg.CreatePoint2d(0, 4)) Set arc2 = sk.SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(0, 2), line2.EndSketchPoint, line1.StartSketchPoint) ' Add constraints. Dim geomConstraints As GeometricConstraints Set geomConstraints = sk.GeometricConstraints Call geomConstraints.AddTangent(line1, arc1) Call geomConstraints.AddTangent(line2, arc1) Call geomConstraints.AddTangent(line2, arc2) Call geomConstraints.AddTangent(line1, arc2) Call geomConstraints.AddParallel(line1, line2) Dim centerLine As SketchLine Dim centerPoint As SketchPoint Set centerLine = sk.SketchLines.AddByTwoPoints(tg.CreatePoint2d(-1, 2), tg.CreatePoint2d(11, 2)) centerLine.Construction = True Set centerPoint = sk.SketchPoints.Add(tg.CreatePoint2d(5, 2), False) Call geomConstraints.AddMidpoint(centerPoint, centerLine) ' Add constraints to tie line to the slot. Call geomConstraints.AddCoincident(centerLine, arc1.CenterSketchPoint) Call geomConstraints.AddCoincident(centerLine, arc2.CenterSketchPoint) Call geomConstraints.AddCoincident(centerLine.StartSketchPoint, arc2) Call geomConstraints.AddCoincident(centerLine.EndSketchPoint, arc1) End Sub
And you can't reference an arc as a line. They're two different types.
Can't find what you're looking for? Ask the community or share your knowledge.