Change visiblity depending on material asigned

Change visiblity depending on material asigned

Anonymous
Not applicable
625 Views
6 Replies
Message 1 of 7

Change visiblity depending on material asigned

Anonymous
Not applicable

Hi,

In an assebly, I want to only show on screen parts with a defined material only.

 

I.e. All parts that the material is set to "steel" are visible / all other parts are not visible

 

OR

 

All parts that the material is set to "steel" or "glass" are visible / all other parts are not visible

 

Thanks for you help

Mike

 

 

0 Likes
626 Views
6 Replies
Replies (6)
Message 2 of 7

CCarreiras
Mentor
Mentor

Hi!

 

There's no automatic View filters based in properties, but you can create several View Representations mannually to achieve what you said.

CCarreiras

EESignature

0 Likes
Message 3 of 7

Anonymous
Not applicable

Is there some Ilogic that could do this? (I am new to Ilogic so am not sure what you can do or how to do it!)

0 Likes
Message 4 of 7

CCarreiras
Mentor
Mentor

I don't think so.

iLogic programing is a way  that uses inventor capabilities. Doesn't add new features that do not exist already in the inventor, simply you can automate them.

i mean, directly not, but... you can start trying something like this:

 

 

 

IF iProperties.MaterialOfComponent("partA:1")="Steel" THEN

 

Component.Visible("PartA:1") =true

 

ELSE

 

Component.Visible("PartA:1") =False

 

END IF

CCarreiras

EESignature

0 Likes
Message 5 of 7

MechMachineMan
Advisor
Advisor
Public Class PVars
Shared oMatl As String = InputBox("Conatining Phrase of Mat'l to Isolate", "ISOLATE", "Steel")

Public Sub TraverseAssemblySample()
Dim PVar As New PVars ' Get the active assembly. Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Debug.Print oAsmDoc.DisplayName ' Call the function that does the recursion. Call TraverseAssembly(oAsmDoc.ComponentDefinition.Occurrences, 1) End Sub Private Sub TraverseAssembly(Occurrences As ComponentOccurrences, _ Level As Integer) ' Iterate through all of the occurrence in this collection. This ' represents the occurrences at the top level of an assembly. Dim oOcc As ComponentOccurrence For Each oOcc In Occurrences If oOcc.Definition.Document.PropertySets.Item("Design Tracking Properties").Item("Material").Value Like "*" & PVar.oMatl & "*"
'oOcc.Visible = False
Else
'oOcc.Visible = True
If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then Call TraverseAssembly(oOcc.SubOccurrences, Level + 1) End If Next End Sub

End Class

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 6 of 7

LukeDavenport
Collaborator
Collaborator

Hi Mikey,

This looks like a perfect job for my addin on the Exchange App Store:

 

Youtube video:

https://www.youtube.com/watch?v=qem8o-R2mqQ

 

App Store: 

https://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3aviewr...

 

It does the exact thing you describe - allows as many assembly filters as you like to be created and saved for iProperties (including Material), that can be updated with one click whenever the assembly changes.

 

I hope this helps,

Luke

0 Likes
Message 7 of 7

Anonymous
Not applicable

Thanks for the reply.

 

I have tried your rule but get the following error message...

 

Error in rule program format:

All other Sub's or Functions must be after Sub Main()

 

This doesn't mean anything to me. Is it something that can be solved?

 

Thanks for your help

Mike

0 Likes