VB.NET Propertysets

VB.NET Propertysets

snappyjazz
Collaborator Collaborator
1,678 Views
5 Replies
Message 1 of 6

VB.NET Propertysets

snappyjazz
Collaborator
Collaborator

I am a newbie to Visual basic/inventor API. I am using Inventor PRO 2019 with visual studio 2017. I am trying to create custom content center families. There are properties I am putting on the family templates, who's values can be read from the family properties. For instance, when creating a new 45 deg threaded elbow family; I would like to get the size of the connections from the table, get the "threaded" end type from the family name, etc. My code breaks when trying to retrieve the property sets.

Imports System
Imports System.Type
Imports System.Activator
Imports System.Runtime.InteropServices
Imports Inventor


Module Module1
    Sub Main()
        Dim _invDoc As Inventor._Document
        Dim customPropertySet = _invDoc.PropertySets.Item("Inventor User Defined Properties")

        MsgBox(customPropertySet.ToString)

    End Sub

End Module
0 Likes
Accepted solutions (1)
1,679 Views
5 Replies
Replies (5)
Message 2 of 6

Sergio.D.Suárez
Mentor
Mentor

Hi, excuse me if I mention something wrong.
In your code I see that you have defined the type of variable in
"Dim _invDoc As Inventor._Document"
I suppose that is fine, but the value of it is not defined or where it comes from, and then it is used in the following line of
"Dim customPropertySet = _invDoc.PropertySets.Item (" Inventor User Defined Properties ")"
So, what is the same expression _invDoc =?
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
Message 3 of 6

snappyjazz
Collaborator
Collaborator

@Sergio.D.Suárez 

Thanks for responding so quickly. I am not sure what the value should be. I am trying to descend the object model tree (Photo below) and am failing.  Can you please help me?

 

2019 Inv Ob Mo.png

0 Likes
Message 4 of 6

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

I do not have much experience on vb.net. However I expected to read something like this for example

    Dim invApp As Inventor.Application = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
    Dim _invDoc As Inventor.Document = invApp.ActiveDocument

 Where the expression is completed, even more so when dealing with the main sub-main subroutine


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 6

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Are you writing a standalone app for inventor;

Or are you writing a add in with vb.net?

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 6 of 6

snappyjazz
Collaborator
Collaborator

@Sergio.D.Suárez 

Thanks that got me going!

 

@bradeneuropeArthur 

I am just writing an add in via vb.net.

0 Likes