Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to change the text height using ilogic for a specific custom properties

M_Santi
Enthusiast

How to change the text height using ilogic for a specific custom properties

M_Santi
Enthusiast
Enthusiast

I am trying to change the text height of my custom properties separately. I want to add it into a form were I can pick specific custom properties and create a form having a list like this, but for text height and maybe text font. Is it possible to create it? I found a code online and it does what I want it to do, but he problem is that it changes a whole entire dimensional style.

 

Mikail_Santi_0-1676031658768.png

 

0 Likes
Reply
420 Views
5 Replies
Replies (5)

WCrihfield
Mentor
Mentor

Hi @M_Santi.  What kind of 'form' are you using?...or how are you creating the form?  Is it a regular iLogic Form (internal or global ?), or a VBA UserForm, or a vb.net Windows Form?  When creating a simple iLogic Form, after you have added the iProperty line items over into your form builder side, you can select the iProperty line item (in the upper right area), then look down in the lower right area, under Properties > Appearance, is a setting called Font.  If you click the default value on the right side of that setting, you will see the three dots (...).  Click that to open a dialog where you can change the Font, Font Style, and Size of the font.  Those settings will only effect that one line item in your form.  You can also set these settings while the form line item (very top line item) is selected, to apply a default font for all form contents.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

M_Santi
Enthusiast
Enthusiast

I am just using internal form. What your saying is to edit the form text which I do not want. 

 

Mikail_Santi_0-1676054493876.png

 

 

What I want to be able to edit the font size and style is my custom property that is linked to my form. I want the value of the CUST PART# and CUST PART NAME font size to change. I wanna use a rule and added it to my form so I can have an organized textbox that I can edit the font size and style for specific custom property values.

 

Mikail_Santi_1-1676054687564.png

 

Mikail_Santi_2-1676054870712.png

 

 

 

0 Likes

WCrihfield
Mentor
Mentor

Hi @M_Santi.  I think maybe the terminology being used may be what is confusing me.  You can not set any Font or Font Size, or Font Color to an Inventor.Property Type object directly.  And since you don't seem to care what it looks like within your iLogic form, the only other thing I see in your post looks like a screen captured image of part of the title block of a drawing document.  If you want to make changes to what text looks like within your drawings title block, that is completely different thing, and a lot more complicated to change by code.  That text shown is within an Inventor.TextBox Type object, that is within a DrawingSketch Type object, within the TitleBlockDefinition, of the TitleBlock object on the active Sheet object in that DrawingDocument.   I don't think you can just change the value of the TextBox.Style property to a different TextStyle either.  I think you would have to set a new value to the TextBox.FormattedText property, that includes a bunch of style override instructions, which uses XML tags within that long String.  Not only can finding the correct TextBox be difficult by code, trying to get that long awkward String value just right is also really complicated to achieve.

I would recommend that you fix the text appearance manually, editing the title block's definition sketch.  To do that, just right-click on the title block you are using (in the model browser tree, under the node for the sheet), then choose Edit Definition.  Then find that text box which is to hold/show the iProperty data, and edit that.  Now, with the 'Format Text' dialog open for that text box, highlight all of its text contents, then set the settings the way you want them, then click the OK button.  Then click the 'Finish Sketch' button, or the 'Save Title Block' prompt within the right-click menu.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

M_Santi
Enthusiast
Enthusiast

Yes I know about editing the definition and changing the font size/style. What I'm trying to do is be able to make an edit of it using a rule so I can have a pop up window to edit it without going through the edit definition. Like this code that I found. The only problem is that it changes all the sizes of my notes and properties.

 

set active document as drawing document

Dim oDoc As DrawingDocument

oDoc = ThisApplication.ActiveDocument

 

'get the active dim style

Dim oDStyle As DimensionStyle

oDStyle = oDoc.StylesManager.ActiveStandardStyle. _

ActiveObjectDefaults.LinearDimensionStyle

 

'get current font size

Dim sFontSize as String

sFontSize = oDStyle.TextStyle.FontSize

 

'get user input

oInput = InputBox("Active Dimesnion Style = " &  oDStyle.Name _

& vblf & vblf &  "Enter a new font size in inches." , "iLogic", _

Round(sFontSize / 2.54,3))

 

'set font size for dim style

oDStyle.TextStyle.FontSize = oInput * 2.54

0 Likes

WCrihfield
Mentor
Mentor

OK.  The problem remains though, that if you change properties of a Style, that also changes every other object in your entire drawing that uses that same style.  That does not sound like it would work for your situation, since you probably used the same TestStyle for multiple textboxes in your title block (and likely used the same TextStyle in many other places).  You would have to be using a unique TextStyle for each of the textboxes that you want to be able to control independently of each other.  That would require at least some planning ahead to edit your title block textboxes that way.  Once that was set-up, then you may be able to control them similarly to what you are describing, without the changes effecting lots of other things that you don't want it to.  The only other alternative I can think of, would be to use the FormattedText route.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes