Set active iPart member

Set active iPart member

meck
Collaborator Collaborator
794 Views
2 Replies
Message 1 of 3

Set active iPart member

meck
Collaborator
Collaborator

I am having a hard time figuring out how to set the active member in an iPart. Not in an assembly while I'm in the ipart factory part.

 

I want to loop through all of the members so the flat pattern with update then export the flat to dxf. I've got the export to dxf part, but I cannot for the life of me figure out how to activate each member. I know this should be easy, but I'm having a brain cramp I guess.

 

Any help would be awesome!

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes
Accepted solutions (1)
795 Views
2 Replies
Replies (2)
Message 2 of 3

JaneFan
Autodesk
Autodesk
Accepted solution

How about using the property to set default row in you rloop: 

Code Snippet

If doc.ComponentDefinition.IsiPartFactory  Then 
	Dim IPF As iPartFactory 
	IPF = doc.ComponentDefinition.iPartFactory 
	
	Dim oRow As iPartTableRow 
	oRow = IPF.TableRows.Item(1)
	IPF.DefaultRow = oRow 
End If 

 




Jane Fan
Inventor/Fusion QA Engineer
Message 3 of 3

meck
Collaborator
Collaborator

Thanks JaneFan!

Here is the code...

Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 8099 StartFragment: 314 EndFragment: 8067 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet

Public Sub LoopThruiParts
    'This sub iterates thru all of the Part of an iPart Factory
    'An iPart must be the active document

    'Set Connection to active document
    Dim oiPartDoc As PartDocument
    oiPartDoc = ThisDoc.Document
    'Check to see it it's an iPart
    If oiPartDoc.ComponentDefinition.IsiPartFactory  Then         
        'Set a reference to the iPart Factory
        Dim oiPartFactory As iPartFactory
        oiPartFactory = oiPartDoc.ComponentDefinition.iPartFactory    
    
        'Loop through all the rows in the iPart table and set that row to the active iPart
        Dim i As Integer = 0
        For i = 1 To oiPartFactory.TableRows.Count
            Dim IPF As iPartFactory 
            IPF = oiPartDoc.ComponentDefinition.iPartFactory 
            
            Dim oRow As iPartTableRow 
            oRow = IPF.TableRows.Item(i)
            IPF.DefaultRow = oRow 
        Next
    
    End If
End Sub
Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes