How to get tangent lines of selected body in drawing?

How to get tangent lines of selected body in drawing?

ngdnam88
Advocate Advocate
1,160 Views
13 Replies
Message 1 of 14

How to get tangent lines of selected body in drawing?

ngdnam88
Advocate
Advocate

Dears,

I'm trying setting visibility for tangent lines of selected body in Drawing. Is there any way to get them?

ngnam1988_0-1707583791404.png

Thanks,

0 Likes
1,161 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor

Maybe this is something you are really searching for?

 

https://forums.autodesk.com/t5/inventor-ideas/2d-drawing-profiles-bevelled-flanges/idi-p/12459712

 

Or this will do the trick for you:

Dim d As DrawingDocument = ThisDrawing.Document
Dim s As Sheet = d.ActiveSheet
Dim dv As DrawingView = s.DrawingViews.Item(1)
dv.DisplayTangentEdges = True
'dv.DisplayForeshortenedTangentEdges = True

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

Message 3 of 14

ngdnam88
Advocate
Advocate

Hi, Sorry my question is not clear. I mean I wanna hide another tangent lines, keep selected tangent lines (as the ref. post) but apply for selected body not for a view drawing. Thanks! Ref.
https://forums.autodesk.com/t5/inventor-programming-ilogic/tangent-edge-visibility-in-drawing-views/... 

0 Likes
Message 4 of 14

bradeneuropeArthur
Mentor
Mentor

For my understanding:

For example you have a assembly with three (3) profiles.

You want to show "the tangent edges" only for one of them, and the other two (2) not

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

Message 5 of 14

ngdnam88
Advocate
Advocate

Hi @bradeneuropeArthur 
Exactly I have a multi-solidbody part, and I wanna keep tangent lines visible (2 green arrows) - another tangent lines of each body shall hidden.

- The ref. post is applying for selected view and keep tangent lines that selected. I wanna apply as the ref. to selected body only not for all in a selected view. Is it possible?

 

ngnam1988_0-1707904157543.png

ngnam1988_0-1707909386123.png

 

Thanks,

0 Likes
Message 6 of 14

WCrihfield
Mentor
Mentor

Hi guys.  Just as a plan of what needs to be done here...  Since these look like drawing views we are looking at, not actual part or assembly modeling screen lines, you would first need to make sure that setting that @bradeneuropeArthur pointed out above is set to True, to make sure all tangent lines are included, then we will selectively turn visibility off for the unwanted lines later.  Next, you will need to dig down into the model's ComponentDefinition, to that SurfaceBody object, and get a reference to those specific Edge objects that you want to turn visibility off for.  Then, once you have a variable representing each of them, use the DrawingView.DrawingCurves property of the DrawingView, with one of the Edge objects as 'input' into that property, to get the DrawingCurvesEnumerator object collection containing the DrawingCurve object within the DrawingView for the Edge object.  Then you can step down into the DrawingCurve.Segments property, which represents a DrawingCurveSegments collection, then step through its segments, which are DrawingCurveSegment objects, which have a DrawingCurveSegment.Visible property we can set to False.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 7 of 14

ngdnam88
Advocate
Advocate

Deleted!

0 Likes
Message 8 of 14

ngdnam88
Advocate
Advocate

Hi @WCrihfield 
Could you please help me what's wrong in my working code? Thanks!

 

 

