问题描述
我想在 FreeCAD 中创建一些点并在它们旁边显示它们的标签.我的最终目标是实现
如何对我自动创建的所有点执行相同操作?我的目标是在一些点旁边显示标签.最好有一个函数,它接受 x、y、z 和标签,并自动显示带有旁边标签的点.
一种临时解决方案是使用文本.如果 vertices
是一个元组列表 (xi, yi, zi)
那么:
for vertexNum, enumerate(vertices) 中的顶点:p=Draft.makePoint(顶点[0],顶点[1],顶点[2])p.Label=str(vertexNum)Draft.makeText([str(vertexNum)],point=FreeCAD.Vector(vertex[0],vertex[1],vertex[2]))
I want to create some points in FreeCAD and have their labels displayed next to them. My final goal is to implement this feature request I placed in OpenFOAM repo.
I tried creating some points in draft workbench and label them with:
App.newDocument("test")
Gui.activateWorkbench("DraftWorkbench")
import Draft
point00=Draft.makePoint(0.0,0.0,0.0)
point00.Label = "0"
point01=Draft.makePoint(1.0,0.0,0.0)
point01.Label = "1"
point03=Draft.makePoint(0.0,1.0,0.0)
point03.Label = "2"
Now from here if I add the code blow:
a=App.ActiveDocument.addObject("App::AnnotationLabel","Annotation")
a.LabelText=["0"]
it will label the first point:
How can I do the same for all of the points I create automatically? my goal is to have some points with labels shown next to them. preferably to have a function which takes x,y,z and label and show the point automatically with the label next to it.
One temporary solution is to use text. if vertices
is a list of tuples (xi, yi, zi)
then:
for vertexNum, vertex in enumerate(vertices):
p=Draft.makePoint(vertex[0],vertex[1],vertex[2])
p.Label=str(vertexNum)
Draft.makeText([str(vertexNum)],point=FreeCAD.Vector(vertex[0],vertex[1],vertex[2]))
这篇关于在 FreeCAD 中在它们旁边显示点标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!