Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

The untested code I have so far is:

Dim oView As DrawingView
Dim oViewDoc As Document
Dim oDoc As Document
Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

oView=ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select the base view")
oViewDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

Dim oEye As Point
'Dim oTarget As Point
Dim oUpVector As UnitVector

Dim oViewCam As Camera 
oViewCam = oView.Camera

oEye = oViewCam.Eye() 
'oTarge = oViewCam.Target()
oUpVector = oViewCam.UpVector()

oDoc = ThisApplication.Documents.Open(oViewDoc.FullDocumentName, True)
oDoc.Activate




oNewView = oDoc.RepresentationsManager.DesignViewRepresentations.Add()
oNewView.Activate
oNewViewCam = oNewView.Camera
With oNewViewCam
	.Eye = oEye
	.UpVector = oUpVector
	.Fit
	.Apply
End With
oNewView.SaveCurrentCamera
oNewView.Update

Dim oControlDef1 As ControlDefinition
 oControlDef1 = oCommandMgr.ControlDefinitions.Item("AssemblyVisibilityCheckerCmdAllInCamera")
oControlDef1.Execute

Dim oControlDef2 As ControlDefinition
 oControlDef2 = oCommandMgr.ControlDefinitions.Item("AssemblyEnhSelInvertCmd")
oControlDef2.Execute

oNewView.SaveCurrentCamera

'oNewView.SetVisibilityOfOccurrences(Occurrences As ObjectCollection, Visible As Boolean)
oNewView.Locked = True
oNewView.Update

 

But I don't know how I Access the Selection Set Produced By the Control Defintions. Any easy way to do this?

And is it better or easier to use this view to set visibility, or to just do it manuall then?


--------------------------------------
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