Max, you can use either. What you wrote reduces the number of lines but might be less clear to newer API programmers. I always write out all of the casts to make my code clearer for beginners.
Ready to start learning the SolidWorks API? Sign up for FREE membership here.Keep up with new videos, macros, and training events by joining our mailing list:
Hi Keith,
Is there a reason we shouldn’t have the following:
Set swEnt = vFaces(i)
and eliminate:
Dim swFace As SldWorks.Face2
Set swEnt = swFace
Thanks,
Max
Max, you can use either. What you wrote reduces the number of lines but might be less clear to newer API programmers. I always write out all of the casts to make my code clearer for beginners.