Page 1 of 1
Graphics and Contours
Posted: Sat Jan 30, 2016 2:18 am
by MaynardC
Is there any example code to get off the ground drawing on the Tool Path window. I can see the methods from the Global Funct's drop down, but not there parameters or how they're meant to be used. Nothing fancy, just the basics to get me going.
Maynard
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 2:22 am
by Ya-Nvr-No
this is a quick way ran in the Script fold to pull up the system folders that lets you select a dxf file
Note: not all of them display properly but most autocad and gearotic dxf are fine.
d=Contours();
filename=" ";
d.LoadDXF(filename);
d.DrawAll( true);
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 2:42 am
by Ya-Nvr-No
Here is a library/function I created to create a circle with colored cross lines
Code: Select all
// Library Patterns
// Created Monday, January 25, 2016
// Author Ya-Nvr-No
//-- Do not edit above this line
// Enter Global vars below this line.
// the librarian no matter where they are, but its easier
// to find and edit them in one spot.
// myGlobals Header:
aPattern = Graphics("Main_TOOL_0");
aPattern.SetNorm(Vec3(0,0,1));
aPattern.DrawMode(1);
aPattern.MoveTo( Vector3(xc,yc,zc));
aPattern.Refresh();
//
global CirclePat = function(xc,yc,zc,dia)
{
l=2;
aPattern.SetNorm(Vec3(0,0,1));
aPattern.DrawColor( COLOR.Blue );
aPattern.MoveTo( Vector3(xc-l,yc,zc));
aPattern.LineTo( Vector3(xc+l,yc,zc));
aPattern.Refresh();
aPattern.DrawColor( COLOR.Red );
aPattern.MoveTo( Vector3(xc,yc+l,zc));
aPattern.LineTo( Vector3(xc,yc-l,zc));
aPattern.Refresh();
aPattern.DrawColor( COLOR.Yellow );
aPattern.CircleAt( Vec3( xc,yc,zc), dia);
aPattern.Refresh();
aPattern.MoveTo( Vector3(xc,yc,zc));
aPattern.Refresh();
};
//CirclePat(0,100,0,10);
Update: I forgot the header that I have in myGlobals Library.
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 4:09 am
by MaynardC
Thanks Ya-Nvr-No
I had mostly been using the debugger to run code, but the script window is great trying to explore the api. How does Contour api relate to the Graphics api? Also, is there a way to change the origin from the center, say to the upper left in the "aPattern" window?
edit: figured out the origin shifting...
aPattern.SetExtents(Vector3(-5,-5,0),Vector3(40,40,0));
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 4:21 am
by ArtF
Hi Maynard:
Ill do a video soon on this.. But
Contours is a class designed to have tool paths drawn into it. It has no regard for
line widths and doesn't really care about colors, though you can set them. It is a class
of an infinite number of poly lines. These are called profiles. A profile can have any number
of points and can be set to Open or Closed. A profile with 2 points, and open, is a line
then. I haven't added line, arc or circle primitive adding yet, just points and DXF's.
Later on, I will add classes so one can automatically follow these paths. You can
also scale and transpose this class. Its planned that you can do this for all profiles
individually if one likes, but its global at the moment with calls to .ScaleTo(10,10,10) for example
will scale the entire contour to a max of 10,10,10 , respecting perspective.
.MoveTo(x,y,z) will move the entire drawing by the amount indicated .
The drawing with a tool path object instead of a contour is for drawing reference lines and such
on a screen. Its a separate function to each tool path window where Contours is a single global
object in the program. The "ToolPath" drawing routines can also be saved as G code as they are
built of objects like G code, arcs and lines. A MoveTo turns into a rapid, while FeedTo makes a
feedrate move in a GCode saved file from a script. Ill do a video when I think its done to the point it
wont change, int he meantime the examples by YaNvrNo show pretty well how to use them.
All of this is functional, and incomplete. It will be completed as I get to making wizards
soon for other Gearotic Users. Auggie is planned to be functional even in the context of
not being a motor controller, but Im aways from there as yet. Just adding a hotkey control
system now.
Onwards.. :)
Art
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 4:22 am
by Ya-Nvr-No
Not sure if you seen how i used the circle routine in a call up for a pattern
https://www.youtube.com/watch?v=FhC2MN7Sprk
Re: Graphics and Contours
Posted: Sat Jan 30, 2016 5:03 am
by MaynardC
Ya-Nvr-No
I hadn't seen the video. Good example.
Art,
Thanks for the explanation.
Plenty to get me started