ilogic code to capatilize text in title block

ilogic code to capatilize text in title block

patrick3HNXX
Enthusiast Enthusiast
1,623 Views
12 Replies
Message 1 of 13

ilogic code to capatilize text in title block

patrick3HNXX
Enthusiast
Enthusiast

I am just trying to capitalize the material text in my title block. I have tried using the iproperties and UCase functions to do this, but I am apparently missing something.  

0 Likes
Accepted solutions (2)
1,624 Views
12 Replies
Replies (12)
Message 2 of 13

snappyjazz
Collaborator
Collaborator

Can you post an example of your code?

0 Likes
Message 3 of 13

bradeneuropeArthur
Mentor
Mentor

Use.

Property.item("yourname").value =Property.item("yourname").value.toupper

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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:
My 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 !


 


EESignature

0 Likes
Message 4 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

I would suggest the following:

- Create an iLogic Rule in your Part with following code and run it.

iProperties.Value("Custom", "Mat")=iProperties.Material.ToUpper

 - Add your rule to the event trigger "material change".

- Edit your titleblock definition and add a textbox with your user defined iprop "Mat".

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 5 of 13

patrick3HNXX
Enthusiast
Enthusiast
iProperties.Value("Design Tracking Properties", "Material") = iProperties.Material.ToUpper

iLogicVb.UpdateWhenDone = True

It's not a custom value; it's the default material being pulled from the part. Just won't change.
0 Likes
Message 6 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

I would not write in an internal iProp, but that's another story. Your code converts the prop value to upper case as expected. What do you mean with "won't change"? If you change material, prop value is not updated automatically or ...?

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 7 of 13

patrick3HNXX
Enthusiast
Enthusiast

I don't need the material to change. I just need to take the existing material which is in lower case and convert it to uppercase.

0 Likes
Message 8 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

That's exactly what

iProperties.Value("Design Tracking Properties", "Material") = iProperties.Material.ToUpper

does. If I assign the material "Steel" to my part and run this code, the value of iProp Material in the Design Tracking Propertyset is "STEEL". If I edit my titleblock definition in my drawing and insert a textblock with iProp Material, I get a titleblock with the text "STEEL".

If I change the material to Rubber, the titleblock shows "Rubber". I had to run the code again. Or, if don't want to remember running the code manually every time the material changed, I add this rule to the event trigger "material change". After that, I can change material to Rubber and my titleblock shows  ..... RUBBER.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 9 of 13

patrick3HNXX
Enthusiast
Enthusiast

Ok I finally got it working. Is there a way to do this without adding a rule to the part file? I have hundreds of parts to go through. I would have open each part and add this rule. I am unclear as to why I can't do this inside the .idw. I have other rules that pull info directly from the title block and modify it, but the material seems to be different for some reason.

0 Likes
Message 10 of 13

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Create an external rule, instead of an internal. So you don't have to create that rule in every existing part document. Create it once and link it to the event trigger for material change. Every part document will update the iProp if you change material.

You can also create an external rule running from the drawing (see below). The problem here is, you must use the event trigger e.g before save.

iLogicVb.UpdateWhenDone=True

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

R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 11 of 13

patrick3HNXX
Enthusiast
Enthusiast

Thank you very much.

 

Works perfectly.

 

You are a gentleman and scholar.

0 Likes
Message 12 of 13

patrick3HNXX
Enthusiast
Enthusiast

How were you able to get the properties identifier? "

"{32853F0F-3444-11D1-9E93-0060B03C1CA6}"

Do you have code to generate a list?

0 Likes
Message 13 of 13

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Enabel the iLogic Protocol tab in the iLogic browser. There you can copy'n paste the output. According to the active document open, the output differs.

You can get propertyset internal names/names and all property names/ displaynames like:

 

 

Dim oDoc As Document = ThisDoc.Document
For Each oPropset As PropertySet In oDoc.PropertySets
	Logger.Info(vbcrlf & "Name: " & oPropset.Name & vbCrLf & "InternalName: " & oPropset.InternalName)
	'comment the next three lines to not display property names
	For i = 1 To oPropset.Count 
		Logger.Info("Name: " & oPropset.Item(i).Name & vbCrLf & "DisplayName: " & oPropset.Item(i).DisplayName )	
	Next
Next

 

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com