Copy Surface Macro

Programming and macros
User avatar
zwei
Posts: 701
Joined: Mon Mar 15, 2021 9:17 pm
Answers: 18
Location: Malaysia
x 185
x 600

Copy Surface Macro

Unread post by zwei »

So...
There had been some macro idea in my personal backlog for quite some times and I finally have some times to start working on them recently...

Before i start working on the macro from scratch, I thought i should ask around here first whether is there an existing macro that i can reuse...

1. Copy Surface macro
So.. i am kind of annoyed with the amount of mouse click i need to copy a surface (entering 0 as value, and then accept), I will be great if i can just copy all the selected surface with 1 click/key without going into the interface...

The macro should:
i. Offset all selected surface by 0 (User will select the surface before clicking the macro)
ii. (Optional) Apply a preset color to the copied surfaces
by Eddy Alleman » Tue Aug 10, 2021 2:22 pm
Hi @Zhen-Wei Tee

I just uploaded a VBA macro to Codestack that does what you asked:

https://github.com/EddyAlleman/codestac ... fset-equal

It could take some days before you can find it on the Codestack website. This way you can look into it already.

Happy coding!

Eddy
Go to full post
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
User avatar
Eddy Alleman
Posts: 50
Joined: Thu Apr 01, 2021 10:32 am
Answers: 8
Location: Belgium
x 80
x 89
Contact:

Re: Copy Surface Macro

Unread post by Eddy Alleman »

Hi @Zhen-Wei Tee

you also could achieve this by using "knit surface"
there is an API example in the help files:
"Create Surface Knit Feature Example"
https://help.solidworks.com/2016/englis ... le_vb6.htm

An advantage here can be that you can merge the resulting surfaces

Eddy
User avatar
matt
Posts: 1589
Joined: Mon Mar 08, 2021 11:34 am
Answers: 19
Location: Virginia
x 1219
x 2371
Contact:

Re: Copy Surface Macro

Unread post by matt »

There are already 3 functions that copy surfaces:

1) move copy bodies - for solid/surface bodies
2) knit, as mentioned by @Eddy Alleman
3) offset (at 0 distance).

Move bodies only works if you don't have it set to using mates.
Knit won't work for a single face

If your macro gets around these and can be initiated with a hotkey, that would be cool.
User avatar
josh
Posts: 295
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 508

Re: Copy Surface Macro

Unread post by josh »

This thread might give you a head-start:

https://forum.solidworks.com/thread/219694
User avatar
Eddy Alleman
Posts: 50
Joined: Thu Apr 01, 2021 10:32 am
Answers: 8
Location: Belgium
x 80
x 89
Contact:

Re: Copy Surface Macro

Unread post by Eddy Alleman »

Hi @Zhen-Wei Tee

I just uploaded a VBA macro to Codestack that does what you asked:

https://github.com/EddyAlleman/codestac ... fset-equal

It could take some days before you can find it on the Codestack website. This way you can look into it already.

Happy coding!

Eddy
User avatar
zwei
Posts: 701
Joined: Mon Mar 15, 2021 9:17 pm
Answers: 18
Location: Malaysia
x 185
x 600

Re: Copy Surface Macro

Unread post by zwei »

Eddy Alleman wrote: Tue Aug 10, 2021 2:22 pm Hi @Zhen-Wei Tee

I just uploaded a VBA macro to Codestack that does what you asked:

https://github.com/EddyAlleman/codestac ... fset-equal

It could take some days before you can find it on the Codestack website. This way you can look into it already.

Happy coding!

Eddy
Sorry for the late reply, the last few days was really busy for me
I had tested out the marco and it was really FANTASTIC
It even include the number of faces being copied in the feature which is really nice :)

Thanks alot!
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
User avatar
Eddy Alleman
Posts: 50
Joined: Thu Apr 01, 2021 10:32 am
Answers: 8
Location: Belgium
x 80
x 89
Contact:

Re: Copy Surface Macro

Unread post by Eddy Alleman »

You´re welcome.
Glad you like it !
The macro has been published on Codestack today.
Go to Goodies > Geometry > copy surfaces
image.png
image.png (17.39 KiB) Viewed 1077 times
direct link:
https://www.codestack.net/solidworks-ap ... set-equal/

Eddy
Post Reply