Finding the length of a bendline in a drawingview

Finding the length of a bendline in a drawingview

machiel.veldkamp
Collaborator Collaborator
322 Views
1 Reply
Message 1 of 2

Finding the length of a bendline in a drawingview

machiel.veldkamp
Collaborator
Collaborator

I'm looking for a way to get the length of bendlines in a drawing.

 

Reason it because I have small bendlines that I want to ignore. All other bendlines need a bendnote.

 

Now.... I can't get the length of the bendlines no matter what I try and I'm at a loss. HALP!

 

For Each oView In oSheet.DrawingViews
		For Each oCurve In oView.DrawingCurves
			If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _
				Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then
				Trace.WriteLine("CURVE NOW")
				
			
				
				oPoint1 = oCurve.StartPoint
				oPoint2 = oCurve.EndPoint
				dBendLength = oPoint1.DistanceTo(oPoint2)
				MessageBox.Show(" dBendLength: " & dBendLength, "Title")
				oEvaluator2D = oCurve.Evaluator2D
				
				Trace.WriteLine("CURVE NOW1")
				oEvaluator2D.GetEndPoints(dmin, dmax)
				
				
				Trace.WriteLine("CURVE NOW2")
				Call oEvaluator2D.GetLengthAtParam(dmin, dmax, Length)
				
				MessageBox.Show(" Length: " & Length, "Title")
				Trace.WriteLine("CURVE NOW3")
				

				Trace.WriteLine("Adding bendnote to bendline")
				
				If Length  > 1 ' Every bendline longer than 1mm
					oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
				End If
			End If
		Next 'oCurve
	Next 'oView

 image.png

 

If you have any other  idea on how to ignore the small bendline please share.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
323 Views
1 Reply
Reply (1)
Message 2 of 2

Sergio.D.Suárez
Mentor
Mentor

Hi, here you have an ilogic code that will place a bend note from a certain value. If there are bendings curves with lower values measured on the sheet, the rule will not place the bendnotes

 

Dim doc As DrawingDocument= ThisDoc.Document
Dim oSheet As Sheet = doc.ActiveSheet

Dim oValue As Double = InputBox("Place the minimum value in cm to place a BendNote", "Add BendNote", "1")

Dim oScale As Double

Dim MinParam As Double
Dim MaxParam As Double
Dim CurveLength As Double

Dim oBendNote As BendNote

For Each oView As DrawingView In oSheet.DrawingViews
	oScale = oView.Scale
	For Each oCurve As DrawingCurve In oView.DrawingCurves
		If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _
			Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then
				oCurve.Evaluator2D.GetParamExtents(MaxParam, MinParam)
				oCurve.Evaluator2D.GetLengthAtParam (MaxParam,MinParam, CurveLength)
				MessageBox.Show("Curve length measured on the Sheet: "  & CurveLength & " cm")
				MessageBox.Show("Real Curve length: " & CurveLength / oScale & " cm")
				
				If CurveLength >= oValue Then oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
		End If
	Next 'oCurve
Next 'oView

 I hope this helps. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes