Hi Vaslav
The problem is that the edge needs a 3D curve to be attached.
There are several ways to show a 2d spline:
1. Convert a clone of the spline to 3D for the presentation purpose:
Code: Select all
IBSplineCurve_DG iCurveBs3D = m_myGenerator.Create("BSplineCurve_DG") as IBSplineCurve_DG; // Empty 3d spline
// Copy its attributes
IObject_DG iObj3Dcurve = iCurveBs3D as IObject_DG;
IObject_DG iObj2d = iCurveBS as IObject_DG;
iObj3Dcurve.Copy(iObj2d, null); // Copies 2D staff and sets z=0 everywhere
IBRepShape_DG iShape = m_myGenerator.Create1("BRepEdge_DG", iCurveBs3D);
.....
The key here that IObject_DG.Copy() does conversion whenever possible (and implemented) if the other object has a different type.
IObject_DG.Copy() works always for the same type. Other conversions similar to the above (2D is considered as part of z=0 plane whenever possible) are not done consistently. So if you need something else like that, just let us know. You might get it in few days at no charge.
2. This method is easy and nothing added to the model (unless specified)
Code: Select all
IView_DG iView = m_myDgkControl.GetView() as IView_DG;
IScene_DG iScene = iView as IScene_DG;
iScene.CreatePresentationEntity(iCurveBS as IObject_DG, false, null);
Pass true above if the presentation entity it needs to be added to the model for persistence, etc.
Many objects (vaguely related to geometry) can, but not all, be presented this way. Again, give us a yell.
3. The dumbest, but always available:
Create a sampling of the spline with something like 50 points and
Code: Select all
IEntity_DG iStripEntity = m_iModel.AddNewEntity1("SegmentStrip");
IGeometry_DG iGeom = iStripEntity.GetGeometry();
ISectionLineStrip iStrip = iGeom as ISectionLineStrip; //.. Copy the points into iStrip
Cheers