Hii I am wondering if we can fetch the title block details like scale, title, Dwg number, Revision from drawing like here via apis.
I found out this values are set from field text but don't know how to get these values ?
Solved! Go to Solution.
Solved by FINET_Laurent. Go to Solution.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !
Hi @shivam7C2Q8,
It is a bit tricky but achievable. Here is an example of mine :
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Sheet = actDoc.ActiveSheet
Dim t As TitleBlock = s.TitleBlock
Dim tDef As TitleBlockDefinition = t.Definition
For Each txtBox As TextBox In tDef.Sketch.TextBoxes
If txtBox.Text = "<AUTEUR>" Then MsgBox(t.GetResultText(txtBox))
Next
Basicly prompt entries are created when adding a text box in the title block, and formating as folowing : <PropertyName>
So basicly I just search in the text boxes collection and fine the one that I'm looking for, then see it's value.
You could use then a small function like this :
Sub main
Dim val As String = find_value("AUTEUR")
MsgBox(val)
End Sub
Function find_value(propertyName As String) As String
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Sheet = actDoc.ActiveSheet
Dim t As TitleBlock = s.TitleBlock
Dim tDef As TitleBlockDefinition = t.Definition
For Each txtBox As TextBox In tDef.Sketch.TextBoxes
If txtBox.Text = "<" & propertyName & ">" Then Return t.GetResultText(txtBox)
Next
Return "Property doesn't exist"
End Function
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Hii I have downloaded these sample drawings I will attach one below
Hi @shivam7C2Q8,
My code is working flawless on my end :
Sub main
Dim val As String = find_value("Echelle de la vue d'origine")
MsgBox(val)
End Sub
Function find_value(propertyName As String) As String
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Sheet = actDoc.ActiveSheet
Dim t As TitleBlock = s.TitleBlock
Dim tDef As TitleBlockDefinition = t.Definition
For Each txtBox As TextBox In tDef.Sketch.TextBoxes
If txtBox.Text = "<" & propertyName & ">" Then Return t.GetResultText(txtBox)
Next
Return "Property doesn't exist"
End Function
Note that the text specified in the string (line 2) has to match perfectly (capital letters, spaces, ..).
Also check the prompt itself has a value and is not empty.
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Can't find what you're looking for? Ask the community or share your knowledge.