Dimension constraint positioning
Not applicable
09-23-2019
07:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want create the situaition as in the photo via ilogic. I know how to create a line add the constraints and the dimension constraint. The problem i encountered is postioning the dimension constraint a little above the line and in the middle of the line.
Is there anyway to automaticly postion the dimension constraint like in the picture via ilogic for any kind of view and any line length????
Here is the code so far:
Dim partDoc As PartDocument partDoc = ThisApplication.activedocument Dim partDef As Inventor.PartComponentDefinition partDef = partDoc.ComponentDefinition 'set a reference to the transient geometry collection. Dim oTransGeom As TransientGeometry oTransGeom = ThisApplication.TransientGeometry ' Create a new sketch. Dim oSketch As PlanarSketch oSketch = partDef.Sketches.Add(partDef.WorkPlanes.Item(1), False) oSketch.edit Dim oOriginSketchPoint As SketchPoint = oSketch.AddByProjectingEntity(PartDef.WorkPoints.Item(1)) oline=oSketch.SketchLines.AddByTwoPoints (oOriginSketchPoint, ThisApplication.TransientGeometry.CreatePoint2d(-100,0)) oSketch.GeometricConstraints.AddHorizontal(oline) oSketch.DimensionConstraints.AddTwoPointDistance(oline.startSketchPoint,oline.EndSketchPoint, DimensionOrientationEnum.kHorizontalDim,ThisApplication.TransientGeometry.CreatePoint2d(0,oline.Length*0.1))