Cancel
Showing results for 
Search instead for 
Did you mean: 

Change model view (zoom)

Experimenter
Experimenter

Hi forum,

 

I am trying to make a method which changes the view (2D) of my model window based on the objects which I have selected. The model window should be such that all of the selected objects are visible in the window.

I have tried to use the functions .zoomFactor,.getXYWH and setXYWH. but without much success so far.

Therefor I am wondering if it is possible to make such a method and what functions are needed for it. Any ideas?

 

Kind regards,

 

Kaj

 

 

 

2 REPLIES

Re: Change model view (zoom)

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Kay,

 

example for one selected object (without zoom):

 

-- get size and position of selected object

line.getBoundingBox(x1,y1,w1,h1);

-- get size of frame

 getxywh(x,y,w,h);

-- set new size of frame

 setxywh(x,y,w1,h1);

-- scroll to position of selected object
 setxyorigin(x1,y1);

when the new size is too large you may set zoomfactor of the frame.

 

Kind regards

Karola

------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Change model view (zoom)

Experimenter
Experimenter

Hi Karola,

 

Thank you for your quick response. 

Been testing the code you sent to me.

Not working entirely yet for multiple object selection but tweaking it at the moment.

 

Kind regards,

Kaj