当前位置: 首页>>代码示例>>Python>>正文


Python OpenSCADUtils.callopenscadstring方法代码示例

本文整理汇总了Python中OpenSCADUtils.callopenscadstring方法的典型用法代码示例。如果您正苦于以下问题:Python OpenSCADUtils.callopenscadstring方法的具体用法?Python OpenSCADUtils.callopenscadstring怎么用?Python OpenSCADUtils.callopenscadstring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSCADUtils的用法示例。


在下文中一共展示了OpenSCADUtils.callopenscadstring方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addelement

# 需要导入模块: import OpenSCADUtils [as 别名]
# 或者: from OpenSCADUtils import callopenscadstring [as 别名]
 def addelement(self):
     scadstr=unicode(self.form.textEdit.toPlainText())
     asmesh=self.form.checkboxmesh.checkState()
     import OpenSCADUtils, os
     extension= 'stl' if asmesh else 'csg'
     tmpfilename=OpenSCADUtils.callopenscadstring(scadstr,extension)
     if tmpfilename:
         doc=FreeCAD.activeDocument() or FreeCAD.newDocument()
         if asmesh:
             import Mesh
             Mesh.insert(tmpfilename,doc.Name)
         else:
             import importCSG
             importCSG.insert(tmpfilename,doc.Name)
         os.unlink(tmpfilename)
     else:
         FreeCAD.Console.PrintError(unicode(translate('OpenSCAD','Running OpenSCAD failed'))+u'\n')
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:19,代码来源:OpenSCADCommands.py

示例2: addelement

# 需要导入模块: import OpenSCADUtils [as 别名]
# 或者: from OpenSCADUtils import callopenscadstring [as 别名]
    def addelement(self):
        scadstr=unicode(self.form.textEdit.toPlainText()).encode('utf8')
        asmesh=self.form.checkboxmesh.checkState()
        import OpenSCADUtils, os
        extension= 'stl' if asmesh else 'csg'
        try:
            tmpfilename=OpenSCADUtils.callopenscadstring(scadstr,extension)
            doc=FreeCAD.activeDocument() or FreeCAD.newDocument()
            if asmesh:
                import Mesh
                Mesh.insert(tmpfilename,doc.Name)
            else:
                import importCSG
                importCSG.insert(tmpfilename,doc.Name)
            try:
                os.unlink(tmpfilename)
            except OSError:
                pass

        except OpenSCADUtils.OpenSCADError, e:
            FreeCAD.Console.PrintError(e.value)
开发者ID:andrewjrobinson,项目名称:FreeCAD_sf_master,代码行数:23,代码来源:OpenSCADCommands.py

示例3: openscadmesh

# 需要导入模块: import OpenSCADUtils [as 别名]
# 或者: from OpenSCADUtils import callopenscadstring [as 别名]
def openscadmesh(doc,scadstr,objname):
    import Part,Mesh,os,OpenSCADUtils
    tmpfilename=OpenSCADUtils.callopenscadstring(scadstr,'stl')
    if tmpfilename:
        #mesh1 = doc.getObject(objname) #reuse imported object
        Mesh.insert(tmpfilename)
        os.unlink(tmpfilename)
        mesh1=doc.getObject(objname) #blog
        mesh1.ViewObject.hide()
        sh=Part.Shape()
        sh.makeShapeFromMesh(mesh1.Mesh.Topology,0.1)
        solid = Part.Solid(sh)
        obj=doc.addObject("Part::FeaturePython",objname)
        ImportObject(obj,mesh1) #This object is not mutable from the GUI
        ViewProviderTree(obj.ViewObject)
        solid=solid.removeSplitter()
        if solid.Volume < 0:
            solid.complement()
        obj.Shape=solid#.removeSplitter()
        return obj
    else:
        print scadstr
开发者ID:MarcusWolschon,项目名称:FreeCAD_sf_master,代码行数:24,代码来源:prototype.py


注:本文中的OpenSCADUtils.callopenscadstring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。