Inventor vba, is it possible to get User Defined properties and insert them elsewhere?

Inventor vba, is it possible to get User Defined properties and insert them elsewhere?

pklWNF89
Participant Participant
1,392 Views
3 Replies
Message 1 of 4

Inventor vba, is it possible to get User Defined properties and insert them elsewhere?

pklWNF89
Participant
Participant

Hi guys.

Is it possible to get the value of a property and insert it elsewhere? 

 

This don't work:

Dim oValue as integer

Set oValue = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue")

 

Dim LV2 as property
Set LV2 = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue2")

LV2.Value = oValue

0 Likes
1,393 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor

try this:

 

Dim oValue As Object
oValue = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue").Value



Dim LV2 As Inventor.Property
set LV2 = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue2")

LV2.Value = oValue

 

 

and for more information have a look at this page. Here you will also find how to create an iProperty if its not in the document jet.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 4

pklWNF89
Participant
Participant

It don't work
I keep getting the same error Run-time error '424' Object required

0 Likes
Message 4 of 4

JelteDeJong
Mentor
Mentor

I expect that this is not all of you code because you did not set oDoc. There for i assumed that you only posted a part of the code that is failing. A complete code would look something like this:

Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument

Dim LV1 As Inventor.Property
set LV1 = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue")

Dim LV2 As Inventor.Property
set LV2 = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("LengthValue2")

LV2.Value = LV1.Value

Just a warning i'm not in the position that i can test this code now. if it still does not work i have to come back for this later.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com