I've got a macro to create a hollow tube, with a user form which prompt the user for O.D, Length and I.D.
The modelling process is as follows:
New sketch on right plane
ISketchManager::CreateCircle(0#, 0#, 0#, 0, (Diameter / 2000), 0#)
ISketchManager::CreateCircle(0#, 0#, 0#, 0, (InternalDiameter / 2000), 0#)
Extrude midplane by specified length
The macro works fine with in most cases, however it fails if the Diameter and InternalDiameter values are too close together.
For example with a 25mm OD, an ID of 24mm works fine, but an ID of 24.5mm will cause it to fail.
I believe that the reason it fails is that two sketch relations are added between the two circles, Radius0, and Tangent2. This of course means the two circles are the same size, and can't be used for a hollow extruded feature.
If I turn off Automatic Relations, the resulting sketch doesn't have the Tangent relation, but the radius relation remains. This also gets rid of the automatic relation of the circle centre points to the origin too, which I want.
I'm pretty new to the API, but I would have thought that the geometry defined by CreateCircle would take priority over a Radius relation with a nearby sketch entity.
Are the X,Y,Z co-ordinates simply interpreted as equivalent to a mouse click at that location?
I have circles set to auto-dimension, so maybe I have to change my macro to create one 10mm circle, and one 20mm circle, then change the dimensions afterwards.
If anyone can tell me why exactly this is happening, and any suggestions as to the best way to prevent it occuring, I would be very interested.