If your geometry is defined with World Coordinate System (WCS) you need to define a new geometry for each one. The same air terminal geometry is replicated multiple time in each space. You often use a few types of air terminal in a project. IfcOpenShell version used : 0.6.0a1 Placement in IFC schemaĪ geometry generally has its own Local Coordinate System (LCS). In that matter I recommend you to read Dion Moult’s article IFC Coordinate Reference Systems and Revit and references cited in the article. When we read wikilab.ifc everything seemed to be at the right place but was it really ? When you use BIM in your project coordinates is always a subject to correctly discuss. If previous article we used IfcOpenShell’s (IOS) to read an ifc geometry and convert it to a brep. Then start your script from FreeCAD which freeze waiting for the debugger to start. Ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True)Īnd add a new debug configuration : Debug → Add Configurations… "configurations": [ # 5678 is the default attach port in the VS Code debug configurations You need ptvsd installed : pip install ptvsdĪdd a piece of code to your script : import ptvsd I described the process for Code – OSS at Visual Studio Code (VS Code) paragraph. To debug a script running from FreeCAD check Debugging wiki page. Debugging Embedding FreeCADĪs you embed FreeCAD in your own application you can use your usual debugger. As you modify you macro or workbench you can then use it in FreeCAD as usual. But for good reason or not it seems weird to me to use a webserver to communicate between 2 local applications. I saw on FreeCAD forum that some people are doing it using a webserver : Re: Remote editor possible ?, Animate – Server. Maybe with QProcess ? I saw multiple reference to this on Stackoverflow : Read output from python script in C++ Qt app, Communicating with QProcess Python program). The sad thing is that I don’t know yet how to interact with an already running application like you do with eg. Let’s replace the hello world label with the two lines from FreeCAD wiki and create a box : import FreeCADįrom PySide2.QtWidgets import QApplication Let’s take a very basic example of application with PySide2 on their website : import sysįrom PySide2.QtWidgets import QApplication, QLabel Use your script as a macro or as a full workbenchĪs explained on the wiki page FreeCAD can be embedded in another application sharing the host event loop.You might want to keep an eye on Vanuan freecad-python-stubs. Still unperfect but far better than before. Update: I have generated stubs with mypy stubgen. Shall we generate stubs like Gui Talarico did for Revit API or is there a better way ? Unfortunately auto-completion and linter do not work for everything eg. env file concept is explained in Code – OSS help : Environment variable definitions file. (Note that on windows you need to replace : by ) env file referencing FreeCAD lib folder and optionally your stubs folder :įREECAD_STUBS=/home//git/freecad-stubs/out Open your working folder in Code – OSS eg.To get better auto-completion you can also add reference to freecad-stubs folder below I cloned it in my home git folder with git clone. Examples below shows path for Arch/Manjaro with freecad-git installed. To allow auto-completion and your linter like pylint to work partially you need to reference FreeCAD libraries. I am very open to try another documented way if you have one to suggest ! Set up I’m not a big fan of M$ but Code – OSS is quite good and is the one I managed to set up with FreeCAD with a working debugger.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |