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
 Drawing Objects
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

nac

Romsey, Hampshire, U
5 Posts

Posted - 09/29/2000 :  8:50:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Can I create a LabTalk script to draw a circle centred on a given co-ordinate on a plot? I can draw a circle manually, but I want to automatically draw a circle, whose radius is dependent on the data.

Mike Buess

USA
3037 Posts

Posted - 09/29/2000 :  1:11:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You should be able use the draw command along with object properties to do this. I'll outline how I would go about it and you can consult your LabTalk help file for details ("draw" command and "User-created Visual Objects" topic).

First, use the Circle Tool to draw a circle in an empty plot window. Don't worry about its size or even if its a perfect circle, but you can edit its other properties (color, line width, etc.) if you wish. Then right click on the circle, select Object Control and give it a name if it doesn't already have one. (I'll just call it "circle".) Save it as an object file by opening the script window and entering the command:

draw -n circle -f save circle;

Open another plot window and retrieve the circle with the command:

draw -n circle -f read circle;

Use its object properties to position and size the circle. The following script line places the center of the circle at X=5 and Y=10 in axes units:

circle.x=5; circle.y=10;

The next line sets the diameter of the circle to 500 in layer units:

circle.width=500; circle.height=500;

I'm not sure off the top of my head how to convert from layer units to axes units, but there must be a way. You'll find several other object properties that can be changed with script commands.

-Mike

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/02/2000 :  3:47:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I forgot about the object.dx,dy properties. Yes, they should work nicely.

The only reason for saving the circle to an object file is that there is no way (that I know of) to create a circle from scratch with script commands. If you draw a circle and save it to file you can use it as often as you like.

-Mike

Go to Top of Page

nac

Romsey, Hampshire, U
5 Posts

Posted - 10/02/2000 :  8:58:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks. Out of interest, you can specify the object's width and height in axes units by using object.dx and object.dy.

I don't suppose you can do the same thing without the need of having the object saved to a file?

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