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?
Solved! Go to Solution.
Solved by Jason.Rugg. Go to Solution.
Solved by Sergio.D.Suárez. Go to Solution.
Solved by JelteDeJong. Go to Solution.
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.
Blog: hjalte.nl - github.com
@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.
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
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
With some tweaking I was able to get this to work well enough to suit our needs. Thank you.
@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?
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
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
@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.
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
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
@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.