Code: Select all
if p.Point == v.Point:
Code: Select all
obj = FreeCAD.ActiveDocument.addObject("Part::Feature","tempLine") obj.Shape = line
Hi,peepsalot wrote:Hello, I've been experimenting with some FreeCAD Python scripts to help with the task of analyzing 3D models such as imported meshes, and I thought I'd show them off here. I'm pretty new to the CAD world, but been programming for many years. I'm having a blast learning how all this works and everything that is possible with FreeCAD.
The following scripts will not work directly on a Mesh object, since individual edges and vertices of a mesh are not selectable.
If you want to measure a mesh (ex. imported STL) then you will need to convert it to a Part first by using the menu: "Part" -> "Create shape from mesh..."
Place any of the downloaded python files into your FreeCAD macros directory and execute it from FreeCAD.
Determine the radius and center of a circle by selecting any 3 points on the edge of it, with the calculation result displayed in the Report View. A line is also drawn from the first vertex to the center, which can then be used with FreeCAD's builtin "Measure Distance" tool if needed to determine the distance from the center to other features.
After executing this script, the next three vertices you select will be used to calculate dimensions of a corresponding arc or circle. Subsequent uses require executing the script again or instantiating the class in Python Console with "MeasureCircle()"
I just got this working and will probably make some changes to it in the future. I may eventually try to add a real toolbar icon to the gui to make invoking this tool a bit easier, just haven't gotten that far yet.
For measuring the angle between two edges. Usage is similar to MeasureCircle, just select the edges, and the result is printed in Report View.
Currently does not offer any visual indicator. I'm considering trying to display an arc and text label of the angle degrees(similar to the objects shown by the Measure Distance tool), but haven't figured that out yet.
These scripts are still a work in progress, and I will be adding to and updating these scripts as I go.
A macro directory is something that doesn't get installed. It's simply a directory By default it points to the directory %APPDATA%\FreeCAD. It's then up to you to put your macros there. The supported file extensions are .FCMacro and .py. Under Tools > Macros you can change your macro directory to something else.Hi,
I have a small problem, I have looked everywhere and I don't have a Macros folder in the FreeCAD directory, I have done a system wide search and cannot find it anywhere.
Shouldn't it have been installed when the progamme was installed?
Do I need to install it separately ?
I am running FreeCAD 0.12
I actually did something similar in the Draft module... Try drawing 2 lines, then select the dimension tool ,then ALT-select the 2 lines. I didn't use it a lot, though, so it might still be a little buggy, but it might give you some ideas.peepsalot wrote:Added a basic protractor script to the first post.