Macro to search all parts in assy for a sketch and convert the entities to a new sketch

Hi Guys

I am looking for a way of searching all parts in an assembly for a sketch named 'PanelCutout' and converting the entities in that sketch to a new sketch (One new sketch containing offset or converted entities from all of the parts) Has anyone ever done anything like this? Or care to point me in the write direction to roll my own. (I looked at the help but couldn't see where to start :-(

Its to get around the lack of smart component features in a sub assembly problem. I have a pcb with components that have to fit throught a panel. I have put a sketch on each of the components for the cutout req, but it is time consuming to select each one and convert it manually.

All help greatfully received

Rich

Reply to
Rich
Loading thread data ...

Right click on anything in the Feature Manager and select "Go To..." In the pop-up dialog box, type in the name of whatever you are looking for (in this case your sketch name), and click "Find Next", it will take you right to it. You can then right click on the sketch to "show" it so that you can select the sketch geometry (for converting in another sketch).

But, may I suggest an alternative. Instead of converting the sketch geometry into a new sketch (I'm assuming in another part), derive the entire sketch. You can then use this derived sketch in your new part to reference any downstream features/sketches, instead of from the assembly. The advantages to this method are that it puts WAY less stress on SW which makes it significantly faster. In my parts that require in-context references, I basically only use derived sketches from an assembly as my only references. Everything else is built directly in the part file using these derived sketches. This method screams compared to my old in-context reference methods.

Reply to
Seth Renigar

In help look up Traverse in the Index select assemblies. There are 3 or 4 examples. With probably just one if then statement and a few lines of code you could make it do what you are looking for.

Corey

Reply to
CS

Ok! I didn't read your question very well. It is a little bit more in-depth than I had thought. But I still think derived sketches can be utilized here to save time.

Reply to
Seth Renigar

As Corey mentioned, this is a job for the API. And as he mentioned there are several example programs that will help you find the sketch. Creating a converted copy of the sketch will be a little more tricky and requires more research to find the necessary bits and pieces to do what you want. If you aren't an API whiz I would suggest getting help.

Reply to
TOP

Thanks to all who replied. I will look at all suggestions later. I have never looked at the solidworks API but have done similar before so I might give it a whirl later. I'll post back if I ever get it working!

Take Care

Rich

Reply to
Rich Thompson

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.