This is part of a larger code:
The purpose is to open a referenced drawing file to an attempt to retrieve the "revision value iproperty" from the IDW. For the most part it works except it uses the revision value of the original assembly/part file, not the drawing it that is opened.
My initial instinct was that after the IDW file was opened, I'd need to somehow set that as the active document...
Dim doc As Document = ThisDoc.Document Dim docType As String = ""
If docType = "Part" Or docType = "Assembly" Then 'ask whether to retrive revsion from linked drawing or manually input the revision Booleanparam = InputRadioBox("How do you wish to extract part revision?", "Open Drawing", "Manual Input", booleanParam, Title := "Revision input") 'open drawing document referenced to file If Booleanparam = True Then Try oDWG = ThisDoc.FileName(False) & ".idw" OpenDoc = ThisDoc.Launch(oDWG) RevDigit = iProperties.Value("Project", "Revision Number") Catch MessageBox.Show("No Drawing Found", "") End Try 'Manually Input revision Else If Booleanparam = False Then 'choose revision digit Dim Result, Message, Title, DefaultValue As String Message = "Enter revision digit" Title = "Input Box" DefaultValue = "0" RevDigit = InputBox(Message, Title, DefaultValue) End If
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Because your launching documents and attempting to read iproperties I would avoid the ilogic API and move to the inventor API and properties.
Ilogic API generally work to target documents that the rule is first run in which in this case is a part or assembly.
While you can target a document it is difficult.
Here is the Inventor API set up for part number..
' Get the active document.
Dim drawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim designPropSet As PropertySet = drawDoc.PropertySets.Item("Design Tracking Properties")
Dim partNo as String = designPropSet.Item("Part Number").Value
MessageBox.Show(partNo,"iLogic")
In your case you need to change the above sample as you want to target revision number which is in Property Set " Inventor Summary Information" and Property "Revision Number".
Here is a helpful article which lays out all of this method. It is written in VBA so ensure you drop the word Set for use in ilogic environment.
Can't find what you're looking for? Ask the community or share your knowledge.