Exclude from print if Model iProperty exists

Exclude from print if Model iProperty exists

dliteful
Contributor Contributor
517 Views
2 Replies
Message 1 of 3

Exclude from print if Model iProperty exists

dliteful
Contributor
Contributor

Love the iLogic Batch print to PDF from assembly, but I've been asked to exclude certain file types that contain the Model iProperty Value of "SPA" under the Summary Tab in Category field.

 

Any help would be greatly appreciated.

 

Attached is the code I'm using.

0 Likes
518 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

put somthing like this in your code when you open a idw. I use this for something similar 

 

For Each oOcc In oLeafOccs 'this is your code 
    
	
	 oDoc = oOcc.Definition.Document ' not new 





Dim emodel As String = oDoc.DisplayName 'use this



ex = Right(emodel,4) 'with this are you sure you have a ex


If ex <> ".ipt"

emodel = emodel & ".ipt"

End If



eTest= Left(iProperties.Value(emodel,"summary","category"),6) 'here you can make a if statement





If eTest <> "Laser" Then

****
0 Likes
Message 3 of 3

chandra.shekar.g
Autodesk Support
Autodesk Support

@dliteful ,

 

Hoping that below iLogic code helps to exclude components which contains "SPA" Summary Category.

Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4)

'check that the active document is an assembly file
If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If

For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	Dim oCategory As String 
	oCategory = oRefDoc.PropertySets.Item("Inventor Summary Information").Item("Category").Value
	
	If oCategory <> "SPA" Then
		Call PDFAddIn.SaveCopyAs(oDrawDoc, oContext, oOptions, oDataMedium)
	End If
Next

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes