Change text with iLogic

Change text with iLogic

Rob67ert
Collaborator Collaborator
6,823 Views
11 Replies
Message 1 of 12

Change text with iLogic

Rob67ert
Collaborator
Collaborator

I like to change some text with iLogic

It is easy get it to make it bolt or change the font, but i like to change the justification of the text.

Where can i find a list of style override functions?

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Accepted solutions (1)
6,824 Views
11 Replies
Replies (11)
Message 2 of 12

HermJan.Otterman
Advisor
Advisor

Hello Robert,

 

In the Inventor help, API help, do a search on "GeneralNote object" and "TextStyle Object"

You get a list of all the properties you can set.

 

maybe create a few Textstyles with the justifications you need, and change the textstyle for the text you want to change.

 

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 12

Rob67ert
Collaborator
Collaborator
If i understand it correct it is not possible with iLogic, but only if i make a VB code of it?
Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 4 of 12

HermJan.Otterman
Advisor
Advisor

Hello Robert

 

you have to see iLogic as VB.net light.... and the api (application programmer interface) is the link between VB and Inventor.

there you can find all the things you can do with code in Inventor, that Autodesk lets you do.

Autodesk makes the API, and decide what is, and is not in the API.

 

when you look at the weld annotation, you can change only 2 or three objects, but there are many more that you can't program.

 

So the answer to you question is that with both iLogic and VB you can't fully program the weld symbol.

 

 

 

you can vote for this Idea:

 https://forums.autodesk.com/t5/inventor-ideas/weld-symbols-exposed-in-the-api-in-assemblies/idi-p/65...

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 5 of 12

Rob67ert
Collaborator
Collaborator
Hi HermJan,
you wrote: So the answer to you question is that with both iLogic and VB you can't fully program the weld symbol.

But that is not my question...
What i like to change is the justification of some text with ilogic.
Now i have: TempPartNo = "<StyleOverride Font='ISOCP_IV25' FontSize='0.5' Bold='False' Underline='False' HorizontalJustification='0'>" & TempPartNo & "</StyleOverride>" and i like to add something to change the justification.
Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 6 of 12

MechMachineMan
Advisor
Advisor

Not sure if there is a list anywhere,

 

BUT you can always change the text manually (through the UI) then read the .formattedtext on that text box to see what tags they use to set the style overrides.

 

Keep in mind that those format tags only show up for OVERRIDES and do not appear if the base style used for that text matches for the styles that are not overridden.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 12

HermJan.Otterman
Advisor
Advisor

Hello Robert,

 

I was misstaking with the weld annotation, you question looked alot like an other question, so I gave the wrong answer.

 

would it be possible for you to share a part with the text not good, and one how it should be?

 

I thing that the best way it to create two or more tetstyles so you can choose the right textstyle for your part.

then if you want you can automate this

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 8 of 12

Rob67ert
Collaborator
Collaborator

Hi,

 

I already found that it is not possible to do with iLogic.

What I can change is:

SyntaxEditor Code Snippet

"<StyleOverride Font='ISOCP_IV25' FontSize='0.5' Bold='False' Underline='False' HorizontalJustification='0'>" & TempPartNo & "</StyleOverride>"

You can change the font, but not a Style or the Justification.

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 9 of 12

HermJan.Otterman
Advisor
Advisor

Hello Robert,

 

try this iLogic rule in a drawing. create some Text in the drawing and run the rule.

depending on the line(s) that are not commented, the justification will change...

 

(iLogic has VB.net in the Back, so you can run VB.net code in iLogic)

 

 

   Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument

        Dim oPickedDrawingNote As Inventor.DrawingNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select text")

        oPickedDrawingNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter
'        oPickedDrawingNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
'        oPickedDrawingNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextRight
'
'        oPickedDrawingNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextBaseline   this option gives me an error
        oPickedDrawingNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower
'        oPickedDrawingNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextMiddle
'        oPickedDrawingNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextUpper

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 10 of 12

Rob67ert
Collaborator
Collaborator
Hi Herm Jan,

My bad, I did not mentioned that i like to change text on a part, not in a drawing.
I would like to place text on the flatt pattern, like a part number to use for laser engraving.
Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 11 of 12

HermJan.Otterman
Advisor
Advisor
Accepted solution

hello Robert,

 

it's almost the same, this should do it

 

 

           Dim oPartDoc As Inventor.PartDocument = ThisApplication.ActiveDocument

        Dim oText As TextBox = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchTextBoxFilter, "Select a text")

        oText.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter
        'oText.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
        'oText.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextRight

        'oText.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextBaseline
        oText.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower
        'oText.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextMiddle
        'oText.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextUpper

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 12 of 12

Rob67ert
Collaborator
Collaborator

Hi Herm Jan,

 

Thanks for the help.

I have now what I like to have:

SyntaxEditor Code Snippet

Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
Dim oSK As Sketch = oDef.FlatPattern.Sketches(1)
TempPartNo = Replace(iProperties.Value("Project", "Part Number"), ".", "")
TempPartNo = "<StyleOverride Font='ISOCP_IV25' FontSize='0.5' Bold='False' Underline='False'>" & TempPartNo & "</StyleOverride>"
oSK.TextBoxes.Item(1).HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
oSK.TextBoxes.Item(1).FormattedText = TempPartNo

        '.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter
         '.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
        '.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextRight

        '.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextBaseline
          '.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower
        '.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextMiddle
        '.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextUpper

 

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.