iLogic - Change partslist style/layer visibility for all drawings in folder

iLogic - Change partslist style/layer visibility for all drawings in folder

HAFA12
Enthusiast Enthusiast
367 Views
1 Reply
Message 1 of 2

iLogic - Change partslist style/layer visibility for all drawings in folder

HAFA12
Enthusiast
Enthusiast

What I'm trying to do:

From a form in my main drawing I'd like to control;

-fill in as built date (custom iprop, gets used in stamp)

-change visibility "As Built" layer (shows/hides stamp with date)

-change the partslist style depending on what materialnotation I select in my form

 

I'd like this to happen for all sheets in the active document, but also for the other 5 drawings that are residing in the same folder.

 

What I got so far:

 

Sub Main()
    Dim oDoc As DrawingDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oStyleMgr As DrawingStylesManager
    oStyleMgr = oDoc.StylesManager
    
    Dim oPartListStyle As PartsListStyle
	
	If Parameter("MaterialNorm") = "AD-2000 304" Then
	oPartListStyle = oStyleMgr.PartsListStyles.Item("-Norm_AD2000s")

    ElseIf Parameter("MaterialNorm") = "AD-2000 904L" Then
	oPartListStyle = oStyleMgr.PartsListStyles.Item("-Norm_AD2000n")
	
	ElseIf Parameter("MaterialNorm") = "ASME 304" Then
	oPartListStyle = oStyleMgr.PartsListStyles.Item("-Norm_ASMEs")
	
  	ElseIf Parameter("MaterialNorm") = "ASME 904L" Then
	oPartListStyle = oStyleMgr.PartsListStyles.Item("-Norm_ASMEn")
	
	End If
	
     Dim oPartsList As PartsList
    For Each oPartsList In oDoc.ActiveSheet.PartsLists
        oPartsList.Style = oPartListStyle
	Next	
	
	
 If AsBuilt = True Then
ThisDrawing.Document.StylesManager.Layers("As Built LAYER").Visible = True
Else ThisDrawing.Document.StylesManager.Layers("As Built LAYER").Visible = False

End If

End Sub

 

 

This gets done what I wanted to happen, except it only works for the active sheet. I'd love to get it working on the other sheets and drawings too but I'm not sure how to achive/approach that (my iLogic/VBA experience is rather limited).

0 Likes
368 Views
1 Reply
Reply (1)
Message 2 of 2

Mark.Lancaster
Consultant
Consultant

@HAFA12

 

Inventor programming questions and issues needs to be posted in the Inventor Customization forum (for best results)

 

https://forums.autodesk.com/t5/inventor-customization/bd-p/120

 

I will have the moderator relocate your posting to better suit your needs.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.