Jump to content
hayyagahoy

SolidWorks API - Copy part name text

Recommended Posts

hayyagahoy

Hello,

 

I am fairly new to SolidWorks and even newer to scripting. Our design department recently came to me wondering if there was a way to create a macro that when they selected a part in the feature tree on the left hand side, and pushed the macro hotkey, if the name could be copied to the clipboard to be pasted in other programs. We have various documents that they need the name of, and right now they are right clicking on the part name and selecting properties, and getting to the name that way to copy it. It would be a lot easier for them if they could just do a quick key similar to ctrl+c to copy it. It would be even better if they could select multiple parts at a time, and have it copy each part name on a different line so when you pasted it, it would look similar to:

 

part1

part2

part3

 

If anyone has anyone could help me out it would be very much appreciated. Even if all you can give me is pointers or suggestions. Thanks very much!!

Share this post


Link to post
Share on other sites
bhamze

Copy Feature Names Place In Clip Board.zip

 

I'm a bit hesitate sharing this macro as I'm not an API expert and newish myself. The code has no error handling so make sure you have the features selected in feature tree before running macro. Select your items, run macro then paste items in note, word etc...

Copy Assembly Part Names to Clip Board.zip

Edited by bhamze

Share this post


Link to post
Share on other sites
hayyagahoy

Thanks for sharing that with me! It didn't exactly work for me, it isn't picking up that anything is selected in the feature tree. But it's a good start for me to go off of. I really appreciate it!

Share this post


Link to post
Share on other sites
bhamze

Are you in an assembly or part? There are two macros attached, one for part files and one for assemblies. They both work for me. Curious why it's not working for u.

Share this post


Link to post
Share on other sites
hayyagahoy

I had tried both a part and assembly. But I also didn't realize you posted two! The copy feature names didn't work for me in either, but the copy assembly part names worked great! That's exactly what I was trying to do, thank you very much!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...