04-08-2022
04:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-08-2022
04:34 AM
Something like this should do:
I have changed the BreakInfo class to a list of double arrays with 2 values. The first being the start coordinate and the second the break length. It should consider scale and the breaking gap. You can change this to take any amount of double arrays as input.
There is no error catching or anything, if the break exceeds the view an error will be thrown.
Dim dwg = CType(ThisApplication.ActiveDocument, DrawingDocument)
Dim sht = dwg.ActiveSheet
Dim tg = ThisApplication.TransientGeometry
Dim v = sht.DrawingViews.Item(1)
Dim defaultGap = 0.6
For Each breakOp As BreakOperation In v.BreakOperations
breakOp.Delete()
Next
Dim breakInfos = New List(Of Double())() From {
New Double() {25.0, 50.0},
New Double() {100.0, 50.0},
New Double() {180.0, 50.0}
}
Dim previousGaps = 0.0
Dim i = 1
For Each breakInfo In breakInfos
Dim leftPoint = v.Center.X - v.Width / 2
Dim newStartCoord As Double = breakInfo(0) - previousGaps
Dim scaled As Double = (newStartCoord * v.Scale)
Dim startPoint = tg.CreatePoint2d(leftPoint + scaled, v.Center.Y)
Dim endPoint = tg.CreatePoint2d(leftPoint + scaled + (breakInfo(1) * v.Scale) + (defaultGap) / 2, v.Center.Y)
Dim mSpaceStartPoint = tg.CreatePoint(0, 0, breakInfo(0))
Dim vSpaceStartPoint = v.ModelToSheetSpace(mSpaceStartPoint)
Dim actualStartPoint = tg.CreatePoint2d(vSpaceStartPoint.X, v.Center.Y)
Dim actualEndPoint = tg.CreatePoint2d(vSpaceStartPoint.X + (BreakInfo(1) * v.Scale), v.Center.Y)
v.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPoint, endPoint, BreakStyleEnum.kStructuralBreakStyle)
previousGaps += breakInfo(1)
i += 1
Next
Let me know if you need more help
Contact me for custom app development info@basautomationservices.com. Follow below links to view my Inventor appstore apps.
Free apps: Smart Leader | Part Visibility Utility | Mate Origins
Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro
Free apps: Smart Leader | Part Visibility Utility | Mate Origins
Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro