你好,弗利特,我无法帮助编程部分。我相信米克德可以引导你一路走到这一步。你是对的,我使用的手动方式没有保留管道。压印和爆炸只是一种快速的方法,可以将文本作为一个可以加厚的表面。但是压印文本只是一种粗糙的方式,我假设你想保持文本的比例,就像它沿着弯曲的实体覆盖一样。祝你一切顺利! 你好,巫师,你可以在文本上做双重切割,然后将文本合并成管道,而不是压印和挤压。Flyte,你现在有什么代码?我很乐意看一看,如果你能提供它和一个典型场景中的文本和管道设置的样本绘图。干杯。 感谢MickD.<br>So..将文本创建为一个实体(即:非文本/多行文本),我非常依赖此处(以及OP中)描述的SEANT解决方案:https://www.theswamp.org/index.php?topic=31435.0它工作得很完美,(我可能在其他地方找到了该代码的更新版本……但前提是一样的。)。因此,我有文本…和管道..,这使我找到了接受块引用实体的代码,该实体是转换为区域的文本),我想:
1.挤出文本区域
2.创建圆柱体,用于从文本区域中减去,以获得“环绕”效果
3.正确定位圆柱体和文本区域(此处需要帮助!)
以下是代码:
// FYI - the following are as held as member variables
// List> pipeProperties;
// private Point3d position;
// private Point3d centerOfPipe;
// private double extrudeHeight;
// private double outsideDiameter;
// private double wallThickness;
// private double pipeLength;
// private Vector3d pipeVector;
private void CreateEnt(Entity ent)
{
// Scale the text height...
Extents3d geometricExtents = ent.GeometricExtents;
Point3d point3d = new Point3d();
double mHeight = this.m_height;
Vector3d vectorTo = point3d.GetVectorTo(geometricExtents.MaxPoint);
double y = mHeight / vectorTo.Y;
ent.TransformBy(Matrix3d.Scaling(y, point3d));
using (Transaction tr = this.m_db.TransactionManager.StartTransaction())
{
try
{
BlockTableRecord btr = tr.GetObject(this.m_db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
ent.SetDatabaseDefaults();
// Extrude this region just beyond the thickness of the pipe...
var pSolid = new Solid3d { RecordHistory = true };
pSolid.Extrude(ent as Region, extrudeHeight, 0.0);
// Move this region to the center point of the pipe, and move it down so it is vertically center justified...
var centerJustPoint = new Point3d(centerOfPipe.X, centerOfPipe.Y, centerOfPipe.Z - (extrudeHeight / 4.0));
pSolid.TransformBy(Matrix3d.Displacement(centerJustPoint - Point3d.Origin));
// Now the text region is by default oriented so that the text is laying down flat. Hard code transform to be "vertical" so the
// text region is up.
// ** how do I figure out the proper orientation of the text region to match the orientation of the pipe...??
Matrix3d matrix = Matrix3d.Rotation(Math.PI / 2, Vector3d.XAxis, centerJustPoint);
pSolid.TransformBy(matrix);
// Add this solid to the model...
btr.AppendEntity(pSolid);
tr.AddNewlyCreatedDBObject(pSolid, true);
// Create the cylinder that will be subtracted from the text regoin, and move it to the center point of the pipe..
var cyl = new Solid3d { RecordHistory = true };
var radius = (outsideDiameter / 2.0);
cyl.CreateFrustum(pipeLength, radius, radius, radius);
cyl.TransformBy(Matrix3d.Displacement(centerOfPipe - Point3d.Origin));
// Now this cylinder and text region is simply using the default orientation. Manually hard code to orientate it, just like above,
// so that it matches the text orientation..
// ** obviouslly this is wrong and won't handle, for example, vertical pipes.. how do I align this and the text to the orientation
// of the pipe.
Matrix3d matrix2 = Matrix3d.Rotation(Math.PI / 2, Vector3d.YAxis, centerOfPipe);
cyl.TransformBy(matrix2);
// Lots of test code here to try to orientate / align the cylinder and text to the pipe... see previous post that describes the approaches
// that I attempted, but couldn't figure out...
btr.AppendEntity(cyl);
tr.AddNewlyCreatedDBObject(cyl, true);
// Subtract the cylinder from the text region..
pSolid.BooleanOperation(BooleanOperationType.BoolSubtract, cyl);
}
catch
{
this.m_isValid = false;
}
finally
{
tr.Commit();
}
}
}
现在,这段代码让我了解了我之前的屏幕截图。因此,如果管道是完全水平的……一切看起来都很好,它让我实现了您在最初答复中为我概述的策略。因此,我觉得繁重的工作已经完成。正是这个对齐问题阻碍了我。
我附上了一个显示管道的测试图纸,(这是一个Plant3D图纸……希望您能够打开它。) 这就是您使用WorldToPlane的地方,您通过将WCS向量乘以管道的ECS向量,将文本和新“切割”管道的世界坐标更改为平面坐标,这将一次转换和旋转文本。从空间中的管道创建一个平面,比如从其起点、ECS x和y向量开始,并在转换中使用该平面。ECS是一个Matrix3d,因此您需要访问它的CoordinateSystem3d属性来获取X和y。start point/*或pipeEcs,CoordinateSystem3d.Origin*/,pipeEcs。CoordinateSystem3d.Xaxis,pipeEcs。coordinate system3d . ya xis);。
mat = Matrix3d,WorldToPlane(飞机);//设置用于文本和切割管道的矩阵,以将它们移动(转换)到管道ECS。
您还可以使用PostMultiplyBy或PreMultiplyBy,直接使用ECS。这取决于ECS原点是否与管道起点对齐(很可能是这样),textCuttingSolid。post multiplyby(pipe . getecs());。
textSolidpost multiplyby(pipe . getecs());。
//从文本中减去切割实体,然后在现有管道实体上减去切割文本...。
您就快完成了p.s.我无法打开绘图,但我想了想,只需使用PostMultiplyBy示例,因为它节省了许多设置,标准的Solid3d没有像“管道”那样有意义的ECS,所以我必须做更多的工作,从我自己的自定义ECS创建一个平面,现在您需要的只是一个简单的方法,该方法采用要蚀刻的plant3d管道和一些文本,创建切割文本,并使用管道的ECS将文本与管道对齐来蚀刻管道。
MickD再次表示感谢。
所以使用管道的ECS圣
页:
1
[2]