
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How do you define that you're in an assembly and want to select a component based on its name? Any sample snippets of code would be appreciated.
Here's my "pseudo-code":
Sub SelectMyPart () Dim ThisApplication As something Dim ThisDocument As something Dim ThisAssemblyDocument As something Dim ThisPart (MY PART NAME) As something Select (MY PART NAME)
blahblahblah actions
End Sub
Other secondary questions of interest:
1. My compiler doesn't like
For Each oOcc In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences
My theory is because it's an assembly document and doesn't know that. Do you agree?
2. Have you ever replaced a component using the VBA editor? If so, would you be so kind as to share how you did it? I have all the dirty work done of identifying the complicated parts of what is getting replace. I just can't get the replace itself to work 😞
3. Do you have issues with oOcc / oOccurrence? My compiler REALLY dislikes this.
Thanks for all your help! I'm not posting the full code for now, since my main question is about identifying that it's an Inventor Part from a designated assembly. I will post it if requested, but I don't want to scare away potential answers because of a long post. 😄
Solved! Go to Solution.