Remove Bend Note For High Bend Radius Value

Remove Bend Note For High Bend Radius Value

f_yilmaz_82
Contributor Contributor
525 Views
6 Replies
Message 1 of 7

Remove Bend Note For High Bend Radius Value

f_yilmaz_82
Contributor
Contributor
Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oView As DrawingView
Dim oCurve As DrawingCurve
Dim oBendNote As BendNote

oDoc = ThisApplication.ActiveDocument
oSheet = oDoc.ActiveSheet

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
	' Create the bend note
	oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
  End If
 Next 'oCurve
Next 'oView

 

I am using this rule to create bend note. 

Is it possible not to create the note if the bend radius value greater than 10mm.  

How can i do that

0 Likes
Accepted solutions (1)
526 Views
6 Replies
Replies (6)
Message 2 of 7

Cadkunde.nl
Collaborator
Collaborator

Well I tried some things with oCurve.

But run into errors all the time.

 

I am sure this isn't the best solution, and not very proud, but it works and perhaps helps you untill someone has a better solution.

 

I check the bendnote, for me the text is "DOWN 90,0° R5"

Now what i do is get the position of the last "R" and then take the number behind it.

Then I check if that value is > 10, if so delete it.

 

 

Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oView As DrawingView

Dim oBendNote As BendNote

oDoc = ThisApplication.ActiveDocument
oSheet = oDoc.ActiveSheet

For Each oView In oSheet.DrawingViews
 For Each oCurve As Inventor.DrawingCurve In oView.DrawingCurves
  If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _
  Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then

	oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
	
	Dim strNote As String = oBendNote.Text
	Dim pos As Integer = InStrrev(strNote, "R")
	Dim strSize As String = Right(strNote, len(strNote)-pos)
	Dim dblSize As Double = Cdbl(strSize)
	If dblSize > 10 Then
		oBendNote.Delete
	End If
  End If
 Next 'oCurve
Next 'oView

 

0 Likes
Message 3 of 7

f_yilmaz_82
Contributor
Contributor

Hello.

Thanks so much for your reply. I tried it but unfortunately it doesn't work. It doesn't react.

0 Likes
Message 4 of 7

Cadkunde.nl
Collaborator
Collaborator

If you just copy paste it without reading it, it most likely fails.

My bend note = "DOWN 90,0° R5"

With this code i look for the position of the last "R" then keep everything behind it, so for me it results in "5"

Dim pos As Integer = InStrrev(strNote, "R")

So what does your Bendnote look like?

0 Likes
Message 5 of 7

f_yilmaz_82
Contributor
Contributor

f_yilmaz_82_0-1679058782639.png

This is my bendnote

0 Likes
Message 6 of 7

Cadkunde.nl
Collaborator
Collaborator
Accepted solution
Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oView As DrawingView

Dim oBendNote As BendNote

oDoc = ThisApplication.ActiveDocument
oSheet = oDoc.ActiveSheet

For Each oView In oSheet.DrawingViews
 For Each oCurve As Inventor.DrawingCurve In oView.DrawingCurves
  If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _
  Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then

	oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
	
	Dim strNote As String = oBendNote.Text
	Dim pos As Integer = InStrRev(strNote, "R")
	Dim strsize As String = Right(strNote, Len(strNote) -pos)
	strsize = strSize.Replace(",", ".")
	Dim dblSize As Double = CDbl(strsize)
	msgbox(strSize & vbLF & dblSize)
	
	If dblSize > 10 Then
		oBendNote.Delete
	End If
  End If
 Next 'oCurve
Next 'oView

Well I did a check and a bend of 3,05 became value of 305, because it was larger than >10 it got removed

I replace the comma with a dot, and now for me it works

0 Likes
Message 7 of 7

f_yilmaz_82
Contributor
Contributor

Ok it is working now. Thank You so much

0 Likes