Inventor Vb.Net "Stand Alone" Verses "AddIn"

Inventor Vb.Net "Stand Alone" Verses "AddIn"

isocam
Collaborator Collaborator
564 Views
2 Replies
Message 1 of 3

Inventor Vb.Net "Stand Alone" Verses "AddIn"

isocam
Collaborator
Collaborator

Can anybody help?

 

I have the following Vb.Net code that works great with a "Stand Alone" appiclation.

 

Sub GetTubeDimensions(oDoc)
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition

Dim oSketch As PlanarSketch = Nothing

For Each oSketch In oCompDef.Sketches
Dim oSketchCircles As SketchCircles = oSketch.SketchCircles

Dim oSketchCircle As SketchCircle

If oSketchCircles.Count = 2 Then
For Each oSketchCircle In oSketchCircles
Counter += 1

Dim oDia As Double = (oSketchCircle.Radius * 2) * 10

IMsgbox(oDia)
Next
End If
Next
End Sub

 

However, when I use the above code in a Inventor Vb.Net "AddIn" the code does not work.

 

Does anybody know how the code needs modifying to make it work in an "AddIn"?

 

 

Many thanks in advance!

 

Darren

0 Likes
565 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

us this in your module:

 

mports Inventor
Imports System.Reflection

Module Module1

Sub GetTubeDimensions(oDoc As PartDocument)
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition

Dim oSketch As PlanarSketch = Nothing

For Each oSketch In oCompDef.Sketches
Dim oSketchCircles As SketchCircles = oSketch.SketchCircles

Dim oSketchCircle As SketchCircle

If oSketchCircles.Count = 2 Then
For Each oSketchCircle In oSketchCircles
''Counter += 1

Dim oDia As Double = (oSketchCircle.Radius * 2) * 10

MsgBox(oDia)
Next
End If
Next
End Sub

End Module

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

bradeneuropeArthur
Mentor
Mentor

unzip this to your add-in folder

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes