Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete bend lines for spesific view

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
kairobert
226 Views, 2 Replies

Delete bend lines for spesific view

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?

 

kairobert_0-1692604313110.png

 

2 REPLIES 2
Message 2 of 3
Andrii_Humeniuk
in reply to: kairobert

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.

EESignature

Message 3 of 3
FINET_Laurent
in reply to: kairobert

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"

@LinkedIn     @JohnCockerill

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report