Capitalize Title using Description property

Capitalize Title using Description property

patrick3HNXX
Enthusiast Enthusiast
605 Views
2 Replies
Message 1 of 3

Capitalize Title using Description property

patrick3HNXX
Enthusiast
Enthusiast

I want to be able to pull the description from the view in a drawing, capitalize that text and drop it into title block.

I have been using this to do the material and it works perfect. I thought I could just change a few things in this to make it work but no luck.

 

'capitalize material
Dim oDrawDoc As DrawingDocument=ThisDrawing.Document

Dim oPartDoc As Inventor.PartDocument
Dim oPropSet As PropertySet
'Dim oView As DrawingView
For Each oView In oDrawDoc.ActiveSheet.DrawingViews
If oView.ViewType = DrawingViewTypeEnum.kStandardDrawingViewType Then
If oView.ReferencedDocumentDescriptor.ReferencedDocumentType = DocumentTypeEnum.kPartDocumentObject Then
oPartDoc = DirectCast(oView.ReferencedDocumentDescriptor.ReferencedDocument ,Inventor.PartDocument)
oPropSet = oPartDoc.PropertySets.Item("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")
oPropSet.Item("Material").Value = oPartDoc.ActiveMaterial.DisplayName.ToUpper
End If
End If
Next

0 Likes
Accepted solutions (1)
606 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Is that TextBox in your TitleBlockDefinition 'linked' to the 'Description' iProperty of the 'Model' document, 'linked' to that property in the Drawing, or a PromptedEntry?  It sure sounds simple enough to just dig into a drawing view's model, then change its existing Description to uppercase.  I'm assuming there is just one model being shown within your drawing, or else the title block data might be pointing to another model by default, so I don't see the use in looping through each view on the sheet.

Here's something fairly simple you can try:

 

oDDoc = ThisDrawing.Document
oSheet = oDDoc.ActiveSheet
oView = oSheet.DrawingViews.Item(1)
Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
If Not IsNothing(oModel) AndAlso _
	(TypeOf oModel Is PartDocument Or TypeOf oModel Is AssemblyDocument) Then
	oDescProp = oModel.PropertySets(3).Item("Description")
	oDescProp.Value = CStr(oDescProp.Value).ToUpper
	If oModel.PropertySets(3).Dirty Then
		oModel.Save2(False)
		oDDoc.Update2(True)
	End If
End If

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

patrick3HNXX
Enthusiast
Enthusiast

It is linked to the iproperty of the model.

 

This worked perfectly. Thank You!

0 Likes