Bendnote Ilogic

Bendnote Ilogic

Darkforce_the_ilogic_guy
Advisor Advisor
1,116 Views
7 Replies
Message 1 of 8

Bendnote Ilogic

Darkforce_the_ilogic_guy
Advisor
Advisor

Is there a way to get ilogic to check it there is any Bendnote on the Drawing ?

0 Likes
Accepted solutions (1)
1,117 Views
7 Replies
Replies (7)
Message 2 of 8

Sergio.D.Suárez
Mentor
Mentor

Hello, I use this code to add blessings to all views that are unfolded
First delete the existing bend, then add the new bend.
You can specify a font and height, it is an example that searches in all the sheets, you can select part of the code that you need

 

Sub Main
	Dim tip As Document = ThisDoc.Document
	If tip.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject  Then	
		Delete_BendNote
		Add_BendNote
	Else
		MessageBox.Show("You must open a drawing file", "Add BendNote_All Sheet")
	End If
End Sub

Sub Delete_BendNote()
Dim oDrawDoc As Document
oDrawDoc = ThisDoc.Document

For Each oSheet In oDrawDoc.Sheets
For Each oGeneralNote In oSheet.DrawingNotes.bendnotes	
oGeneralNote.Delete		
Next
Next
End Sub

Sub Add_BendNote()

sFont = "ISOCPEUR" ' "ISOCP_IV25" 'Font Note
sFSize1 = 0.25 'Font Size in cm  

Dim oDrawDoc As Document
oDrawDoc = ThisDoc.Document

Dim oSheet As Sheet
Dim oView As DrawingView
Dim oCurve As DrawingCurve
Dim oBendNote As BendNote
oDoc = ThisApplication.ActiveDocument
oSheet = oDoc.ActiveSheet
For Each oSheet In oDrawDoc.Sheets
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

oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
d1= "<StyleOverride Font='" & sFont & "' FontSize='" & sFSize1 & "'>" & oBendNote.Text & "</StyleOverride>"
oBendNote.FormattedText= d1
oBendNote.HideValue=True
End If
Next
Next
Next

End Sub

 I hope it helps solve your problem


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

Message 3 of 8

Thanks for to code .. I might use to  make some upgrade to the code I already have...but My problem is that I must of the time I just want to add all the bent note, but not always… so I want it to add all if there is no bent note at all.  But it there are some it shall do nothing.

 

This is because I know that we have a few drawing where add all bent note will be too mush … I what I want to do is to save time by make ilogic add bent note on by before save … but if I need to delete some of them … I do not work this code to override my work 

0 Likes
Message 4 of 8

Accepted solution

Hi, Here you have a simplified code. If there is a bendnote in a sheet, it will not do anything on that sheet. If there is no bendnote in a sheet, add bendnotes to that sheet. To do this, count the number of bendnotes per sheet, and if they are equal to zero, activate the code.
I'm not sure this is what you want, I hope it helps you develop your code. regards

 

sFont = "ISOCPEUR" ' "ISOCP_IV25" 'Font Note
sFSize1 = 0.25 'Font Size in cm  

Dim oDrawDoc As Document
oDrawDoc = ThisDoc.Document

For Each oSheet In oDrawDoc.Sheets
oCount = oSheet.DrawingNotes.bendnotes.count

	If oCount = 0 Then
		Dim oCurve As DrawingCurve
		Dim oBendNote As BendNote

		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

				oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
				d1= "<StyleOverride Font='" & sFont & "' FontSize='" & sFSize1 & "'>" & oBendNote.Text & "</StyleOverride>"
				oBendNote.FormattedText= d1
				oBendNote.HideValue=True
				End If
			Next
		Next
	End If
Next

 


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

Message 5 of 8

I did do some minor changes but all in all .. that was just what I needed thanks 

0 Likes
Message 6 of 8

Crstiano
Collaborator
Collaborator

Hi Sergio,

 

Do you have some tip for edit the position of the BendNotes ?
I tried:

Sub AlignBendNotes()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet
Dim oDrawingNote As DrawingNote
Dim oDrawingNotes As DrawingNotes
Dim oNotes As ObjectCollection
Set oBendNotes = oSheet.DrawingNotes.BendNotes

For n = 1 To oBendNotes.Count   
    Dim oPos As Point2d
    Set oPos = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.DrawingViews.Item(3).Center.X + (oSheet.DrawingViews.Item(3).Width / 2) + 3 _
    , oBendNotes.Item(n).Position.Y)
    oBendNotes.Item(n).Position = oPos  
Next
 oDoc.Update
End Sub

And for any reasons nothing happens..

Are there suggestions or include in your example code, how to set the position when add the bendnote.

 

Thanks in advance.

 

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Cristiano Oliveira
EESignature
ConsultCAD.com

Message 7 of 8

Crstiano
Collaborator
Collaborator

The solution.

 

 oBendNote.Position = ThisApplication.TransientGeometry.CreatePoint2d(X, Y)

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Cristiano Oliveira
EESignature
ConsultCAD.com

Message 8 of 8

Sergio.D.Suárez
Mentor
Mentor

Excuse me, I just see the notification. I'm glad you solved the problem!


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