Search found 62 matches

by Zoltan
Thu Jun 30, 2022 5:43 am
Forum: Python scripting and macros
Topic: Unit mismatch error in FreeCAD 0.20
Replies: 6
Views: 1201

Re: Unit mismatch error in FreeCAD 0.20

I made some detective work and I think I found the source of the problem. Here are the steps I went through, hopefully it will be useful for others when encountering issues with FreeCAD. Simplify the problem Thanks to onekk , I know exactly which part of the expression causes the error. So I came up...
by Zoltan
Wed Jun 29, 2022 6:54 pm
Forum: Python scripting and macros
Topic: Unit mismatch error in FreeCAD 0.20
Replies: 6
Views: 1201

Re: Unit mismatch error in FreeCAD 0.20

You will easily see that P1.X will return units, and 10 has no units in your code, in my test code it will print correctly But probably expression should allow "unitless" operators? Thank you, Carlo! You found the error. Here is the summary: Additive operators ( + and - ) require consiste...
by Zoltan
Wed Jun 29, 2022 5:48 pm
Forum: Python scripting and macros
Topic: Unit mismatch error in FreeCAD 0.20
Replies: 6
Views: 1201

Re: Unit mismatch error in FreeCAD 0.20

import math >>> P1.Y 2.875 mm >>> math.sqrt(P1.Y) 1.695582495781317 >>> math.sqrt(P1.Y)+P1.Y Traceback (most recent call last): File "<input>", line 1, in <module> ArithmeticError: Quantity::operator +(): Unit mismatch in plus operation >>> This is indeed the problem. Your code worked in ...
by Zoltan
Wed Jun 29, 2022 3:56 pm
Forum: Python scripting and macros
Topic: Unit mismatch error in FreeCAD 0.20
Replies: 6
Views: 1201

Unit mismatch error in FreeCAD 0.20

Hello, I encountered a strange error in FreeCAD 0.20. Assume that you have four points (Draft.Point objects), labelled as P1, P2, P3 and P4, with units in mm. I have an expression in the form of a Python string to evaluate, let us call it expression . To evaluate this expression, we can use P1.evalE...
by Zoltan
Fri Jun 24, 2022 10:54 am
Forum: Python scripting and macros
Topic: Accessing PythonOCC in FreeCAD 0.20
Replies: 9
Views: 1273

Re: Accessing PythonOCC in FreeCAD 0.20

onekk wrote: Fri Jun 24, 2022 10:26 am This could not be achieved using Geom2D things:

https://forum.freecadweb.org/viewtopic.php?f=22&t=65844
OK, I will look into it soon.
by Zoltan
Fri Jun 24, 2022 10:49 am
Forum: Python scripting and macros
Topic: Accessing PythonOCC in FreeCAD 0.20
Replies: 9
Views: 1273

Re: Accessing PythonOCC in FreeCAD 0.20

I am not against making a feature request, but this is Python code. On the other hand, this basic functionality (projection) fits to the Part module, which is coded in C++, with which I have no familiarity.
by Zoltan
Fri Jun 24, 2022 10:08 am
Forum: Python scripting and macros
Topic: Accessing PythonOCC in FreeCAD 0.20
Replies: 9
Views: 1273

Re: Accessing PythonOCC in FreeCAD 0.20

What functionality do you need from pythocc. Maybe you can make a feature request so Freecad-developers can add this functionality. I use it in the following code for my most important project: from OCC.Core.BRepProj import BRepProj_Projection from OCC.Core.gp import gp_Dir def project(curve, surfa...
by Zoltan
Thu Jun 23, 2022 7:58 pm
Forum: Python scripting and macros
Topic: Accessing PythonOCC in FreeCAD 0.20
Replies: 9
Views: 1273

Re: Accessing PythonOCC in FreeCAD 0.20

Gift wrote: Thu Jun 23, 2022 6:44 pm You need the conda build
Thank you, but that AppImage does not contain PythonOCC either. Same import error. The packages.txt file in the root of the extracted AppImage also lacks the OCC package.
by Zoltan
Thu Jun 23, 2022 6:11 pm
Forum: Python scripting and macros
Topic: Accessing PythonOCC in FreeCAD 0.20
Replies: 9
Views: 1273

Accessing PythonOCC in FreeCAD 0.20

My script relies on PythonOCC. Now, import OCC does not work any more in version 0.20 and the (currently) latest weekly build either. On the other hand, the Part.__toPythonOCC__ and Part.__toPythonOCC__ functions are still present. Note that __toPythonOCC__ throws the following error when a Part.Sha...
by Zoltan
Sun Jun 19, 2022 1:39 pm
Forum: Announcements & Features
Topic: New Raytracing Workbench: POV-Ray-Rendering
Replies: 76
Views: 55114

Re: New Raytracing Workbench: POV-Ray-Rendering

I attached a small macro (and a rudimentary icon for it) that places all selected lights (indeed all selected objects) to the camera. If you find any bugs, please tell me :) Hello, I like the icon. I tested your macro with different selection scenarios. It works well, however, your approach is intr...