Would there be interest for a Measurements Workbench?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Would there be interest for a Measurements Workbench?

Post by Zolko »

dprojects wrote: Sun Sep 25, 2022 7:43 pm Also I don't have support for angles because I don't see FreeCAD tool to measure angle from python.
you can do this to measure angles between 2 shapes :

Code: Select all

    def angleShapes( self, shape1, shape2 ):
        if shape1.isValid() and shape2.isValid():
            # get the direction of the shape
            dir1 = self.getDir(shape1)
            dir2 = self.getDir(shape2)
            if dir1 and dir2:
                angle = dir1.getAngle(dir2)*180./math.pi
...
and

Code: Select all

    # figure out the direction of a shape, be it a line, a surface or a circle
    def getDir( self, shape ):
        direction = None
        # for a segment, it's the normalized vector along the segment
        if self.isSegment(shape):
            line = shape
            pt1 = line.Vertexes[0].Point
            pt2 = line.Vertexes[1].Point
            vect = (pt2.sub(pt1))
            if vect.Length != 0:
                direction = vect / vect.Length
        # for another line (like Datum::Line) it's the Z vector multiplied by the Line's Placement
        elif self.isLine(shape):
            direction = shape.Placement.Rotation.multVec(App.Vector(0,0,1))
        # for a Circle it's the circle's axis
        elif self.isCircle(shape):
            direction = shape.Curve.Axis
        # for a flt face it's the normal
        elif self.isFlatFace(shape):
            direction = shape.normalAt(0,0)
        return direction
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Vincent B
Veteran
Posts: 4713
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Would there be interest for a Measurements Workbench?

Post by Vincent B »

@easyw-fc @Zolko
About caliper, could be useful to have an parametric measurement. With an option, values could be move inside End and Start x,y,z. When changing the edge, measurement will follow :?:
Attachments
Capture.JPG
Capture.JPG (65.76 KiB) Viewed 641 times
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Would there be interest for a Measurements Workbench?

Post by dprojects »

Zolko wrote: Wed Sep 28, 2022 6:37 pm you can do this to measure angles between 2 shapes :
yes, but how to draw it? currently I use "App::MeasureDistance" FreeCAD object for that, and I don't see similar thing for angle drawing ;-)
the "App::MeasureDistance" works with cut-list so you can create your own custom measurements list...

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: Would there be interest for a Measurements Workbench?

Post by mario52 »

Hi

have you try WorkFeatures ?

Image


mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
wandererfan
Veteran
Posts: 6267
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Would there be interest for a Measurements Workbench?

Post by wandererfan »

For your amusement...

Code: Select all

>>> import Measure
>>> m = Measure.Measurement()
>>> m.addReference3D("Box", "Edge1")
>>> m.length()
10.0
>>> m2 = Measure.Measurement()
>>> m2.addReference3D("Box", "Edge1")
>>> m2.addReference3D("Box", "Edge2")
>>> m2.angle()
90.0
>>> 
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Would there be interest for a Measurements Workbench?

Post by dprojects »

wandererfan wrote: Thu Sep 29, 2022 2:08 pm

Code: Select all

import Measure
m2 = Measure.Measurement()
m2.addReference3D("Box", "Edge1")
m2.addReference3D("Box", "Edge2")
m2.angle()
90.0
Yes, this is how I would like to calculate the angle in the future. But the biggest problem is to draw beautifly the angle ;-) I guess there is no function at FreeCAD for that? and this may not be easy, so this needs to create own function for draw the angle. So I postpone this feature for later. Also I have to make support for irregular non-rectangle shapes, what probably will take some time ;-)

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply