- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @C_Haines_ENG. It is a little difficult for me to understand your full intent with the code you posted, but I did attempt to correct it for you. You were using two loops in there, but the first one was just re-setting the value of a variable a bunch of times in a row, so it would only retain the last one it encountered. Then the second loop did not appear to have an ending line (Next), so I wasn't sure if this was all of the code, or just part of it. And I wasn't sure if those first two InputBox uses were only supposed to show one time, or once per 'visible' document in the second loop. When using the iProperties.Value() snippet, if you do not supply the first of 3 input variables, it will target the 'active' document at that moment, but when you do specify a document (not an assembly component), it wants its file name, without its path, but with its extension. To simplify, I replaced those two lines with equivalent lines of API code for accessing those iProperties.
See if this version of the code works any better for you, or as you intended.
For Each oDoc As Document In ThisApplication.Documents.VisibleDocuments
oDoc.Activate
oDocName = IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
UHeight = InputBox("Enter Height of Unit in INCHES","Height","")
UWidth = InputBox("Enter Width of Unit in INCHES","Width","")
PanelType = InputBox("Enter Panel Type", "Panel Type", PanelType)
PanelType = UCase(PanelType)
NewDesc = "75-" & PanelType & " " & oDocName
oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Panel Type").Value = PanelType
oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value = NewDesc
Next
Wesley Crihfield
(Not an Autodesk Employee)