I am developing a C# standalone application to convert an Excel table (component position & orientation) into a SolidWorks assembly.
The data gives:
- Position of component origin with X/Y/Z point
- Orientation of component origin with X/Y/Z vectors
I am using a class to manage sketch entities:
private class InsertPoint
{
...
public SketchPoint Origin;
public SketchSegment XAxis;
public SketchSegment YAxis;
public SketchSegment ZAxis;
public Feature CoordSystem;
}
I create many points with:
var insertPoints = new List
(); insertPoints[i].Origin = skMgr.CreatePoint(...);
insertPoints[i].XAxis = skMgr.CreateLine(...);
insertPoints[i].YAxis = skMgr.CreateLine(...);
insertPoints[i].ZAxis = skMgr.CreateLine(...);
Screenshot of sketch:
But when I try to create the coordinate system:
insertPoints[i].CoordSystem = ftMgr.CreateCoordinateSystem(
insertPoints[i].Origin,
new object[] { insertPoints[i].XAxis },
new object[] { insertPoints[i].YAxis },
new object[] { insertPoints[i].ZAxis }
);
The coordinate systems has a valid position but not a valid orientation.
The documentation is light and VBA example not clear.
Is somebody can see where is my error ?
Best regards,
Alexandre
SolidworksApi macros