How-to determine global coordinates of a circle or arc?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
ppemawm
Veteran
Posts: 1090
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

Re: How-to determine global coordinates of a circle or arc?

Post by ppemawm »

sgrogan wrote:Right Click on Report view > Options > Activate Logging. Gui selections are written to Report view
Thanks for the tip. Copy/Paste works great for vertices!
I'm happy.
"It is a poor workman who blames his tools..." ;)
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: How-to determine global coordinates of a circle or arc?

Post by triplus »

sgrogan wrote:Right Click on Report view > Options > Activate Logging. Gui selections are written to Report view
Therefore built in selection observer! The only drawback i see is a lot of other informations gets through this way not only selection stuff. Out of curiosity i looked in the code and this i guess could be reused to get Selected message to the status bar. That is to have the following behaviour:
  • Preselected: 3s (or slightly increased value)
  • Selected: always on or lets say 30s (that is until mouse moves and preselected message is available again).
Would it make sense to explore this further? As copy/paste wouldn't work i am not sure if it makes sense or not.
User avatar
ppemawm
Veteran
Posts: 1090
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

Re: How-to determine global coordinates of a circle or arc?

Post by ppemawm »

triplus wrote:Would it make sense to explore this further? As copy/paste wouldn't work i am not sure if it makes sense or not.
I vote no if copy/paste is not functional.
"It is a poor workman who blames his tools..." ;)
triplus
Veteran
Posts: 9472
Joined: Mon Dec 12, 2011 4:45 pm

Re: How-to determine global coordinates of a circle or arc?

Post by triplus »

ppemawm wrote:
triplus wrote:Would it make sense to explore this further? As copy/paste wouldn't work i am not sure if it makes sense or not.
I vote no if copy/paste is not functional.
Actually i tested this and it works good. Therefore i will go for it. It adds additional feature currently not existing and everything else works the same. That is Selected message is added on selection to status bar and it doesn't have a time limit.

As for the method you currently use i don't know how old is your build but latest master if Release build is made it won't work any more:

https://github.com/FreeCAD/FreeCAD/comm ... ef82bbd773

The message will get printed in Report view only if you use debug build.
User avatar
ppemawm
Veteran
Posts: 1090
Joined: Fri May 17, 2013 3:54 pm
Location: Manhattan New York

Re: How-to determine global coordinates of a circle or arc? [SOLVED]

Post by ppemawm »

triplus wrote:Selected message is added on selection to status bar and it doesn't have a time limit.
Thanks again. I consider this solved.
"It is a poor workman who blames his tools..." ;)
mario52
Veteran
Posts: 4542
Joined: Wed May 16, 2012 2:13 pm

Re: How-to determine global coordinates of a circle or arc?

Post by mario52 »

hi
yes triplus copy/paste Function_resident_with_the_mouse_click_action for not reinvent the world (right is easy)

i have modified the macro for use with button :

1: run the macro
2: select your object
.... the Observer is removed
3: copy/paste the infos in the report view

enjoy

Code: Select all

# -*- coding: utf-8 -*-
class SelObserver:
    def addSelection(self,doc,obj,sub,pnt):  # Selection
        print doc    # document
        print obj    # object
        print sub    # sub object
        print "Coordinates point mouse     : ",pnt    # coordinate point mouse
        try:     # triplus code
            coor = Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.Center
            print "Coordinates center circle X : ",coor.x
            print "Coordinates center circle Y : ",coor.y
            print "Coordinates center circle Z : ",coor.z
            print "Radius circle               : ",Gui.Selection.getSelectionEx()[0].SubObjects[0].Curve.Radius
        except Exception:
            None
        print "_____________________"
        FreeCADGui.Selection.removeObserver(s)    # desinstalle la fonction residente
s=SelObserver()
FreeCADGui.Selection.addObserver(s)               # installe la fonction en mode resident

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.
Post Reply