Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SolidWorks API - Copy part name text

Status
Not open for further replies.

hayyagahoy

Computer
Oct 1, 2013
3
0
0
US
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!!
 
Replies continue below

Recommended for you

Thanks for the reply! I have come across that one though. That one does a full feature tree copy. What I am looking for is to only copy the main part name of what is selected, not the whole tree and all it's subcontext. I'm going to keep looking and trying to modify this script though. Any other suggestions or pointers would be great though!

Thanks again!
 
This solution requires a few clicks, but it may get you where you need. A macro could probably be made from these steps, but I am not a macro guru...

From the model, you can Insert, Tables, Bill Of Material...
Once configured how you want, RMB on the BOM, Save as, then select the Save as Type (Excel works great). Once in Excel, you can copy paste all the PN's as desired.
 
Hmm, that could work. I'll run it by the designers and see if they'd be ok with that option. Then I'll work on seeing if it can be made into a macro. Thanks for the idea!
 
Status
Not open for further replies.
Back
Top