iLogic rule to change parts list style

iLogic rule to change parts list style

Anonymous
Not applicable
2,510 Views
4 Replies
Message 1 of 5

iLogic rule to change parts list style

Anonymous
Not applicable

Hi,

I need an ilogic rule to autmoatically change the style of the parts list in a drawing file.

The parts list style already exist in the drawing.

I search on this forums, but I'm not a specialist.

 

Could someone help me ?

 

Thanks in advance. Vincent

0 Likes
Accepted solutions (1)
2,511 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution

That's the line you're looking for:

 

oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("PartsList(nameofthepartlist)")

 

Here's the rule i use. Of course you'll have to tweak it a little bit (name of partlist):

 

Dim openDoc As Document
openDoc = ThisDoc.Document

'Dim docFile As Document

If openDoc.DocumentType = 12292 Then

    'Look For the model referenced within the drawing. End the Rule If the drawing Is empty.
    Dim MDocFile As Document
    If ThisDoc.ModelDocument IsNot Nothing Then
         MDocFile = ThisDoc.ModelDocument
         Else
         MessageBox.Show("It is forbiden to perform this action with an empty drawing", "Export error")
         Return
    End If
    
    'assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
        
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

 

    'Look for partlist within drawing. End rule, if it doesn't exist.
    'say there is a Partslist on the sheet.
    Dim oPartslist As PartsList
    oPartslist = oSheet.PartsLists(1)


    If oSheet.PartsLists(1) IsNot Nothing Then

        'set parts list to a specific style
        oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("PartsList(nameofthepartlist2)")

     End If
        
        
    Else
    MessageBox.Show("You must have a valid Drawing document open before using this code!", "File Type Mismatch!")
    
End If

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi streharg,

 

Thanks you very much for your reply. It works fine !

 

Regards.

0 Likes
Message 4 of 5

Eddimeister
Enthusiast
Enthusiast

Hey Guys...

 

This is the closest I've foundto Changing the Direction of a Table from TopDownDirection to BottomUpDirection...

 

I cant figure out the syntax... Can any one assist..!!!

 

Help..

 

Eddy

0 Likes
Message 5 of 5

Curtis_Waguespack
Consultant
Consultant

Hi edmarshall35 ,

 

This should work.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Dim openDoc As Document
openDoc = ThisDoc.Document
If openDoc.DocumentType <> kDrawingDocumentType Then

    'Look For the model referenced within the drawing. 
	'End the Rule If the drawing Is empty.
    Dim MDocFile As Document		
	
    If ThisDoc.ModelDocument IsNot Nothing Then
         MDocFile = ThisDoc.ModelDocument
    Else
         MessageBox.Show("No Model Reference Found.", "iLogic")
         Return 'exit rule
    End If
    
    'assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
        
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet 

    'Look for partlist within drawing. End rule, if it doesn't exist.
    'say there is a Partslist on the sheet.
    Dim oPartslist As PartsList
    oPartslist = oSheet.PartsLists(1)


    If oPartslist IsNot Nothing Then
'      'toggle parts list heading placement
'	  If oPartsList.HeadingPlacement = oPartsList.HeadingPlacement.kHeadingAtBottom Then
'		oPartsList.HeadingPlacement = oPartsList.HeadingPlacement.kHeadingAtTop
'	  Else
'		oPartsList.HeadingPlacement = oPartsList.HeadingPlacement.kHeadingAtBottom
'	  End If		

      'toggle parts list direction
	  If oPartsList.TableDirection = oPartsList.TableDirection.kBottomUpDirection Then
		oPartsList.TableDirection = oPartsList.TableDirection.kTopDownDirection
	  Else
		oPartsList.TableDirection = oPartsList.TableDirection.kBottomUpDirection
	  End If

    End If
        
Else
    MessageBox.Show("This is not a drawing file.", "iLogic")
End If


EESignature

0 Likes