#ImportGui.export(obj_lst, u"C:/Users/User/Downloads/freecad-samples/Unnamed-Solid. #options = ImportGui.exportOptions(u"C:/Users/User/Downloads/freecad-samples/Unnamed-Solid.step") # ImportGui.export(obj_lst, outputfilename, options) # options = ImportGui.exportOptions(outputfilename) # outputfilename = u"".format(OpenName.replace('.dxf','.step')) Gui.activeDocument().activeView().viewAxonometric() I chose arbitrary extrusion amount of 100 on z axis Obj_sel.addSelection(adoc_name,obj.Label)ĭraft.upgrade(obj_sel.getSelection(),delete=True) #importDXF.insert(u"C:/Users/User/Downloads/freecad-samples/viga.dxf",adoc_name) # - set document name to match dxf name without extension Path = u"C:/Users/User/Downloads/freecad-samples"Īpp.Console.PrintMessage("Process aborted - File not Found."+"\n")Īpp.Console.PrintMessage("Importing "+OpenName+"\n") This at least produces a unique export for each import file.script is below.įName = QFileDialog.getOpenFileName(None,omLocal8Bit("Read a file dxf"),path,"*.dxf") # PyQt4įName, Filter = (None, "Read a file txt", path,"*.dxf") #PySide My alternate approach was to change the name of the active document to match the import filename (minus the. I left the old code there but commented out so others could identify what did not work. If someone wants to pursue they can identify why the individual commands to export would not allow the export string to be modified away from 'standard'. It should also work as an independent macro. I currently have it leave the document open. It will open a dialog for the dxf input file. You can start with no file open and Run the below code by pasting it into the console. I could not get it to export if I tried changing the string associated with the export file directly. I expanded upon orginal post, but had to use an alternate export call.the commands detailed in the console were obviously not a complete picture of the 'behind-the scenes' processing. ImportGui.export(obj_lst, u"C:/Users/User/Downloads/freecad-samples/Unnamed-Solid.step", options) Options = ImportGui.exportOptions(u"C:/Users/User/Downloads/freecad-samples/Unnamed-Solid.step") # - run draft upgrade to convert selection to a face # - run draft upgrade to convert selection to a wireĭraft.upgrade((),delete=True) ImportDXF.insert(u"C:/Users/User/Downloads/freecad-samples/viga.dxf","Unnamed") The tutorial uses a 2D shape to create a 3D solid, the latter is accomplished through the Part Workbench. Code: Select all import FreeCADGui as Guiįrom FreeCAD import Placement, Rotation, Vector Introduction This tutorial aims to be used as a first introduction to the Draft Workbench in FreeCAD.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |