Picking sketch line from drawing

Picking sketch line from drawing

sellis
Advocate Advocate
552 Views
3 Replies
Message 1 of 4

Picking sketch line from drawing

sellis
Advocate
Advocate

 

VB.NET with VS2010, Inventor 2012

 

I have a drawing view of a part with a sketch that contains some lines. I need to pick one of the sketch lines.

 

I can pick a line with sketch active using the kSketchCurveLinearFilter

 

I have not been able to pick it from outside of sketch. Have tried using kDrawingCurveSegmentFilter to get a DrawingCurveSegment but I can not get the sketch line from the DrawingCurveSegment

 

I assume there is a way to get the sketch line from DrawingCurveSegment or DrawingCurveObject but have not figured it out.

 

A sample would be great.

 

Thanks

Stan

 

0 Likes
553 Views
3 Replies
Replies (3)
Message 2 of 4

amitnkukanur
Collaborator
Collaborator

i did this and hope this helps you. I have a Assembly and place a part to it(with *.ipt extension)

and this below code in new Sub

 

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        '//start Inventor through code
        Dim started As Boolean = False
        Try

            Dim InvType As Type = GetTypeFromProgID("Inventor.Application", True)
            selectedSample = CreateInstance(InvType)
            selectedSample.Visible = True
            started = True
        Catch ex As Exception
            MessageBox.Show(ex.ToString())

        End Try

    End Sub

 

 

double click in a button on form and add this code

 

 Dim asmDoc As AssemblyDocument
        asmDoc = selectedSample.ActiveDocument
        If asmDoc.SelectSet.Count = 0 Then
            MessageBox.Show("No item selected")
        End If

        selSelected = asmDoc.SelectSet
        Dim CompOccurance As ComponentOccurrence
        Dim obj As Object
        For Each obj In selSelected
            CompOccurance = obj
            CompOccurance.Visible = False
        Next

 

 

this will select a line and makes its visibility false

 

 

 

Senior Software Engineer
0 Likes
Message 3 of 4

sellis
Advocate
Advocate

Thanks but that is not quite what I am doing.

 

This is an idw file with a sketch and I need to select a line from the sketch without having the sketch open for editing. I believe I need to select a DrawingCurveSegment and somehow get the sketch line from that.

 

Stan

 

 

0 Likes
Message 4 of 4

sellis
Advocate
Advocate

Errr.... never mind

 

DrawingCurveSegment.Parent.ModelGeometry returns the sketch item.

0 Likes