How did you retrieved the ReferenceCurve from Helix? If you get reference curve you can use the following sequence of methods:
You can retrieve it with Feature::GetSpecificFeature2().
Your solution is less steps than mine but also give an array of double.
I finally succeeded to select it with the SelectById2() with the array of double; I dont like that but it is the only solution I found. (I highly prefer Select2() )
Here is the sequence:
vEndPoint = Vertex::GetPoint()
ModelDoc2.Extension.SelectByID2("Unknown", "POINTREF", vEndPoint(0), vEndPoint(1), vEndPoint(2), false, 0, Nothing, 0)
I have tried this approach and it works for me. Try the following macro: #CODE|Select End Vertices of Spiral/Helix Feature
You do not need to get the point from IVertex. IVertex can be cast to IEntity which can be selected via Select4 method.
oh yes, Entity! Forgot that one! It works!
Just an additional comment :
It selects the vertex entity but not the point entity.
The coincident reference plane passing by it shows "Vertex<1>" and not "Point<1>" (when done manually).
I also tried to add a sketch constraint using this vertex. The constraint works but is not displayed in the sketch... really weird...
I'm attempting to create a helix programmatically, but it doesn't work. Half the time it crashes autocad, and half the time it draws a helix that doesn't follow the parameters I set. Can someone tell me what I'm doing wrong? Here is the code:
public static ObjectId DrawHelix(Transaction transaction, Point3d startPoint, Vector3d axis, double radius, double height, double numberOfTurns, bool isLeft)
// Open the Block table for read
using (BlockTable _blockTable = transaction.GetObject(Utils.ActiveDatabase.BlockTableId, OpenMode.ForRead) as BlockTable)
// Open the Block table record Model space for write
using (BlockTableRecord _blockTableRecord = transaction.GetObject(_blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord)
using (Helix _helix = new Helix())
_helix.BaseRadius = radius;
_helix.TopRadius = radius;
_helix.StartPoint = startPoint;
//_helix.EndPoint = endPoint; not implemented exception?
_helix.Height = height;
_helix.Turns = numberOfTurns;
_helix.Twist = isLeft;
//_helix.AxisVector = axis;
throw new System.Exception();
1) Do I have to set the properties of the helix in a particular order?
2) Does the StartPoint property actually control the start of the helix? On the occasions when this function works, the resulting helix is never drawn anywhere near the given start point.
3) Autocad's HELIX command asks the user to select a center point, but the Helix class doesn't have a CenterPoint property. Is there a way to set the center point programmatically?
4) What is the AxisVector supposed to control? I commented it out because it never seemed to affect anything.
5) If I later want to sweep a rectangle along the helix object, can I use the helix directly, or do I need to cast it to another type?