-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
The following piece of code uses Make3D.MakePipe-method, but fails with GeoVectorException
Looking at source it seems like it fails on line 1011 of Make3D.cs in which an attempt to calculate normal with two vectors pointing to same direction is made. It looks like the code assumes that the path is curved and fails if it is just straight line or the start and end point to same direction.
public static class CadabilityMakePipeDemo
{
public static void Main()
{
// Example usage:
Project project = Project.CreateSimpleProject();
double width = 10.0;
double height = 5.0;
double depth = 20.0;
IGeoObject pipeObject = CreateRectAndMakePipe(project, width, height, depth);
}
/// <summary>
/// Creates a rectangle in the XY plane at the origin and sweeps it along +Z using Make3D.MakePipe.
/// </summary>
public static IGeoObject CreateRectAndMakePipe(Project project, double width, double height, double depth)
{
GeoPoint p0 = new GeoPoint(0, 0, 0);
GeoPoint p1 = new GeoPoint(width, 0, 0);
GeoPoint p2 = new GeoPoint(width, height, 0);
GeoPoint p3 = new GeoPoint(0, height, 0);
Line l0 = Line.Construct(); l0.StartPoint = p0; l0.EndPoint = p1;
Line l1 = Line.Construct(); l1.StartPoint = p1; l1.EndPoint = p2;
Line l2 = Line.Construct(); l2.StartPoint = p2; l2.EndPoint = p3;
Line l3 = Line.Construct(); l3.StartPoint = p3; l3.EndPoint = p0;
Path rectPath = Path.Construct();
rectPath.Add(l0);
rectPath.Add(l1);
rectPath.Add(l2);
rectPath.Add(l3);
Face profileFace = Make3D.MakeFace(rectPath, project);
Line axis = Line.Construct();
axis.StartPoint = new GeoPoint(0, 0, 0);
axis.EndPoint = new GeoPoint(0, 0, depth);
Path alongPath = Path.Construct();
alongPath.Add(axis);
IGeoObject swept = Make3D.MakePipe(profileFace, alongPath, project);
return swept;
}
}
Metadata
Metadata
Assignees
Labels
No labels