Hello. I am working with a drawing that i`m going to use as template. I want 2 unfolded views, one with bend lines, and one without. I want to delete bendlines at the view called "FLAT2". Is there someone here that could help me?
Solved! Go to Solution.
Solved by FINET_Laurent. Go to Solution.
Solved by Andrii_Humeniuk. Go to Solution.
Hi @kairobert . If the line layer has the word "Bend" in its name, it becomes invisible. So make sure your bend line layers have the word "Bend" in their names, or change to your own.
Dim oDoc As Document = ThisDoc.Document
If Not TypeOf oDoc Is DrawingDocument Then Exit Sub
Dim oDDoc As DrawingDocument = oDoc
For Each oSheet As Sheet In oDDoc.Sheets
For Each oView As DrawingView In oSheet.DrawingViews
If oView.Name.Contains("FLAT2") AndAlso oView.IsFlatPatternView Then
For i As Integer = 1 To oView.DrawingCurves().Count
If oView.DrawingCurves()(i).Segments(1).Layer.Name.Contains("Bend") Then
oView.DrawingCurves()(i).Segments(1).Visible= False
End If
Next i
End If
Next
Next
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
Hi @kairobert,
Maybe this code would do the trick ? The commented line (19) might be useful if the layer is not the default layer :
Sub main
Dim doc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Inventor.Sheet = doc.ActiveSheet
Dim targetv As Inventor.DrawingView
For Each v As Inventor.DrawingView In s.DrawingViews
If v.Name = "FLAT2" Then
targetv = v
Exit For
End If
Next
If targetv Is Nothing Then Exit Sub
For Each dc As Inventor.DrawingCurve In targetv.DrawingCurves
For Each dcs As Inventor.DrawingCurveSegment In dc.Segments
If dcs.Layer.InternalName.Contains("1:Bend Centerline (ISO)") Then dcs.Visible = False
'If dcs.Layer.Name.Contains("Trait d'axe de pliage (ISO)") Then dcs.Visible = False
Next
Next
End Sub
Does this suits your needs?
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Can't find what you're looking for? Ask the community or share your knowledge.