Can somebody please point me in the right direction for a macro that traverses a weldment cut list and for each profile in the cut list look at both ends of the profile to check their angles. Check if their angles are according to the same plane or twisted/rotated 90° and also if the angles are 45° or 135°

See also my first question about this but without API

https://forum.solidworks.com/message/1013032?commentID=1013032#comment-1013032

what you probably need to do to approach this, is to use reference the triad coordinate system.

if your models are drawn with this in mind you can get the 3D angles relative to the coordinate system.

reference lines on the part, they have an axis in 2019 SOLIDWORKS API Help - LineParams Property (ICurve)

the adjacent part also has line params.

Take the two vectors and calculate the angle between them.

So if the line vector = 0,0,1 it is going positive to Z

If it is 0,0,-1 it is negative Z

1,0,0 is positive Y

So it could be .25,0.25,0.5 (they always add up to 1, that is what a normalized vector is) which has angles to each vector

To get the angle from one vector to another

create cartesian vectors

dim XVect as mathvector '(1,0,0)

Dim YVect as mathVector '(0,1,0)

Dim ZVect as MathVector '(0,0,1)

use the macro below to get started. this will get the angle between two edges. make sure they are lines.

sketch segments could work using sketchLine.GetCurve

2019 SOLIDWORKS API Help - GetCurve Method (ISketchSegment)

All you need are 3 numbers defining an axis to figure out angles to eachother or to the 3 Cartesian default vectors

Jacob Corder

www.cadsharp.com