I am writing macro in VBA Solidworks 2014 and I cant get the depth of the extrude cut feature when it was created using "through all". .GetDepth function returns 0 as depth. Can anyone please help me with this?
The method trough all does not specify any depth at all.
To set a depth, you have to change T1 / T2 parameter of the feature.
2014 SOLIDWORKS API Help - FeatureCut3 Method (IFeatureManager)
There are a couple of approaches, depending on how much you know about the thing your macro is cutting. Basically, you're going to have to analyze the resulting geometry after the cut is made. For example, let's say your cut terminates on an angled surface. What depth do you want there?
What if it intersects multiple bodies? or only partly?
What if your cut sketch has multiple closed contours and terminates at an angled surface? Then you sort of have different depths, right?
What info are you really after? What if someone cuts away the terminating face in a later operation? Do you want to know the effective depth at that time, or at the time of the cut?
If you know that you're cutting from one planar face to a parallel planar face on the same body, you can pretty easily analyze the resulting geometry. Other cases get more complicated from there.
Retrieving data ...