Search found 11 matches

by timied07
Tue Jun 25, 2024 11:44 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Huge thanks for helping me troubleshoot this and get a working solution!

I want to run through this macro in use a bit before I mark it solved, but I think I have it working; just want more testing and tested on a different computer to verify.

Should I be marking AlexB's post as correct answer?
by timied07
Tue Jun 25, 2024 3:29 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

I think I have it working. It is likely not the most efficient way to do it, but it seems to work for now. image.png Here is the code, needs some cleanup for sure... Option Explicit Function SelectMateEntity(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swMateEnt As SldWorks.MateEntity2...
by timied07
Tue Jun 25, 2024 3:16 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

I do think I'm on to something by combining my macro with your macro Alex. I need to try to compare the list of mate names that I have identified against all the the mates n the assembly and rename if they match.
by timied07
Tue Jun 25, 2024 3:12 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Didn't seem to make a difference
image.png
by timied07
Tue Jun 25, 2024 3:00 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Alex,
Thanks. I'm not following what you are saying. What do you mean by cast?
by timied07
Tue Jun 25, 2024 2:56 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

That didn't seem to make a difference.

Here is my setup:
1. Before execution of macro, click a face of the bearing. (You can see the highlighted line in the macro includes the "=" now
image.png

2. Here is the result from the execution
image.png
by timied07
Tue Jun 25, 2024 2:06 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Here is my macro, it is quite ugly at the moment after trying a lot of things...sorry in advance Option Explicit Function SelectMateEntity(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swMateEnt As SldWorks.MateEntity2, nMark As Long) As Boolean Dim swEnt As SldWorks.Entity Dim swSelMgr...
by timied07
Tue Jun 25, 2024 5:26 am
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Yes, I'll post it a bit later on. Thanks
by timied07
Mon Jun 24, 2024 5:22 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

I tried force rebuild and update feature tree, see attached screenshot of code: image.png Here is the relevant snippet from the Immediate Window image.png There is still no change in the Feature Tree in SolidWorks UI image.png Unsure if it makes a difference, but I'm running SW Student Edition 2023 ...
by timied07
Sun Jun 23, 2024 3:13 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Re: Renaming a Mate with VBA

Thanks, I'm definitely getting closer!

The Immediate Window shows the new name after running the macro:
image.png
image.png (3.12 KiB) Viewed 1694 times
However the feature tree in SolidWorks still shows the original name:
image.png
image.png (8.1 KiB) Viewed 1694 times
How do I push the name update back to SolidWorks?
by timied07
Sat Jun 22, 2024 6:18 pm
Forum: API
Topic: Renaming a Mate with VBA
Replies: 18
Views: 1765

Renaming a Mate with VBA

I have been working on some mate macros and at the point that I think we need to rename some of the mates so they can still be easily located / alignment flipped with the macros after the assemblies are being built up. I have access the mates and pull their paramteres, but I have not found a way to ...