Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

The question of Create sectionView

Stakin
Advocate

The question of Create sectionView

Stakin
Advocate
Advocate

Hi,Everyone

Recently,I want to use logic o create section view, but the code I write doesn't work. Great God, please help me see what went wrong.

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument 
      
Dim oSheet As Sheet
oSheet = oDrawingDoc.Sheets.Item(1)
       
Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(-1500#, -1500#)
Dim oView1 As DrawingView
oView1=oSheet.DrawingViews.Item(1)
Dim oPoint2 As Point2d
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(1000#, 1000#)
Dim oPoint3 As Point2d
oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(-100#, 100#)
Dim oDrawingSketch As DrawingSketch
oDrawingSketch = oView1.Sketches.Add
    
oDrawingSketch.Edit
Dim oSketchLine As SketchLine
oSketchLine = oDrawingSketch.SketchLines.AddByTwoPoints(oPoint1, _
    oPoint2)
oDrawingSketch.ExitEdit


 Dim oView2 As SectionDrawingView

oView2 = oSheet.DrawingViews.AddSectionView(oView1, _
     oDrawingSketch, oPoint3, kHiddenLineRemovedDrawingViewStyle,,,,,,)

oDrawingSketch.Visible = False
0 Likes
Reply
Accepted solutions (1)
328 Views
1 Reply
Reply (1)

Stakin
Advocate
Advocate
Accepted solution

 

I find the error.

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument 
      
Dim oSheet As Sheet
oSheet = oDrawingDoc.Sheets.Item(1)
       
Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(-1500#, -1500#)
Dim oView1 As DrawingView
oView1=oSheet.DrawingViews.Item(1)
Dim oPoint2 As Point2d
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(1000#, 1000#)
Dim oPoint3 As Point2d
oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(-100#, 100#)
Dim oDrawingSketch As DrawingSketch
oDrawingSketch = oView1.Sketches.Add
    
oDrawingSketch.Edit
Dim oSketchLine As SketchLine
oSketchLine = oDrawingSketch.SketchLines.AddByTwoPoints(oPoint1, _
    oPoint2)
oDrawingSketch.ExitEdit


 Dim oView2 As SectionDrawingView

oView2 = oSheet.DrawingViews.AddSectionView(oView1, _
     oDrawingSketch, oPoint3, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle,,,,,,)

'oDrawingSketch.Visible = False
0 Likes