Highlight edges in a drawing view

Highlight edges in a drawing view

dialunau
Advocate Advocate
445 Views
2 Replies
Message 1 of 3

Highlight edges in a drawing view

dialunau
Advocate
Advocate

Hello everyone,

I'm trying to highlight the edge of a cylinder inside a drawing view. My goal is to highlight the features related to a constraint. For this case I have to highlight an edge related to an insert constraint. I'm still not sure if I can ahieve this if the edge is not visible in the drawing view.

Does anyone know how to do this?

 

dialunau_0-1646059414576.png

 

So far I can only know the feature type for the constraint:

 

Dim oAssy As AssemblyDocument = ThisApplication.ActiveDocument

Dim oDef As AssemblyComponentDefinition
oDef = oAssy.ComponentDefinition

Dim oCons As AssemblyConstraint
oCons = oDef.Constraints.Item("Insert:1")

Dim oEnt As Object
oEnt = oCons.EntityOne

Dim oEdge As Edge

If (TypeOf oEnt Is Edge) = True Then
	oEdge = oEnt
	MsgBox("Entity one is an Edge")
Else
	MsgBox("Nothing")
End If

 

0 Likes
Accepted solutions (1)
446 Views
2 Replies
Replies (2)
Message 2 of 3

aelqabbany
Advocate
Advocate
Accepted solution

Hi @dialunau,

 

Give this code a shot. You'll need to start off in a drawing with one view already placed.

 

This screencast shows the procedure: https://autode.sk/3vCIIiK

'Gets the drawing info
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews(1)

'Gets the Assembly & mate info
Dim oAssy As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oDef As AssemblyComponentDefinition = oAssy.ComponentDefinition
Dim oCons As AssemblyConstraint = oDef.Constraints.Item("Insert:1")
Dim oEdge As Edge = oCons.EntityOne

'Find the drawing curves that reflect the assembled edge
Dim EdgeDrawingCurves As DrawingCurvesEnumerator = oView.DrawingCurves(oEdge)

'Places the aforementioned curves into an array
Dim EdgeDrawingCurvesArray As New ArrayList
For Each oEdgeCurve As DrawingCurve In EdgeDrawingCurves
	EdgeDrawingCurvesArray.Add(oEdgeCurve)
Next

'Makes all hidden line segments invisible except those that relate to the assembled edge
For Each oCurve As DrawingCurve In oView.DrawingCurves
	If Not EdgeDrawingCurvesArray.Contains(oCurve) Then
		For Each oSegment As DrawingCurveSegment In oCurve.Segments
			If oSegment.HiddenLine Then
				Try
					oSegment.Visible = False
				Catch
				End Try
			End If
		Next
	End If
Next

		

 

Message 3 of 3

dialunau
Advocate
Advocate

Perfect, just what I was looking for.

Thank you.