Preview plot - zoom to fit

More
12 Dec 2018 12:05 #122261 by workaholic
Hello,

Im searching and im not successful, I would like to have at preview plot a button which would fit the object in 3D preview or in X, Y, Z axis preview? So you dont need a mouse and zoom out / in everytime.

I haven't found any documentation how to edit preview plot for changing color, thickness or even more advanced programming - hacking.

Is this possible to be made at all?

Please Log in or Create an account to join the conversation.

More
13 Dec 2018 22:01 #122390 by workaholic
I would like to show how this would look like:



It has two additional buttons, which would:
First one with M in magnifying glass -> It means that Machine Area would fit to the screen of preview.
Second one with fit to zoom in magnifying glass -> It means that milling object would fit the screen.

Could anyone help me here?
I dont find any documentation about preview plot.
Attachments:

Please Log in or Create an account to join the conversation.

More
13 Dec 2018 23:27 - 13 Dec 2018 23:28 #122392 by cmorley
Replied by cmorley on topic Preview plot - zoom to fit
There is no documentation of the details of the plotting program.
It is possible to change colors by using a python handler file.
something like:
       HAL_GREMLIN_NAME.colors['overlay_background'] = (0.0, 0.0, 0.57)  # blue
       HAL_GREMLIN_NAME.colors['back'] = (0.0, 0.0, 0.75)  # blue
I agree a fit-to-screen function would be good but you also have to agree what fit-to-screen is. If you reload the screen it fits to screen, but it includes the limit box -so the plot looks small.

Anyways here is where to look at the code:
hal_gremlin sub classes gremlin
hal_gremlin is in lib/python/gladevcp
gremlin is in src/emc/usr_intf

gremlin imports lots of libraries but glnav and glcannon are the most interesting

lib/python/rs274/glcannon.py
lib/python/glnav.py

In glnav, the function: set_eyepoint_from_extents() is probably the zoom-to-fit code.

Chris M
Last edit: 13 Dec 2018 23:28 by cmorley.
The following user(s) said Thank You: workaholic

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 22:04 #125107 by Nico2017
Replied by Nico2017 on topic Preview plot - zoom to fit
Hi,
I actually have the reverse problem, I would like when opening a ngc file that the gremlin display does not zoom to fit and also does not affect the current rotation of the gremlin view. Any idea how to deactivate that too?

Thank you,

Nicolas

Please Log in or Create an account to join the conversation.

More
28 Jan 2019 23:32 #125121 by cmorley
Replied by cmorley on topic Preview plot - zoom to fit
Somewhat.
In Qtvcp there is this function:
    def reloadfile(self, w):
        dist = self.get_zoom_distance()
        try:
            self.load_program(None, self._reload_filename)
            self.set_zoom_distance(dist)
        except:
            print 'error', self._reload_filename
            pass

Probably the most full proof is change the function in gladevcp's hal_gremlin:
    def fileloaded(self,w,f):
        dist = self.get_zoom_distance()
        self._reload_filename=f
        try:
            self._load(f)
            self.set_zoom_distance(dist)
        except AttributeError,detail:
               #AttributeError: 'NoneType' object has no attribute 'gl_end'
            print 'hal_gremlin: continuing after',detail

There is probably a way to do rotation too - but i would have to dig in the code.

Chris M

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.190 seconds
Powered by Kunena Forum