如何在 FreeCAD 中为建筑创建拱门?
How to create an arch in FreeCAD for architecture?
我想在 FreeCAD 中创建一个拱门以用于建筑模块。在 OpenSCAD 中它看起来像这样:
来源:
rotate(270, v=[1,0,0]) {difference() {rotate_extrude(fn=500) {translate([750, 0, 0])square([400,400]);};
translate([-2000, 0, 0]) {cube([4000, 1500, 1500]);};
}};
使用 OpenSCAD 模块不是解决方案,因为我想使用网格捕捉功能并能够编辑拱门而无需从 OpenSCAD 源代码中删除和重新创建它(这在 FreeCAD 中显然是必需的)。
无法使用搜索引擎搜索解决方案,因为显然只显示了架构模块 (= Arch)。
可以通过
创建一个 arch 以供在架构模块中使用
- 在零件设计模式中创建表示拱面的草图
- 在 Arch 模式下用它制作一个结构
等效的 FreeCAD 脚本代码是:
import Part
import Sketcher
import Arch
App.newDocument("Unnamed")
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
Gui.activateWorkbench("PartDesignWorkbench")
App.activeDocument().addObject('Sketcher::SketchObject','Sketch')
App.activeDocument().Sketch.Placement = App.Placement(App.Vector(0.000000,0.000000,0.000000),App.Rotation(-0.707107,0.000000,0.000000,-0.707107))
#Gui.activeDocument().activeView().setCamera('#Inventor V2.1 ascii \n OrthographicCamera {\n viewportMapping ADJUST_CAMERA\n position 0 -87 0 \n orientation -1 0 0 4.712389\n nearDistance -112.88701\n farDistance 287.28702\n aspectRatio 1\n focalDistance 87\n height 143.52005\n\n}')
Gui.activeDocument().setEdit('Sketch')
App.ActiveDocument.Sketch.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000,-0.000000,0),App.Vector(0,0,1),200.000000),0.000000,3.141593))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',0,3,-1,1))
App.ActiveDocument.Sketch.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000,-0.000000,0),App.Vector(0,0,1),300.000000),0.000000,3.141593))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',1,3,-1,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('PointOnObject',1,2,-1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('PointOnObject',1,1,-1))
App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(-300.000000,-0.000000,0),App.Vector(-200.000000,-0.000000,0)))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,1,1,2))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,2,0,2))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',2))
App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(200.000000,-0.000000,0),App.Vector(300.000000,-0.000000,0)))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,1,0,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,2,1,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',3))
Gui.activeDocument().resetEdit()
App.ActiveDocument.recompute()
Gui.activateWorkbench("ArchWorkbench")
Gui.activeDocument().activeView().viewAxometric()
Arch.makeStructure(FreeCAD.ActiveDocument.Sketch)
FreeCAD.getDocument("Unnamed").getObject("Structure").Height = '100 mm'
Gui.SendMsgToActiveView("ViewFit")
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
我想在 FreeCAD 中创建一个拱门以用于建筑模块。在 OpenSCAD 中它看起来像这样:
来源:
rotate(270, v=[1,0,0]) {difference() {rotate_extrude(fn=500) {translate([750, 0, 0])square([400,400]);};
translate([-2000, 0, 0]) {cube([4000, 1500, 1500]);};
}};
使用 OpenSCAD 模块不是解决方案,因为我想使用网格捕捉功能并能够编辑拱门而无需从 OpenSCAD 源代码中删除和重新创建它(这在 FreeCAD 中显然是必需的)。
无法使用搜索引擎搜索解决方案,因为显然只显示了架构模块 (= Arch)。
可以通过
创建一个 arch 以供在架构模块中使用- 在零件设计模式中创建表示拱面的草图
- 在 Arch 模式下用它制作一个结构
等效的 FreeCAD 脚本代码是:
import Part
import Sketcher
import Arch
App.newDocument("Unnamed")
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
Gui.activateWorkbench("PartDesignWorkbench")
App.activeDocument().addObject('Sketcher::SketchObject','Sketch')
App.activeDocument().Sketch.Placement = App.Placement(App.Vector(0.000000,0.000000,0.000000),App.Rotation(-0.707107,0.000000,0.000000,-0.707107))
#Gui.activeDocument().activeView().setCamera('#Inventor V2.1 ascii \n OrthographicCamera {\n viewportMapping ADJUST_CAMERA\n position 0 -87 0 \n orientation -1 0 0 4.712389\n nearDistance -112.88701\n farDistance 287.28702\n aspectRatio 1\n focalDistance 87\n height 143.52005\n\n}')
Gui.activeDocument().setEdit('Sketch')
App.ActiveDocument.Sketch.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000,-0.000000,0),App.Vector(0,0,1),200.000000),0.000000,3.141593))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',0,3,-1,1))
App.ActiveDocument.Sketch.addGeometry(Part.ArcOfCircle(Part.Circle(App.Vector(0.000000,-0.000000,0),App.Vector(0,0,1),300.000000),0.000000,3.141593))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',1,3,-1,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('PointOnObject',1,2,-1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('PointOnObject',1,1,-1))
App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(-300.000000,-0.000000,0),App.Vector(-200.000000,-0.000000,0)))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,1,1,2))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',2,2,0,2))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',2))
App.ActiveDocument.Sketch.addGeometry(Part.Line(App.Vector(200.000000,-0.000000,0),App.Vector(300.000000,-0.000000,0)))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,1,0,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Coincident',3,2,1,1))
App.ActiveDocument.Sketch.addConstraint(Sketcher.Constraint('Horizontal',3))
Gui.activeDocument().resetEdit()
App.ActiveDocument.recompute()
Gui.activateWorkbench("ArchWorkbench")
Gui.activeDocument().activeView().viewAxometric()
Arch.makeStructure(FreeCAD.ActiveDocument.Sketch)
FreeCAD.getDocument("Unnamed").getObject("Structure").Height = '100 mm'
Gui.SendMsgToActiveView("ViewFit")
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")