How to edit the section line text ?

How to edit the section line text ?

TONELLAL
Collaborator Collaborator
693 Views
9 Replies
Message 1 of 10

How to edit the section line text ?

TONELLAL
Collaborator
Collaborator

I'm trying to edit the section line text via the API (ilogic or VB) :

TONELLAL_0-1687525095841.png

 

I don't want to edit the name of the view, this is ok. I need to edit the text istself.

Is it possible ?

0 Likes
694 Views
9 Replies
Replies (9)
Message 2 of 10

abdullah_elq
Advocate
Advocate

Try this (iLogic):

'Select your Section Drawing View
Dim SDV As SectionDrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select Section Drawing View")
'Rename the Section Drawing View
SDV.Name = "This is a test name"
0 Likes
Message 3 of 10

TONELLAL
Collaborator
Collaborator

I don't want to edit the name of the view, this is ok. I need to edit the text istself.

0 Likes
Message 4 of 10

A.Acheson
Mentor
Mentor

Hi @TONELLAL 

 

If you want to preserve the view label and add to the text you need to capture the formatted text and add your text on afterwards. See help API help file for this object .

'Select your Section Drawing View
Dim SDV As SectionDrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select Section Drawing View")
'Rename the Section Drawing View
SDV.Label.FormattedText = SDV.Label.FormattedText & VBLF & " This is extra text"

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 10

WCrihfield
Mentor
Mentor

I actually do not think there is any 'direct' access to that specific object in Inventor's API.  It is simply not recognized yet, and its Type will read something like "Generic" or "GenericObject".  The  SectionDrawingView.Label (a DrawingViewLabel object) is pointing to the view label of the secondary view that was created with the hatching, so that is not actually correct here.  And the SectionDrawingView.SectionLineSketch will get you a reference to the DrawingSketch where you created the actual SketchLine, but not to the label you are after yet.  Then the SectionDrawingView.ParentView will get you a reference to the main view where that sketch was made within, but its Label is still not the one you are after.  When you double click on that actual section line label, you will see the Format Text dialog pop-up, and see that it contains the text "<VIEW IDENTIFIER>", and you will notice under Type, it is set to "View Label Properties", and under Source is is set to (current drawing and the name of the current drawing file), then under Property it is set to "VIEW IDENTIFIER".  This is just the Letter or Number associated with that instance of a section or detail view.  Those are pretty much automatically generated and updated as you go, but can usually be changed or edited manually.  When you manually edit the section view (view with hatching), you will see that it has a field called "View Identifier" there.  If you add something to that directly, after the letter, it will also show up in the view label of the section view, not only the section line label itself.  Just so you know.  That may not be a problem though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 10

A.Acheson
Mentor
Mentor

Hi @WCrihfield 

 

Good advice, I didn't really think of the interconnection between the views. I guess things are not as simple as a regular view.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 10

TONELLAL
Collaborator
Collaborator

Hi,

I think @WCrihfield pointed all the problems !

The section label text (boxed in red) is not part of the objects Base view, Section view or SectionCutLine. It is possible to manually edit it to obtain : 

TONELLAL_0-1687788650210.png

I thought it might be possible to find it somewhere, but it seems impossible at the moment...

 

I've also tried to find it as a text, which could be in the view, on the sheet or anywhere else. Once all the texts found, it could be possible to identify the correct one, for exemple "text containing only <view identifier> and near the parent view of the section view" (all of this to be defined more accurately).

0 Likes
Message 8 of 10

maxim.teleguz
Advocate
Advocate

we need a way to select the line through filters, once we do that we can do anything. I am unable to at this point select a section line through code or have a pick command and then select a section line. IF someone can show me how i can solve the rest. 

0 Likes
Message 9 of 10

jnowel
Advocate
Advocate

@maxim.teleguz this should now be possible for Inventor 2026 thru DrawingViewAnnotation Object
Inventor 2026 Help | DrawingViewAnnotation Object | Autodesk

What I did in the past (Inventor 2023) was use a SketchedSymbol as container for the text i needed to put and infer which section line it was attached to.

to quote from a relevant discussion: "If you want to do it in Inventor 2025 and earlier you would have to try to use UI automation"
Modify <VIEW IDENTIFIER> programmatically - Autodesk Community

0 Likes
Message 10 of 10

maxim.teleguz
Advocate
Advocate

I understand modifying the view identifier, but that does not contain any additional information that might be included by the user. 

I need a way to see the section line with code. as soon as I can do that I can then extract the relevant information. 

0 Likes