Hi All,
I am running inventor 2015 pro. I am attempting to call up certain iproperties of an assembly or part file presented in a view of an IDW using iLogic. I am using the script from the following thread as my starting point (iLogic copied below).
I would love to have a sketch symbol script in my IDW that pulls the iproperties from each view on a sheet and place them in the sketch symbol as the script already does for scale and view name. I would like to add the pulled iproperties as text below "scale". I hope I am just missing the syntax to pull the iproperties from the view and place them as a prompted entry.
If there is a more sensible way to do what I am asking I am all ears. I am having trouble overcoming the fact that I am frequently placing different views of multiple assemblies and parts on one page. Shortcuts that only look at the first view placed wont work, it will need to be view specific.
SyntaxEditor Code Snippet
Dim oDoc As DrawingDocument oDoc = ThisDoc.Document Dim oSheets As Sheets oSheets = oDoc.Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView Dim oSymbol As SketchedSymbol Dim oSymbols As SketchedSymbols 'iterate through all of the sheets For Each oSheet In oSheets 'remove existing sketched symbols named View Label For Each oSymbol In oSheet.SketchedSymbols If oSymbol.Definition.Name = "View_Label" Then oSymbol.Delete Else End If Next 'set sheet active oSheet.Activate 'set a refernce to the drawing views collection oViews = oDoc.ActiveSheet.DrawingViews ' Iterate through all of the views For Each oView In oViews 'This places a sketched symbol with the name "View_Label" Dim oSymDef As SketchedSymbolDefinition 'defind the sketch symbol to be inserted oSymDef = oDoc.SketchedSymbolDefinitions.Item("View_Label") 'set a string array with values for the prompted entries found in the symbol Dim sPromptStrings(1) As String sPromptStrings(0) = "SCALE " & oView.Scale 'set to view scale sPromptStrings(1) = oView.Name 'set to view name sPromptStrings(2) = oView.iProperties.Value(doc, "Summary", "Subject") 'set to view name 'set the position for the sketched symbol to be inserted ' and spaced off of the selected view center Dim oPosition As Point2d: oPosition = oView.Center oPosition.y = oPosition.y - (oView.Height / 2 + 0.6) 'insert the sketched symbol and set the prompted entries oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition,0,1,sPromptStrings) Next Next 'activate sheet1 oDoc.Sheets.Item(1).Activate
Hi,
This should do what you're looking for
Dim oDocToGetProperties As Document
Set oDocToGetProperties = ThisApplication.Documents.Open(oView.ReferencedDocumentDescriptor.ReferencedDocument.FullFileName, "False")
'set a string array with values for the prompted entries found in the symbol
Dim sPromptStrings(2) As String
sPromptStrings(0) = "SCALE " & oView.Scale 'set to view scale
sPromptStrings(1) = oView.Name 'set to view name
sPromptStrings(2) = oDocToGetProperties.PropertySets.Item("Summary Information").Item("Subject").value 'set to view name
Call oDocToGetProperties.Close(True)