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 for Programming
 LabTalk Forum
 Several problems with graphical 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

asenv

35 Posts

Posted - 10/13/2010 :  08:00:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1G SR3
Operating System: Windows 2000 Pro

I have several problems with gobjects. On the picture below I want to get the lower gobject with labtalk commands.



1 I want to set the color of the gobject to transparent:
gobjectname.fillcolor =0;
or
gobjectname.fillcolor =color(none);


As you can see on the upper gobject it is actually set as transparent when I check this with the gui, but it shows as black. If I set it with the gui it works.

2 I want to remove (set to 0 width) the border/frame (Rahmen Tab) lines of the gobjects. The ones that are in red on the upper gobject.
I tried gobjectname.lineWidth=0; and gobjectname.lineType=0;, but I get this error: object property not found!

3 I want to set the fill pattern (which with the gui works).
I have done that for a layer with the set command like: set datasetname/worksheetname -pfp 1;. This did not work form for gobject, because gobject is other data type.

Regards,
Asen

rdremov

USA
28 Posts

Posted - 10/13/2010 :  4:52:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here is OC functin which should do the job:

void change_rect_fill(string strName = "Rect")
{
	GraphLayer gl = Project.ActiveLayer();
	GraphObject go = gl.GraphObjects(strName);
	
	Tree tr;
	tr.Root.Border.Width.dVal = 0;						// no border
	tr.Root.Fill.Color.nVal = INDEX_COLOR_TRANSPARENT;	// no fill color
	tr.Root.Fill.Pattern.Style.nVal = 3;				// sparse diagonal
	tr.Root.Fill.Pattern.Width.dVal = 1;				// pattern width
	tr.Root.Fill.Pattern.PatternColor.nVal = 0;			// black pattern color
	int err = go.UpdateThemeIDs(tr.Root, "Error", "Unknown tag");
	go.ApplyFormat(tr, true, true);
	
}

It is based on theme properties access.
Go to Top of Page

asenv

35 Posts

Posted - 10/14/2010 :  06:49:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, the function does its job prefectly well. Just for the other people that read the topic I will say that in labtalk I load the function with
run.LoadOC("path_to_*.c_file",2);

and execute the functions inside the *.c file just with writing the function name - somefunction;
Go to Top of Page

greg

USA
1379 Posts

Posted - 12/14/2010 :  10:20:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Watching the tree in debug revealed that -4 is the transparent color code. After a few tests, I found that this works:

rect.fillcolor = 2^32 - 4;

Most graphic objects have only limited LabTalk access, so use rdremov's code as an example of working around that problem.
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