Hi everyone,
I'm hoping to get some help with some code I'm struggling with.
I need to loop through all the sheets in a drawing and extract title block information and write it to a file.
My title block has Prompted Entries, Drawing and Sheet Properties and Model Properties.
I am able to get Prompted Entries and Drawing Properties without issue. However, the area I'm struggling with is capturing the model properties.
Any help will be greatly appreciated.
Solved! Go to Solution.
Solved by JelteDeJong. Go to Solution.
the title block model properties are taken from the refrenced document from first view you make on a sheet. you can acces the model by its first view. below an example:
Dim doc As DrawingDocument = ThisApplication.ActiveDocument For Each sheet As Sheet In doc.Sheets Dim view As DrawingView = sheet.DrawingViews.Item(1) Dim refDoc As Document = view.ReferencedDocumentDescriptor.ReferencedDocument Dim sets As PropertySets If (refDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then Dim aDoc As AssemblyDocument = refDoc sets = aDoc.PropertySets ElseIf (refDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject) Then Dim aDoc As PartDocument = refDoc sets = aDoc.PropertySets End If Dim description As String = sets.Item("Design Tracking Properties").Item("Description").Value Dim partNumber As String = sets.Item("Design Tracking Properties").Item("Part Number").Value MsgBox(partNumber & " : " & description) Next
if you need to know more about getting iProperties then check this blogpost:
https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html
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.
Blog: hjalte.nl - github.com
Thank you for the quick response and after testing it looks like this is exactly what I need.
I will incorporate this into my code and hopefully, you don't mind if I reach out if I run into any problems.
Can't find what you're looking for? Ask the community or share your knowledge.