Need help editing nested sub-assembly component design view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been trying to figure this out on my own for 3 days now and still not having much luck. Most of the examples that I've found don't go into enough detail or use iLogic which doesn't help me to understand how to actually do what I need to do in my Add-In using VB.NET.
I have a tool where would like to set all parts and sub-assemblies (and their sub-components) to a specific design view that matches the name of the top level assy Design View Rep name. First I look through all the LeafOccurrences to make sure all the parts have a specific DVR that matches the top level DVR name. If not, it opens the part and creates it, then closes it. Then comes the issue where if a sub-assembly doesn't have the specific DVR with the matching name, I get how to create an Assy DVR, but I don't understand how to create the Sub-Assembly DVR and that actually contains the sub-components with THEIR appropriate DVR. When I try SetDesignViewRepresentation on the sub-assembly, the sub-components change the "Master" When I change a suboccurrence to it's appropriate DVR, the assembly changes. I've tried creating proxies and changing proxies, substituting proxies. Nothing seems to behave like right clicking on the browser and clicking "Representation..." <=== this is exactly the functionality I want to mimic but the API behaves much differently.
I mostly have a good grasp on the concept of ComponentOccurrences and ComponentOccurrentProxies. The issue that I'm struggling to nail down is how to actually properly create a DVR for a sub-assembly which contains the appropriate part DVRs.
Here's an example to try and clarify:
Change Parent Assy DVR to "BRANDNEW" (whether existing or new)
Go through all sub-assemblies and parts to make sure all Parts are set to "BRANDNEW" and Sub-Assemblies are set to "BRANDNEW"
Check through all sub-assemblies to make sure all their parts are set to "BRANDNEW" (if not do so)
If any of the parts or assemblies do not contain a DVR named "BRANDNEW" create them.
Before Running tool:
BRANDNEW (Top Level Assy)
---Default (Sub Assy)
---Master (Part)
---Editing (Sub Assy)
---Master (Part)
---Master (Part)
---Default (Part)
---BRANDNEW (Part)
After Running tool:
BRANDNEW (Top Level Assy)
---BRANDNEW (Sub Assy)
---BRANDNEW (Part)
---BRANDNEW (Sub Assy)
---BRANDNEW (Part)
---BRANDNEW (Part)
---BRANDNEW (Part)
---BRANDNEW (Part)