The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Labtalk: How to Draw Rectangle on Plot Layer
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jdarland

Portland, OR, USA
4 Posts

Posted - 01/07/1999 :  6:41:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have been trying to figure out a way draw a filled rectangle on a contour plot through Labtalk. I have the X,Y coords of the boundary. Ideally, I would like to fill the region in with a specific color.

The closest thing that I could find in the Labtalk manual was the dotool command. It is easy to select the rectangle tool, but I couldn't figure out a way to perform the "click-and-drag" programmatically.

Unfortunately, the size of the rectangle will vary from plot to plot, and as the axes are rescaled, which appears to prevent me from creating a graphic object and just reloading every time I generate a graph.

Any help would be greatly appreciated.

greg

USA
1379 Posts

Posted - 01/08/1999 :  1:38:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can not programmatically create rectangles using LabTalkTM.

You should create a Plot Template with one or more named samples of the kind of rectangle you need stored off the white of the page or set to invisible. You could then manipulate these objects through script. You must design these objects with pre-set Line type and Line Width and check Color, Pattern or Hollow because you will only be able to change the Border Color and the Fill Color.

Suppose I had such a rectangle named RECT1 which I stored as hidden. I could then run a script like:


RECT1.DX=.5;
RECT1.DY=1;
RECT1.X=5.75;
RECT1.Y=2.5;
RECT1.COLOR=4;
RECT1.FILLCOLOR=7;
RECT1.SHOW=1;

which would size and then position the rectangle in units of the X and Y scale, set the border to Blue (fourth in the color list), the fill color to Yellow (assuming the Color radiobutton for RECT1 is checked) and then unhide it.

Note that a rectangle's position is defined in terms of its center and the edges are at XDX/2 and YDY/2.

[This message has been edited by Greg (edited 01-08-99).]

Go to Top of Page

jdarland

Portland, OR, USA
4 Posts

Posted - 01/08/1999 :  5:46:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Greg,

This helped quite a bit.

I had two follow up questions.

First, how would I go about (or is it possible to) overlay objects in a particlar order. (The equivalent of send back/bring forward). Objects appear to be added in back of objects that already exist on the window. I can add objects in a specific order to allow for some of the overlay consideration, but how would I change this on the fly programmatically? For example Rect1 overlays Rect2 in some instances, but how would I change this so that Rect2 overlays Rect1.

Second, I was unable to find reference to the method suggested by you for moving/resizing a rectangle in any of the Origin manuals/help files. This is probably because I am not looking in the correct place. Could you refer me to the appropriate location in the manuals for these types of operations.

Thanks again,
jeff

Go to Top of Page

greg

USA
1379 Posts

Posted - 01/12/1999 :  3:18:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The Annotation tools (like Text, Arrows, Ellipses, etc.) were not designed with programming in mind, so you can't change object drawing order without the user making a selection and then using the Object Edit Toolbar to move the selected object to the Front or Back.


The Object Reference section of the LabTalkTM Manual contains a list of generic properties for Visual Objects created with the Toolbox Tools. Because the list is generic, some properties don't apply to every object. An Ellipse does not have text so the Text property is ignored. Similarly, the FillColor property is ignored by Text objects. Learn how to name these objects by searching the Help file for Object:naming.

[This message has been edited by Greg (edited 01-12-99).]

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000