我需要通过编程创建一个CAD模型。意思:用户为模型设置参数,应用程序输出一个(此处插入扩展名)文件,以便在SolidWorks / 3DStudio / Sketchup中使用。
应用程序通过改变半径生成shell(例如,一个管道),我希望可视化外部生成的shell,通常是在SolidWorks中。我想这有点像这个机器人的输出。
我不完全确定我需要的输出,我需要测试几个选项。所以我在找技术解决方案。一个好的输出文件将是一个具有恒定外部半径的管道,但是内部半径随Z变化(或者相反)。
在SolidWorks中,我会创建一个样条,并使用“旋转老板”将其挤压成一个形状。然后创建另一个样条并使用“旋转切割”移除中心,如这张图片(红色-管道的轮廓-外部半径)。绿色-内部半径的轮廓):

(这个例子是在一个管道上,但形状(交叉口)并不是真的有限,它们总是由几何形状组成。)
所以,我的问题是:
主要用途是与solidworks一起工作。我用的是C#,但什么都行。
对于这个模糊的问题,我很抱歉--我是CADing代码中的新手。
发布于 2014-11-16 19:04:40
最后我使用了Eyeshot。我尝试过的其他选择:
Eyeshot有一个非常简单的SDK,可以直接从C#中使用。文档很糟糕,我花了太多的时间试图找出它抛出的异常--但是它有很好的代码示例。一旦你知道了就没事了。不过有点贵。
我还在做SolidWorks出口的工作。Eyeshot支持STL、IGEN、OBJ和STEP - Solidworks都能很好地处理它们,但是表面并不光滑(圆不是圆圈,而是许多多边形)。就像我说的-还在工作。
无论如何,对于将来的参考-下面是一些代码示例,它们创建了一些类似的东西(外部半径是常数的,内部半径在变化)与我在这个问题中描述的一样(查看其中一个示例,比如乐高,了解如何使用WorkUnit):
public class CBuildOutput : WorkUnit
{
EntityList entities = new EntityList();
private void CreatePipe()
{
double outerRadius = 60;
// First decide on accuracy
double chordalError = 0.05;
int slices = Utility.NumberOfSegments(outerRadius, chordalError);
// Make a cylinder, the cut a hole from it
// 1. Cylinder
Solid cyl = Solid.CreateCylinder(outerRadius, 50, slices);
// 2. Define the hole curve
Curve innerCurve = new Curve(2, new List<Point3D>() {
new Point3D(outerRadius - 20, 0, 0),
new Point3D(outerRadius - 25, 0, 10),
new Point3D(outerRadius - 15, 0, 20),
new Point3D(outerRadius - 25, 0, 30),
new Point3D(outerRadius - 15, 0, 40),
new Point3D(outerRadius - 20, 0, 50)});
// 3. Create an extrude-able sketch
CompositeCurve holeSketch = new CompositeCurve(
new Line(Point3D.Origin, new Point3D(40, 0, 0)),
innerCurve,
new Line(40, 0, 50, 0, 0, 50));
// 4. Create a hole solid
Solid hole = Solid.Revolve(holeSketch, chordalError, 0, 2 * Math.PI, Vector3D.AxisZ, Point3D.Origin, slices, true);
// 5. Cut the hole from the cylinder
Solid[] final = Solid.Difference<Solid>(cyl, hole);
// entities.Add(cyl, 0, Color.Red);
// entities.Add(hole, 0, Color.Red);
entities.Add(final[0], 0, Color.Red);
}
protected override void DoWork(System.ComponentModel.BackgroundWorker worker, System.ComponentModel.DoWorkEventArgs doWorkEventArgs)
{
CreatePipe();
}
protected override void WorkCompleted(ViewportLayout viewportLayout)
{
viewportLayout.Entities = entities;
viewportLayout.ZoomFit();
// viewportLayout.WriteIGES("model.iges", false);
}
}https://stackoverflow.com/questions/26914493
复制相似问题