![]() ![]() setActiveDocument ( DOC_NAME ) DOC = FreeCAD. viewAxometric () if DOC is None : FreeCAD. SendMsgToActiveView ( "ViewFit" ) FreeCAD. Name ) def setview (): """Rearrange View.""" FreeCAD. activeDocument () DOC_NAME = "Wiki_Example" # Helpers methods def clear_doc (): """Clear activeDocument deleting all the objects.""" for obj in DOC. """filename.py First FreeCAD Script """ import FreeCAD from FreeCAD import Placement, Rotation, Vector DOC = FreeCAD. To make the things in a polite way, the file has to be written with some order, FreeCAD Python editor have a good "Syntax Highlighting" that lacks in many simple editors like Windows Notepad or some basic Linux editors, so it is sufficient to write these few lines: py extension in the internal Python editor, the most simple trick is create in your favorite text editor and then open it with the usual command File → Open. The first obstacle in an easy way to scripting is that there is no direct way to access the FreeCAD internal Python editor through a menu item or a icon on the toolbar area, but knowing that FreeCAD opens a file with a. Sadly information about scripting in the documentation, and even in this wiki are scattered around and lacks of "writing" uniformity and most of them are explained in a too technical manner. FreeCAD could be used as a "very good" replacement of OpenSCAD, mainly because it has a real Python interpreter, that means that it has a real programming language on board, almost everything you could do with the GUI, is doable with a Python Script. With Scripting we mean create topological objects using FreeCAD's Python interpreter. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |