API Iproperties populate trough textbox

API Iproperties populate trough textbox

j.romoYDW7Q
Contributor Contributor
372 Views
6 Replies
Message 1 of 7

API Iproperties populate trough textbox

j.romoYDW7Q
Contributor
Contributor

Hello Fellow inventor enthusiasts

I have been seraching for a guide to know the way to populate Iproperties from a form in VB.net .

I have not been able to find a proper map to the iproperties.

Here is a code snipet of what I am looking for.

  Private Sub btnADDDATA_Click(sender As Object, e As EventArgs) Handles btnADDDATA.Click
        Dim vendor As String = txtVendor.Text
        Dim estimatedCost As String = txtCost.Text
        Dim partNumber As String = txtPartNO.Text
        Dim website As String = txtWEB.Text
        ' Update the iProperties.
        Try
            oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Vendor").Value = vendor
            oDoc.PropertySets.Item("Inventor User Defined Properties").Item("EstimatedCost").Value = estimatedCost
            oDoc.PropertySets.Item("Inventor Summary Information").Item("Part Number").Value = partNumber
            oDoc.PropertySets.Item("Inventor Summary Information").Item("Web Link").Value = website

            MsgBox("iProperties updated successfully.")
        Catch ex As Exception
            MsgBox("Error updating iProperties: " & ex.Message)
        End Try
    End Sub

 

 thasnks in advance 

0 Likes
373 Views
6 Replies
Replies (6)
Message 2 of 7

A.Acheson
Mentor
Mentor

Hi @j.romoYDW7Q ,

 

You are missing withing this block the application and document you want to target. This video here shows how to set up both if you haven't do so allready. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 7

j.romoYDW7Q
Contributor
Contributor

hello @A.Acheson 

Thanks for the reply I allready have it below the frm Class

I made this change created a Property variable then found an article of Brian Ekins where he explains why the names are diferent because diferent lenguages 

The Summary, Project, Status, and
Custom tabs of the dialog contain the iProperties that are exposed through the programming interface.
There are four PropertySet objects in an Inventor document; Summary Information, Document
Summary Information, Design Tracking Properties, and User Defined Properties.
--B. Ekins--
    Private Sub btnADDDATA_Click(sender As Object, e As EventArgs) Handles btnADDDATA.Click
        Dim vendor As String = txtVendor.Text
        Dim estimatedCost As String = txtCost.Text
        Dim partNumber As String = txtPartNO.Text
        Dim website As String = txtWEB.Text
        Dim invPartNumberProperty As [Property]
        Dim invVendorProperty As [Property]
        Dim invEstimatedPropertu As [Property]
        Dim invWEBProperty As [Property]

        ' Update the iProperties.
        Try
            invPartNumberProperty = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number")
            invPartNumberProperty.Value = partNumber
            invVendorProperty = oDoc.PropertySets.Item("Design Tracking Properties").Item("Vendor")
            invVendorProperty.Value = vendor
            invEstimatedPropertu = oDoc.PropertySets.Item("Design Tracking Properties").Item("Estimated Cost")
            invEstimatedPropertu.Value = estimatedCost
            invWEBProperty = oDoc.PropertySets.Item("Design Tracking Properties").Item("WEB Link")
            invWEBProperty.Value = website


            MsgBox("iProperties updated successfully.")
        Catch ex As Exception
            MsgBox("Error updating iProperties: " & ex.Message)
        End Try
    End Sub

 

But now I ran into a diferent issue if I am filling a textbox and hit SpaceBar a new instance of my frm opens up 😫

 

 

thanks 

0 Likes
Message 4 of 7

FINET_Laurent
Advisor
Advisor

Hi @j.romoYDW7Q ,

 

Why do you need to use vb.net for this application? It seems an external rule in iLogic whould enough.

 

Anyway, open the form as modal form : 

Form.ShowDialog Method (System.Windows.Forms) | Microsoft Learn 

Visual Basic .NET: Modal and non modal forms (homeandlearn.co.uk)

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 5 of 7

WCrihfield
Mentor
Mentor

In your original post here you mentioned not having a map of all the iProperties.  Attached is a PDF of an Excel spreadsheet document I created some time ago, which contains a ton of information about all of the standard iProperties, and a few that are not so standard but common (usually only exist in Content Center parts).  Hopefully this will help you out with your project.  Good luck.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 7

j.romoYDW7Q
Contributor
Contributor
This is awesome Thanks a lot. @WCrihfield.
0 Likes
Message 7 of 7

A.Acheson
Mentor
Mentor

Hi @j.romoYDW7Q 

 

Here is some ilogic adapted from this article here. This will allow you to pick up the property and propertysets from the logger. 

 

Wesley  handy chart can be partially recreated using the below. 

 

  Dim doc As Document
  doc = ThisApplication.ActiveDocument
  
  Dim ps As PropertySet
  For Each ps In doc.PropertySets
    Logger.Info(ps.Name + " / " + ps.InternalName)
    Dim p As Property
    For Each p In ps
      Logger.Info( "  " + p.Name + " /" + Str(p.PropId))
    Next
  Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes