I'm trying to get Inventor 2012 (64 bit) to show the complementary angle to the bend angle in the bend annotation on a flat pattern within a drawing. I.e. the bend annotation shows: "10 UP" for a ten degree bend. I want it to show: "10 (170) up, where 170 degrees would be the complement to that angle, automatically. I know I could type it in, but then it will not update itself if I cange that angle.
Thanks for your help!
Currently it does not support to automatically update the bend note result you want. But maybe you could consider iLogic or API for solution.
Thanks River, iLogic certainly seems like a promising solution. Unfortunately, I do not have any experience using iLogic. I used to know Visual Basic though and it appears very similar. Could you possibly give me a push in the right direction as far as how/where to start? I assume it would be in the drawing I want it to appear in. But I can't find any syntax referencing the bend angle as a starting point.
I'm imagining it would look something like: 'If' there is a bend angle notation, 'then' insert (180-BendAngle). Am I way off?
Thanks for your help, I really appreciate it.
Nathan
Please refer the solution in the attached IDW. When changing the bend angle in IPT, and change to IDW, the angle will be updated when running the macro. Maybe the tolerance in bend note will display, there is no way to be controlled as the API related to this is not exposed yet. But you could edit the bend note to remove the tolerance display. For the code lines in macro, these are just a sample for reference.
Hope it helpful for you!
River,
That does almost exactly what I'm looking for. It's too bad that it could not update automatically, but this will be functional for me as a substitute. But do you know of a way to apply a user defined dimension style (i.e. "Flat Pattern") to the bend note after adding the complementary angle in the macro?
Otherwise, the only solution I can think of that will remove the symmetric tolerance from the bend note is to re-split the bend note string and delete the part between the two angle symbols. Or I have to manually redefine the style for all the bends after running the macro.
Thanks, I really appreciate your help on this.
Nathan
River,
I've been playing with that code a little and I still can't get it to do what I want, but I feel like it should be able to. Could something like what I added below define the style for the bend note after it is edited or am I just beating a dead horse here?
I get error 438 on the "oNote.Style = oNewDimStyle" to say that the object does not support this property or method. Any alternatives??
***
Sub Test()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oView As DrawingView
Set oView = oDoc.ActiveSheet.DrawingViews(1)
Dim oNewDimStyle As DimensionStyle
Set oNewDimStyle = oDoc.StylesManager.DimensionStyles.Item("Architectural (ANSI)")
Dim oNote As BendNote
Dim sTemp() As String
Dim sTemp1() As String
Dim iAngle As Double
For Each oNote In oDoc.ActiveSheet.DrawingNotes
If oNote.Type = kBendNoteObject Then
sTemp = Split(oNote.Text, " ")
For i = 0 To UBound(sTemp)
If InStr(sTemp(i), "°") > 0 Then
iAngle = CDbl(Split(sTemp(i), "°")(0))
If InStr(oNote.FormattedBendNote, "(") > 0 Then
sTemp1 = Split(oNote.FormattedBendNote, "(")
oNote.FormattedBendNote = Replace(oNote.FormattedBendNote, Split(sTemp1(1), ")")(0), CStr(180 - iAngle))
Else
oNote.FormattedBendNote = Replace(oNote.FormattedBendNote, "</BendAngle>", "</BendAngle>" & "(" & CStr(180 - iAngle) & ")")
oNote.Style = oNewDimStyle
End If
Exit For
End If
Next
End If
Next
End Sub
***
The code lines do work fine for me. So could you attach the drawing document for more investigation?
I'm still testing on the same part you sent me (reattached here). But I cannot get the bend note to format as 'Architectural (ANSI)' to get rid of the tolerance note attached to the bend degree and radius.
I guess there is no "Architectural (ANSI)" dimension style in your environment, and errors throws when running the code line - Set oNewDimStyle = oDoc.StylesManager.DimensionStyles.Item("Architectural (ANSI)")
So could you try to replace the code line above to this -
Set oNewDimStyle = oDoc.StylesManager.DimensionStyles.Item(1)
Does this work fine for you?
Unfortunately, it doesn't. I do not get an error when running that line. I get it when running the line: oNote.Style = oNewDimStyle
It returns error 438: Object doesn't support this property or method. Any more ideas?
Could you attach the image for drawing document opened? Or send me @ river-yijiang.cai@autodesk.com?
following up on this macro, it fails at any annotated leader,
I'm trying to follow the process, but I have questions,
it appears to stop when it encounters something not kBendNoteObject, because of a type mismatch. but i can't find any information on the type of the two notes, so I am at a loss to proceed around it.
could you please help
Sub COMPANGLES()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oview As DrawingView
Set oview = oDoc.ActiveSheet.DrawingViews(1)
Dim oNewDimStyle As DimensionStyle
Set oNewDimStyle = oDoc.StylesManager.DimensionStyles.Item("RASOR")
Dim oNote As BendNote
Dim sTemp() As String
Dim sTemp1() As String
Dim iAngle As Double
For Each oNote In oDoc.ActiveSheet.DrawingNotes
If oNote.Type = kBendNoteObject Then
sTemp = Split(oNote.Text, " ")
For i = 0 To UBound(sTemp)
If InStr(sTemp(i), "90.0°") = 0 Then
If InStr(sTemp(i), "°") > 0 Then
iAngle = CDbl(Split(sTemp(i), "°")(0))
If InStr(oNote.FormattedBendNote, "(") > 0 Then
sTemp1 = Split(oNote.FormattedBendNote, "(")
oNote.FormattedBendNote = REPLACE(oNote.FormattedBendNote, Split(sTemp1(1), ")")(0), CStr(180 - iAngle))
oNote.DimensionStyle = oNewDimStyle
Else
oNote.FormattedBendNote = REPLACE(oNote.FormattedBendNote, "</BendAngle>", "</BendAngle>" & "(" & CStr(180 - iAngle) & ")")
oNote.DimensionStyle = oNewDimStyle
End If
End If
Exit For
End If
Next
End If
Next
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.