Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tangent Edge Visibility in drawing views

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Jason.Rugg
1983 Views, 9 Replies

Tangent Edge Visibility in drawing views

Is there a way using iLogic or another means to automatically hide all but two tangent edges on content center parts in drawing views? 

 

The image below shows the profile view of a content center channel part with two projected views to the right. The first projected view shows all tangent lines created by the legs of the channel. The second projected view shows all tangent lines turned off except for two, I had to manually turn the visiblity off on all others. 

 

Is there a way to automatically get the second projected view? 

 

tangent edges.png

9 REPLIES 9
Message 2 of 10
JelteDeJong
in reply to: Jason.Rugg

When you run the following iLogic rule you will be asked to select to edges in the same view. when you do so it will hide all other tanget edges (curves acc. to. Inventor)

Dim selectedCurve1 As DrawingCurveSegment = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select first tan edge")
Dim selectedCurve2 As DrawingCurveSegment = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select second tan edge")

Dim drawingview As DrawingView = selectedCurve1.Parent.Parent
For Each curve As DrawingCurve In drawingview.DrawingCurves
    If (curve.EdgeType = DrawingEdgeTypeEnum.kTangentEdge) Then
        If ((curve.Equals(selectedCurve1.Parent) = False) And (curve.Equals(selectedCurve2.Parent) = False)) Then
            For Each segment As DrawingCurveSegment In curve.Segments
                segment.Visible = False
            Next
        End If
    End If
Next

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 10
Jason.Rugg
in reply to: JelteDeJong

@JelteDeJongThis works pretty well for a single part view. If it's an assembly though it turns off all tangent edges on all parts and only keeps the two on the one the part that the two edges were initially selected.

 

So is it possible in an assembly for it to only affect a single part? I'm not advanced in iLogic enough to know how to code that.

Message 4 of 10

Hi, try the following ilogic code.
It will look for the name of the occurrence to which the selected segment belongs and will only hide the tangent edges of this occurrence.

Dim oCurve1 As DrawingCurveSegment = ThisApplication.CommandManager.Pick(16914, "First Tangent edge")
Dim oCurve2 As DrawingCurveSegment = ThisApplication.CommandManager.Pick(16914, "Second Tangent edge")
If oCurve1 Is Nothing Or oCurve2 Is Nothing Then Exit Sub
	
Dim oView As DrawingView = oCurve1.Parent.Parent

'Get Occurrence Name from View
Dim oCcName As String = oCurve1.Parent.ModelGeometry.Parent.Parent.name

For Each oCurve As DrawingCurve In oView.DrawingCurves
    If oCurve.EdgeType = 82694 Then
		If oCurve.ModelGeometry.Parent.Parent.name = oCcName Then
            For Each DCSeg As DrawingCurveSegment In oCurve.Segments
                DCSeg.Visible = False
            Next
		End If
    End If
Next

oCurve1.Visible =True
oCurve2.Visible =True

 I hope this helps with your problem. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 5 of 10

With some tweaking I was able to get this to work well enough to suit our needs. Thank you.

Message 6 of 10
Anonymous
in reply to: Sergio.D.Suárez

@Sergio.D.SuárezCould this be altered to allow infinite picking beyond the 2 points and then using "enter" or some other button to end/finish the command? And could it work across multiple parts in the same selection set?

Message 7 of 10
Sergio.D.Suárez
in reply to: Anonymous

Hi, try the following code, I think it could work. Cheers!

 

Dim oDoc As DrawingDocument= ThisDoc.Document
Dim oView As DrawingView
Dim oSegment As DrawingCurveSegment
Dim oCcName As String 

'Reset Visibility -> visibility all tangent edges in each drawingview
For Each oView In oDoc.ActiveSheet.DrawingViews
	For Each oCurve As DrawingCurve In oView.DrawingCurves
	    If oCurve.EdgeType = 82694 Then
			For Each oSegment In oCurve.Segments
				oSegment.visible =True
			Next
	    End If
	Next
Next

Dim comps As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim comp As Object

While True 
comp = ThisApplication.CommandManager.Pick(16914, "First Tangent edge")
If IsNothing(comp) Then Exit While
comps.Add(comp) 
End While

For Each comp In comps
	oSegment = comp
	oView = oSegment.Parent.Parent
	oCcName = oSegment.Parent.ModelGeometry.Parent.Parent.name
	For Each oCurve As DrawingCurve In oView.DrawingCurves
	    If oCurve.EdgeType = 82694 Then
			If oCurve.ModelGeometry.Parent.Parent.name = oCcName Then
	            For Each DCSeg As DrawingCurveSegment In oCurve.Segments
	                DCSeg.Visible = False
	            Next
			End If
	    End If
	Next
Next

For Each comp In comps
	oSegment = comp
	oSegment.Visible =True
Next

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 8 of 10
Anonymous
in reply to: Sergio.D.Suárez

@Sergio.D.SuárezOh wow this is cool, something interesting though, once I complete my selection set and hit escape to finish it works as expected but as soon as I run the code again it unhides everything that was previously hidden.

Message 9 of 10
Sergio.D.Suárez
in reply to: Anonymous

Yes, I know, I have placed it on purpose to reset and check the code. you just have to delete the reset section.

 

Dim oView As DrawingView
Dim oSegment As DrawingCurveSegment
Dim oCcName As String 

Dim comps As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim comp As Object

While True 
comp = ThisApplication.CommandManager.Pick(16914, "First Tangent edge")
If IsNothing(comp) Then Exit While
comps.Add(comp) 
End While

For Each comp In comps
	oSegment = comp
	oView = oSegment.Parent.Parent
	oCcName = oSegment.Parent.ModelGeometry.Parent.Parent.name
	For Each oCurve As DrawingCurve In oView.DrawingCurves
	    If oCurve.EdgeType = 82694 Then
			If oCurve.ModelGeometry.Parent.Parent.name = oCcName Then
	            For Each DCSeg As DrawingCurveSegment In oCurve.Segments
	                DCSeg.Visible = False
	            Next
			End If
	    End If
	Next
Next

For Each comp In comps
	oSegment = comp
	oSegment.Visible =True
Next

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 10 of 10
Anonymous
in reply to: Sergio.D.Suárez

@Sergio.D.SuárezI see, that worked by commenting out that section, since I am still learning I do not want to delete it. My next questions would be, can the selected lines be a different color so they stand out and could the finish option be a right click and select done option instead of escape?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report