03-06-2019
09:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-06-2019
09:15 AM
Finally found the solution to the problem. Have to find the view the sketch is on first, then iterate through all sketches on the view to find the ones to update by name. Delete the line and re-add the line for the section view.
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
' Get the view the section views are being created from
Dim oView As DrawingView = ActiveSheet.View("FRONT VIEW").View
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oSketch As DrawingSketch
Dim line As SketchLine
Dim vertLinePoint As Double = oView.Height / oView.Scale / 2 + 2
Dim horzLinePoint As Double = oView.Width / oView.Scale / 2 + 2
For Each oSketch In oView.Sketches
Select Case oSketch.Name
Case "vert"
' Open the sketch for edit.
oSketch.Edit
' delete all lines in sketch
For Each line In oSketch.SketchLines
line.Delete
Next
' redraw line in the sketch to move section view
Call oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, vertLinePoint), oTG.CreatePoint2d(0, -vertLinePoint))
' Exit from editing the sketch.
oSketch.ExitEdit
Case "horz"
' Open the sketch for edit.
oSketch.Edit
' delete all lines in sketch
For Each line In oSketch.SketchLines
line.Delete
Next
' redraw line in the sketch to move section view
Call oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(horzLinePoint, 0), oTG.CreatePoint2d(-horzLinePoint, 0))
' Exit from editing the sketch.
oSketch.ExitEdit
End Select
Next