Page 1 of 1

Copy Surface Macro

Posted: Sun Jul 25, 2021 7:23 am
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

Re: Copy Surface Macro

Posted: Sun Jul 25, 2021 8:51 am
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

Re: Copy Surface Macro

Posted: Sun Jul 25, 2021 11:45 am
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.

Re: Copy Surface Macro

Posted: Mon Jul 26, 2021 10:42 am
by josh
This thread might give you a head-start:

https://forum.solidworks.com/thread/219694

Re: Copy Surface Macro

Posted: Tue Aug 10, 2021 2:22 pm
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

Re: Copy Surface Macro

Posted: Tue Aug 17, 2021 7:36 am
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!

Re: Copy Surface Macro

Posted: Tue Aug 17, 2021 2:14 pm
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 1067 times
direct link:
https://www.codestack.net/solidworks-ap ... set-equal/

Eddy