Sub Main()    
	Dim _InventorApp As Application = ThisApplication
	Dim oDOC As DrawingDocument = _InventorApp.ActiveEditDocument
	Dim hSet As HighlightSet = oDOC.CreateHighlightSet()
	hSet.Color = _InventorApp.TransientObjects.CreateColor(255, 0, 0)
	Dim oTangentColl As ObjectCollection = _InventorApp.TransientObjects.CreateObjectCollection : oTangentColl.Clear()
	Dim oSolidCurveColl As ObjectCollection = _InventorApp.TransientObjects.CreateObjectCollection : oSolidCurveColl.Clear()

	Dim oView As DrawingView = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View to Edit.")
	If oView Is Nothing Then Exit Sub

	Dim nPick As DrawingCurveSegment = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick the BODY Line.")
	If (nPick Is Nothing) Then
		MsgBox("[NOTHING] Selected!", vbOKOnly + vbCritical, "Opps...!")
		Exit Sub
	Else
		'Highlight [BODY] Working
		If nPick.GeometryType <> Curve2dTypeEnum.kLineSegmentCurve2d Then MsgBox("THIS IS NOT A LINE SEGMENT") : Exit Sub
		Dim nPartEdge As Edge = nPick.Parent.ModelGeometry
		Dim oSB As SurfaceBody = nPartEdge.Parent
		For Each oCurve As DrawingCurve In oView.DrawingCurves(oSB)
			If oCurve.EdgeType <> DrawingEdgeTypeEnum.kTangentEdge Then
				For Each SEG As DrawingCurveSegment In oCurve.Segments
					oSolidCurveColl.Add(SEG)
				Next
			Else : Continue For : End If
		Next
		hSet.AddMultipleItems(oSolidCurveColl)

		'Select Tangent to Collection
		While True
			Dim tPick As DrawingCurveSegment = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick the Tangent... | ESC to Done")
			If IsNothing(tPick) Then Exit While
			If tPick.Parent.EdgeType = DrawingEdgeTypeEnum.kTangentEdge = False Then oTangentColl.Add(tPick)
		End While

		'Setting for...
		For Each tCurve As DrawingCurve In oView.DrawingCurves(oSB)
			If tCurve.EdgeType = DrawingEdgeTypeEnum.kTangentEdge Then
				For Each tSEG As DrawingCurveSegment In tCurve.Segments
					tSEG.Visible() = False
					

					'NEED CODE FOR CHECKING WITH oTangentColl

				Next
			Else : Continue For : End If
		Next

	End If
End Sub

 

 

0 Likes
Message 9 of 14

A.Acheson
Mentor
Mentor

Hi @ngdnam88 ,

 

I haven't tested the full code but did a review and got as far as this line. Is this line actually returning an object of type edge?  Also is your part in an assembly? In that case it will need to be a proxy edge. 

 

Dim nPartEdge As Edge = nPick.Parent.ModelGeometry

 

 

How far are you getting in the code? What lines are failing for you?

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

ngdnam88
Advocate
Advocate

Hi @A.Acheson 
I'm using it to return the SolidBody. I using it from my previous post, solution from @Michael.Navara

https://forums.autodesk.com/t5/inventor-programming-ilogic/highlight-the-solidbody-that-include-a-cr... 

I think my codes falling in lines from 37 to 48

For Each tCurve As DrawingCurve In oView.DrawingCurves(oSB)
	If tCurve.EdgeType = DrawingEdgeTypeEnum.kTangentEdge Then
		For Each tSEG As DrawingCurveSegment In tCurve.Segments
			tSEG.Visible() = False

			'NEED CODE FOR CHECKING WITH oTangentColl

		Next
	Else : Continue For : End If
Next
0 Likes
Message 11 of 14

A.Acheson
Mentor
Mentor

Maybe try a different approach which i do often is to work backwards from picking the curve individually by code and try and inspect the line types and see can you get the visibility to be switched off and on by code. It might be the case that the collection of edges in the part is not matching the collection of  curves. 

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

ngdnam88
Advocate
Advocate

Hi @A.Acheson 
I'm trying working with part (.ipt) model, it did not work - but it can work with an assembly (.iam).
What's wrong here?
.ipt (Multi SolidBody)

ngnam1988_0-1708315944097.png

.iam: Tangent Lines can visible with above code

ngnam1988_1-1708316011074.png

 

0 Likes
Message 13 of 14

A.Acheson
Mentor
Mentor

When you say its a multibody part do you mean it is a part derived using make components or just a regular part with multiple bodies? Are you gaining access to the correct solidbody (check by name)? It is strange that it works in the assembly and not the part.

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

ngdnam88
Advocate
Advocate

Hi @A.Acheson 

It's a regular part (.ipt) with multiple bodies,

And I checked, this code access to correct solid body for working

 

 

Dim nPartEdge As Edge = nPick.Parent.ModelGeometry
Dim oSB As SurfaceBody = nPartEdge.Parent
Msgbox(oSB.Name)

 

 

ngnam1988_0-1708323147339.png

 

ngnam1988_0-1708329004695.png

 

 

0 Likes