Section Labels 5 min read
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey
I know its been a long discussion in the past regarding section labels or the lack thereof but im hoping that some of you longer term coders may be able to jump on board with me to finish this one.
Objective:
add architectual labels to section views with sheet & view number automatically
Status:
I have this working and its pretty good but there are a few annoying nuances that i cant resolve which i have listed out below. It currently loops through each sheet, finds any section views and adds the labels to the sections parent view section lines. Attributes are added for the sheet and view number which are added to the section view and the view labels giving a true Architectural style marker (center arrow remains for test purposes only)
1. Section line
I can access the section view and from that, the SectionLineSketch which is the underlying sketch on the parent view however, i cannot access the sketch line that is used for the actual section view!! Initially i was looping through the sketch lines and taking the longest one but as always, thats not 100% guaranteed to work. When you create a section view, there is the very annoying auto constraint feature that snaps to any geometry even unintentionally which can result in the inclusion of other longer sketch lines which fails the section view label.. I have tried to identify the sketchline used but i cant get it.
2. Measuring angles for the labels
Should be easy right? Nope! I am measuring the angle of the section line i find by the sketchline points but they appear to be random. I forced the measurement to a bottom left / bottom right point from the line rangebox by aligning the point with the RB point and adding a Vector2d from a zero point. The purpose was to obtain its angle to determine the view direction (which also is not obtainable through api). If a views direction is reversed, the angle is reversed but good old inventor cannot measure past 180 degrees. After 180, it will start to measure down on the opposing angle. Where i would like to measure 270 degrees, i will get the opposing 90 degrees instead.
3. adding the angle to the section label (symbol)
Once i get the angle, i need to add it to the symbol but its never that easy. When rotating a symbol manually, the values are entered in degrees. The measurements are degrees but in code, they are entered as radians. Simple enough, i can convert to Radians but the rotation results are not always as expected mainly due to the angle measurement so i seem to get -angle results periodically
4. Existing view label
asked a thousand times im sure but worth one more, Anyone managed to find a way to edit / remove the view text in the label? it can be removed manually but it doesnt seems to be exposed in the api
Questions
Referring to item 1, how can i obtain the correct sketch line for the section view from the sectionview sketch or similar without manually clicking a section line? Im accessing the sketchlines in the sketch but do i need to be looking at something different?
referring to item 2, is there a good robust way of measuring the direction of the view to the parent view of getting the view direction?
referring to item 3, is there a good robust way of measuring the right absolute angle to a sketch line that doesnt return the opposing angle less than 180 degrees? Here is what i have found or at least, its what the angles work out to be
i am willing to share the project after
Thanks
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.