I want to use the CreatePipe function to sweep a circle over a 270-degree range.
With the code below, I can achieve a 90-degree sweep, but I don't know how to extend it to 270 degrees.
I am testing this by copying it into "InterfaceTests" > "IEntityTest.cs" from the sample.
// Test suggested by Mito https://dynoinsightdev.com/viewtopic.php?p=268
public void CreatePipe()
{
// Build the profile wire
ICircle_DG circleProfile = m_gen.Create<ICircle_DG>();
circleProfile.Radius = 200;
IBRepEdge_DG edgeProfile = m_iBuilder.CreateEdge(circleProfile);
IBRepWire_DG iWireProfile = m_gen.Create<IBRepWire_DG>();
iWireProfile.AddEdge(edgeProfile);
IBRepShape_DG iShapeProfile = m_gen.Create<IBRepFace_DG>(iWireProfile).As<IBRepShape_DG>();
// Construct the central (spine) wire
ICircle_DG circleSpine = m_gen.Create<ICircle_DG>();
circleSpine.Radius = 1000;
// We need only a part of the circle. So, we need to reduce the parameter range.
// Parametrisation of the circle is defined by its construction frame
// The default parameter range is [0, 2*PI]. Point at prameter 0 is on the x axis
// The circle lies in the x and y plane of the construction frame
// with the center at the origin of the construction frame. Radius = 1
IFrame_DG fr = m_gen.Create<IFrame_DG>();
// fr is identity (=global axes) by default. This can be checked in debugger and fr.GetAxis(0); fr.GetAxis(1);
// Make sure we have the correct location and orientation
fr.Rotate(-0.5*Math.PI, 0);
fr.Rotate(Math.PI, 2);
fr.SetOrigin(1000, 0, 0);
circleSpine.Location = fr;
// Reduce the parameter range
ICurve_DG curve1 = circleSpine.As<ICurve_DG>();
// The parameter should be the angle. Let's check
RangeDg rg = curve1.ParameterRange;
Debug.Assert(rg.Is(0, 2 * Math.PI, m_tol));
// Modify
rg.Max = 1.5 * Math.PI;
curve1.ParameterRange = rg;
IBRepWire_DG iWireSpine = m_gen.Create<IBRepWire_DG>();
IBRepEdge_DG edgeCentralCurve = m_gen.Create<IBRepEdge_DG>(curve1);
iWireSpine.AddEdge(edgeCentralCurve);
// Build the pipe
IBRepShape_DG iShapePipe = m_iBuilderEx.CreatePipe(iWireSpine, iShapeProfile);
// Display
IEntity_DG iEntity = m_iModel.AddBRepShape(iShapePipe);
this.Display(iEntity, false);
}
public void Display(IEntity_DG entity, bool addToModel)
{
entity.SetColor(Color.BlueViolet);
if(addToModel)
m_iModel.AddEntity(entity);
// Show local frame
IScene_DG iScene = m_iView.As<IScene_DG>();
iScene.ShowLocalFrame(entity, true);
m_iView.GlobalAxes = true;
m_iView.Reset(true, true); // Fit
}