Page 1 of 1

Distance tool prints to report view, how is this queried with python?

Posted: Sat Jun 25, 2022 12:50 pm
by llll
Only used measure a few times. It seems that in 0.20 there is no distance object appearing in tree, with properties. Rather: it prints to report view.

How to access distance variable shown here with python?
FreeCAD_sqFlXKZiRh.png
FreeCAD_sqFlXKZiRh.png (13.46 KiB) Viewed 543 times
Thanks in advance

Re: Distance tool prints to report view, how is this queried with python?

Posted: Sun Jun 26, 2022 1:48 am
by llll

Re: Distance tool prints to report view, how is this queried with python?

Posted: Sun Jun 26, 2022 8:47 am
by vm4dim
In FreeCAD is three Measure systems

App::MeasureDistance
This draws white line, object is saved in Tree and have access from Python.
Call from: MainMenu > Tools > Measure Distance

Part_Measure
This draws colored lines, object is NOT saved in Tree and NOT have access from Python. It prints in the report view.
Call from: MainMenu > Measure ( If Part WB is active )

Measure.Measurement()
Call from Python. It not draw

Re: Distance tool prints to report view, how is this queried with python?

Posted: Sun Jun 26, 2022 10:30 am
by llll
vm4dim wrote: Sun Jun 26, 2022 8:47 am In FreeCAD is three Measure systems
Measure.Measurement()
where does one read up on Measurement() methods?

Part_Measure was going to use this for its orthogonal measure... If any GUI experts reading, how to save the report view as text, with python

App::MeasureDistance this doesn't have orthogonality it seems, but I'll try make a FPO to use it... :/

How do I make a FPO which allows user to select two points in GUI?

Code: Select all

def create(obj_name):
    obj = App.ActiveDocument.addObject('App::MeasureDistance', obj_name)      #  Creates a new FreeCAD FeaturePython 
    measure(obj)            
    return obj             
    
class measure():
    def __init__(self, obj):      
        self.Type = 'measure'          
        obj.Proxy = self           
     def execute(v1,v2):
        v1 = Gui.userinput
        v2 = Gui.userinput

Re: Distance tool prints to report view, how is this queried with python?

Posted: Sun Jun 26, 2022 11:22 am
by vm4dim
llll wrote: Sun Jun 26, 2022 10:30 am Measure.Measurement()
where does one read up on Measurement() methods?
In Source Code
https://github.com/FreeCAD/FreeCAD/blob ... asure/App/ Measurement.cpp