script need for automatic name field in iprop

script need for automatic name field in iprop

sebastien.forman
Advocate Advocate
548 Views
6 Replies
Message 1 of 7

script need for automatic name field in iprop

sebastien.forman
Advocate
Advocate

Hi all,

 

I would like to make an little automation script but i don' t know how i can do that.

 

I do the same movement many time by day.

 

When i have make a drawing, saving it with a correct name. (ex: 103-NiMo-10200-001 (Collection tank).idw)

 

I need to

-open 3d

-edit iprop

-put "103-NiMo-10200-001" (the first part of the file name) in field "Number part"

-put "Collection tank" (the second part of the file name) in field "Description"

-Save it

-Close it.

 

It would be really simpatic if someone could help me do this.

 

Thank

 

Sébastien

 

 

 

0 Likes
Accepted solutions (1)
549 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

The following:

 

 

Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim Partnr As Property
Dim Desc As Property

Dim propset As PropertySet
Set propset = b.PropertySets.Item("Design Tracking Properties")

Set Partnr = propset.Item("Part Number")
Set Desc = propset.Item("Description")

Dim Filen As String
Filen = b.DisplayName '"103-NiMo-10200-001 (Collection tank)" '

Dim strSp() As String
strSp = Split(Filen, " (")

MsgBox strSp(0)
MsgBox strSp(1)

Partnr.Value = strSp(0)
Desc.Value = Replace(strSp(1), ").idw", "")
End Sub

EDITTED>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

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

Message 3 of 7

sebastien.forman
Advocate
Advocate

Hi bradeneurope

Thank you very much for this code.

Just the iprop you editing is of the idw file, but me, i want to edit iprop of the ipt or iam file show in this idw file.

Like show in screencasts.

 

Thank you again

 

Sébastien

0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Keep reading than....

 

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim Partnr As Property
Dim Desc As Property

Dim bx As Document
Set bx = b.ReferencedDocuments.Item(1)

MsgBox bx.FullDocumentName

Dim propset As PropertySet
Set propset = bx.PropertySets.Item("Design Tracking Properties")

Set Partnr = propset.Item("Part Number")
Set Desc = propset.Item("Description")

Dim Filen As String
Filen = b.DisplayName '"103-NiMo-10200-001 (Collection tank)" '

Dim strSp() As String
strSp = Split(Filen, " (")

MsgBox strSp(0)
MsgBox strSp(1)

Partnr.Value = strSp(0)
Desc.Value = Replace(strSp(1), ").idw", "")
End Sub

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
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 !

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

Message 5 of 7

sebastien.forman
Advocate
Advocate

Yes,

 

Really nice,

 

just i need to refresh view after that because changet is not show.

 

It 's need to clic on model view list "assembly.iam" and after clic on buton  "mettre a jour".

 

I have tried to put bx.update or bx.rebuild, but doesn't work.

 

Have you an idea?

 

Sebastien

0 Likes
Message 6 of 7

bradeneuropeArthur
Mentor
Mentor
bx.update2

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

sebastien.forman
Advocate
Advocate

No, bx.Update2 doesn't work too.

 

But b.Save work, juste need to save it a this time.

 

Thank you for your help.

 

Precious time will be saved in the future thanks to you.

 

 

0 Likes