when I using sweep1 command I can get a brep jus as my required.
when I using Rhino1RailSweep fuction I also can get a brep,but this brep is not my required.
when I using RhinoSweep1 funtion I can’t get any breps.
next is my whole codes,I want upload the 3dm file and codes as a attachment.
but I don’t konw how to upload a attachmen
Can you also provide a 3dm file that contains the results of the Sweep1 command. Also, what parameters for the Sweep1 command did you use. A screen capture of the Sweep1 dialog box might be useful.
thanks,dale:
I have send the attchment to you,why this forums doesn’t suppot upload attchment?
(just like the newsgroup)
If can upload will very convenient to all of us.
Attachments are supported. You can drag and drop images directly into your response. For other file types hit the little icon that looks like an image attachment in the formatting bar above your response. A popup box will appear with a place to drag and drop your file.
–Mitch
@sam or @discourse. The above post contains a large code block which is getting cut off when presented on a page. Is there a setting I need to adjust to fix this or is this a bug?
Hi,
Looks like the main problem is that you have to set the endpoint of the rail to the starting shape location.
You also have to get the shape curves going the same direction.
I made a couple of changes to your Sweep1() function to do those things.
Thanks,
Lowell
bool Sweep1(ON_Curve* in_rail,ON_SimpleArray<const ON_Curve*>in_secs,ON_SimpleArray<ON_Brep*>& out_breps)
{
// I guess you're only doing closed rails here
bool bClosed = true;
CRhinoPolyEdge edge_copy;
edge_copy.Create(in_rail);
// Set seam on closed rail to first shape location
if(bClosed && edge_copy.IsClosed())
{
double t;
if( !GetShapeParameterOnRail(*in_secs[0], edge_copy, 0.2, t) )
return 0;
ON_Interval domain = edge_copy.Domain();
if(t != domain[0])
if(!edge_copy.ChangeClosedCurveSeam(t))
return 0;
}
CArgsRhinoSweep1 args;
args.m_rail_curve = &edge_copy;
args.m_bHaveRailPickPoint = false;
args.m_bUsePivotPoint = false;
for( int i = 0; i < in_secs.Count(); i++ )
{
double t;
if( !GetShapeParameterOnRail(*in_secs[i], edge_copy, 0.2, t) )
return 0;
args.m_shape_curves.Append( const_cast<ON_Curve*>(in_secs[i]));
args.m_rail_params.Append( t );
// Set all of the shapes to go the same way.
// This isn't a very robust way to do that but it works with the kind of shapes you're using.
ON_3dPoint p = edge_copy.PointAt(t);
if(args.m_shape_curves[i]->PointAtStart().DistanceTo(p) > args.m_shape_curves[i]->PointAtEnd().DistanceTo(p))
args.m_shape_curves[i]->Reverse();
}
args.m_bUsePoints[0] = 0;
args.m_bUsePoints[1] = 0;
args.m_bClosed = true;
args.m_style = 0;
args.m_planar_up = ON_zaxis; // Don't need this, but set it anyway..
args.m_simplify = 0; // Simplify method for shape curves
args.m_rebuild_count = -1; // Sample point count for rebuilding shapes
args.m_refit_tolerance = 0.01;
args.m_sweep_tolerance =0.01;
args.m_angle_tolerance =0.01;// RhinoApp().ActiveDoc()->AngleToleranceRadians();
RhinoSweep1(args, out_breps);
return (out_breps.Count()>=1) ? true : false;
}
Looks like this forum doesn’t work right for long messages - heres the rest of the function:
for( int i = 0; i < in_secs.Count(); i++ )
{
double t;
if( !GetShapeParameterOnRail(*in_secs[i], edge_copy, 0.2, t) )
return 0;
args.m_shape_curves.Append( const_cast<ON_Curve*>(in_secs[i]));
args.m_rail_params.Append( t );
// Set all of the shapes to go the same way.
// This isn't a very robust way to do that but it works with the kind of shapes you're using.
ON_3dPoint p = edge_copy.PointAt(t);
if(args.m_shape_curves[i]->PointAtStart().DistanceTo(p) > args.m_shape_curves[i]->PointAtEnd().DistanceTo(p))
args.m_shape_curves[i]->Reverse();
}
args.m_bUsePoints[0] = 0;
args.m_bUsePoints[1] = 0;
args.m_bClosed = true;
args.m_style = 0;
args.m_planar_up = ON_zaxis; // Don't need this, but set it anyway..
args.m_simplify = 0; // Simplify method for shape curves
args.m_rebuild_count = -1; // Sample point count for rebuilding shapes
args.m_refit_tolerance = 0.01;
args.m_sweep_tolerance =0.01;
args.m_angle_tolerance =0.01;// RhinoApp().ActiveDoc()->AngleToleranceRadians();
RhinoSweep1(args, out_breps);
return (out_breps.Count()>=1) ? true : false;
}
hi,lowell:
I using you codes can sweep fluky with the 3dm upload before.
but now I have another 3dm file,this file still has the same problem:
when I using sweep1 command I can get a brep jus as my required.
when I using RhinoSweep1 funtion I can’t get any breps. sweep1.rar is the file I mentioned
The shape curves in that file are not very good.
They look like lines, but they have lots of control points. The ones at the toe and at the heel are especially bad, with control points stacked and very close together.
If you clean those up (replace with lines) does your program work?
I have try just using the curves start point and end point to creat a line as the new shape curve ,and let the line’s start point just on the rail curve.but still can’t sweep sucsuces