Custum property

Custum property

info
Contributor Contributor
700 Views
5 Replies
Message 1 of 6

Custum property

info
Contributor
Contributor
Hello
I am customizing a VB.net add-in for the first time.
I downloaded the MyFirstInventorAddin-master tool from AlexFielder “Github” forum.
Now try to adjust this to my wishes. I'm running into the following problem
I cannot read the “Custom Properties” properties
When I read line 1098 I go to the summer properties (image 1)

afb1.png

1098 myiPropsForm.tbRevNo.Text = iProperties.GetorSetStandardiProperty(DocumentToPulliPropValuesFrom, PropertiesForSummaryInformationEnum.kRevisionSummaryInformation, "", "")
When I read line 1100 I have to go to the cusum Properties (fig2) but then I get an error at the moment

afb2.png

Can anyone help me to solve this.


 

 

 

0 Likes
701 Views
5 Replies
Replies (5)
Message 2 of 6

A.Acheson
Mentor
Mentor

Hi @info 

Can you share an image of the error message?

Can you share the code your working with in the editor? Images of code are not useful because you cannot test the code without rewriting it all.  

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 6

info
Contributor
Contributor

Hello Alan,

This is the error in line 1100

Severity Code Description Project File Line Suppression State Details
Error BC30057 Too many arguments to 'Friend Shared Function SetorCreateCustomiProperty(Doc As Document, PropertyName As String, [PropertyValue As Object = Nothing]) As Object'.

Attached are the files ipropertiesaddinserver.vb and iproperties.vb

 

Regards Jos

0 Likes
Message 4 of 6

wfajber
Contributor
Contributor

I am just on mobile, so I cannot think through the debugging or be more helpful.. 

 

But I have found that separating out whether things exist or not into a separate function was quite valuable to me. Here is a forum post from not long ago.

 

https://forums.autodesk.com/t5/inventor-programming-ilogic/most-wished-for-api-call-does-this-iprope...

 

0 Likes
Message 5 of 6

A.Acheson
Mentor
Mentor

Hi @wfajber 

 

After looking at this the Enum doesn't look right.  As the iproperty is user defined the Enum might not exist so you might have to loop through the properties by another method in order to return the custom Enum. But to be honest I have never had to do this so can't offer more advice. 

See help page here. 

PropertiesForUserDefinedPropertiesEnum Enumerator Description

User Defined Properties, InternalName: {D5CDD505-2E9C-101B-9397-08002B2CF9AE}, Name: Inventor User Defined Properties - This Enum is empty because the user defined properties are not predefined but are end-user created.

Methods

NameValueDescription
kDummyUserDefinedProperties0

 

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

wfajber
Contributor
Contributor

@A.Acheson 

 

We are referring to the linked forum post above. 

 

Yes, the enum is a little funny in the try/catch segment. But for the life of me, I cannot remember if I snipped this from a working rule or did I make it up just as an example of the try/catch structure that I would like to avoid. I am away from the office so I can’t look until next week.

 

But there is a reason the enum is funny.  I have been testing out the functionality of Instance Properties, so I have been hiding properties in the LeafOccurrence.  In this manner I have been able to tie specific project numbers or other data to some occurrences, and not to others, even if they are the same part.

 

The proper iLogic call (from the help file) is

iProperties.InstanceValue("PartX:1", "Side") = "Left"
Dim partX1Side = iProperties.InstanceValue("PartX:1", "Side")

So I suspect I was typing from memory. And as I type this, I realize that must be true because I was avoiding using the try/catch so it did not exist in my rule.

 

 

0 Likes