FreeCAD二次开发-Gui.Selection.getSelectionEx() 遍历选中的对象

import Part
Part.show(Part.makeBox(100,100,100))
Gui.SendMsgToActiveView("ViewFit")

length = 0.0
for o in Gui.Selection.getSelectionEx():
    for s in o.SubObjects:
        length += s.Length
print "Length of the selected edges:" ,length

Caesar卢尚宇
2020年3月31日

原文地址:https://www.cnblogs.com/nxopen2018/p/12609132.html

时间: 2024-09-28 11:22:44

FreeCAD二次开发-Gui.Selection.getSelectionEx() 遍历选中的对象的相关文章

FreeCAD二次开发-Part.makeCylinder创建圆柱

FreeCAD作为一款基于OpenCasCAD内核的开源CAD软件,可以在GitHub上下载源代码.阅读源代码,有助于我们学习CAD软件架构,了解底层几何算法. 由博主Caesar卢尚宇自学整理(纯粹出于对三维CAD软件开发的热爱) # 指定半径和高度b=Part.makeCylinder(20,50)# 显示对象 Part.show(b) 原文地址:https://www.cnblogs.com/nxopen2018/p/12555421.html

FreeCAD二次开发-PySide例子QtGui.QInputDialog弹出输入框

FreeCAD作为一款基于OpenCasCAD内核的开源CAD软件,可以在GitHub上下载源代码.阅读源代码,有助于我们学习CAD软件架构,了解底层几何算法. 由博主Caesar卢尚宇自学整理(纯粹出于对三维CAD软件开发的热爱) 内容出自FreeCAD官方社区https://wiki.freecadweb.org/PySide_Beginner_Examples from PySide import QtGui, QtCore reply = QtGui.QInputDialog.getTe

FreeCAD二次开发-Part.Face创建面

from FreeCAD import Base # 点坐标 V1 = Base.Vector(0,10,0) V2 = Base.Vector(30,10,0) V3 = Base.Vector(30,-10,0) V4 = Base.Vector(0,-10,0) VC1 = Base.Vector(-10,0,0) VC2 = Base.Vector(40,0,0) # 创建圆弧 C1 = Part.Arc(V1,VC1,V4) C2 = Part.Arc(V2,VC2,V3) # 创建直

FreeCAD二次开发-Part.LineSegment创建直线

from FreeCAD import Base # 点坐标 V1 = Base.Vector(0,10,0) V2 = Base.Vector(30,10,0) V3 = Base.Vector(30,-10,0) V4 = Base.Vector(0,-10,0) VC1 = Base.Vector(-10,0,0) VC2 = Base.Vector(40,0,0) # 创建圆弧 C1 = Part.Arc(V1,VC1,V4) C2 = Part.Arc(V2,VC2,V3) # 创建直

FreeCAD二次开发-face.extrude创建拉伸

from FreeCAD import Base # 点坐标 V1 = Base.Vector(0,10,0) V2 = Base.Vector(30,10,0) V3 = Base.Vector(30,-10,0) V4 = Base.Vector(0,-10,0) VC1 = Base.Vector(-10,0,0) VC2 = Base.Vector(40,0,0) # 创建圆弧 C1 = Part.Arc(V1,VC1,V4) C2 = Part.Arc(V2,VC2,V3) # 创建直

FreeCAD二次开发-Part.Shape合并几何元素,生成拓扑形状

from FreeCAD import Base # 点坐标 V1 = Base.Vector(0,10,0) V2 = Base.Vector(30,10,0) V3 = Base.Vector(30,-10,0) V4 = Base.Vector(0,-10,0) VC1 = Base.Vector(-10,0,0) VC2 = Base.Vector(40,0,0) # 创建圆弧 C1 = Part.Arc(V1,VC1,V4) C2 = Part.Arc(V2,VC2,V3) # 创建直

FreeCAD二次开发-Part.Arc创建圆弧

from FreeCAD import Base # 点坐标 V1 = Base.Vector(0,10,0) V2 = Base.Vector(30,10,0) V3 = Base.Vector(30,-10,0) V4 = Base.Vector(0,-10,0) VC1 = Base.Vector(-10,0,0) VC2 = Base.Vector(40,0,0) # 创建圆弧 C1 = Part.Arc(V1,VC1,V4) C2 = Part.Arc(V2,VC2,V3) # 创建直

NX二次开发-UFUN按类型遍历名字获取Tag函数UF_OBJ_cycle_by_name_and_type

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 9 UF_initialize(); 10 11 //新建工程图(A4图纸) 12 char* DrawingName = "Sheet1";//设置图纸名字 13 UF_DRAW_info_t DrawingInfo;//设置图纸

AM二次开发中选择指定范围内的对象

使用Spatial可以快速选择指定范围内的对象 例如下面的代码可以选择所有在[0,0,0]-[10m,10m,10m]这个盒子之内的对象: 其中ElementsInBox还可以指定对象类型做进一步筛选. LimitsBox box = LimitsBox.Create(Position.Create(0, 0, 0), Position.Create(10000.0f, 10000.0f, 10000.0f)); DbElement[] eles = Spatial.Instance.Eleme