GraphFunction Features

hi all,

i don't know if i'm being dense but i'm having difficulty using GraphFunctions. Maybe i'm misunderstanding but i thought that GraphFunction features can be used to create various other feature types within one GraphFunction feature. I'm used to using eg BsplineCurve.ByFunction to create a curve based on points created solely within the ByFunction script, but i'm trying to use one GraphFunction to draw a line, perform a calculation, employ a conditional and draw some circles etc which will be packaged up in a user feature later.

So to start off with i've been experimenting using the code below in a GraphFunction Feature; 

function (double x, double y)
{
x = 100;
y = x;
Point myPoint = new Point();
myPoint.ByCartesianCoordinates(baseCS,x,y);
return myPoint;
}
 
graphFunction01 shows up on my symbolic diagram, but no points are returned. None of the published examples i've tried have worked for me, and they've all focussed on editing the transaction file, which is still a bit advanced for me.

Thanks in advance for your help. j  

Parents
  • I think GraphFunction must be used in other features' ByFunction Function property.  

    For your case, you may write a function and assign it to BSplineCurve.ByFunction. In the function, it must return a BSplineCurve, but free to make up points in your intention.

  • Hi all,

    thanks for your help Xun. i reread the help files and did a little experimenting. i thought i'd upload the sketch i made as reasource for others to refer to.

    I've used a GraphFunction to perform a calculation and return a double, and i've also set up another function to draw a line and a cricle when applied to a spline/curve. maybe these examples will be useful to somebody. (I have used mixed feature types within the GraphFunction, i don't know if that's poor practice or not...)

    thanks.

     

    110114-JRB-GraphFunctions.gct
  • sort of like a class, but I think a class would be overkill, something like a struct, or even like a vba type

    Type Stickman

       Circle CircleThatRepresentsTheHead

       Line LineThatRepresentsTheRightLeg

       int numberOfEyes

    End Type

    that'd be simple, easy to do, and wouldn't violate anything that is already in existence.

  • Sure..... but wouldn't something like the Schemas be needed for persistence / storing Stickman?

    Even if the properties were exported to Excel, there would need to have some mechanism to ensure the integrity of any 'associative' relationships between the Excel cells?

    If not, then Stickman would only exist at runtime and can't really interact with other stickmen unless they were part of or includes of the original script?Would be good if other users can write other scripts that can interact with Stickman, without having to get into Stickman's innards.

    Also, I  remember reading something about Struct's being a problem for .Net interops. Its not a blittable format, and will be subject to marshalling / garbage collection overheads.

    Not very scalable..... if true.

  • So far in GC everything is strong-typed. So, stickman either needs to have a GFT type associated with it or Nothing. We yet don't have things like querying feature for what it has.

  • I'd be happy enough with using a vb style type. these could be declared a bit like the way enums are supposed to be declared (although I've never managed to get an enum to work!)

    that way you could say somewhere near the beginning of the file:

    Type Stickman

      Circle CircleThatRepresentsTheHead

      Line LineThatRepresentsTheRightLeg

      int numberOfEyes

    End Type

    and then later you could say (in brutally dirty pseudocode):

    function makeMermaid(){

     Stickman myMermaid = new Stickman();

     myMermaid.rightLeg=myMermaid.leftLeg;

     return myMermaid;

    }

Reply
  • I'd be happy enough with using a vb style type. these could be declared a bit like the way enums are supposed to be declared (although I've never managed to get an enum to work!)

    that way you could say somewhere near the beginning of the file:

    Type Stickman

      Circle CircleThatRepresentsTheHead

      Line LineThatRepresentsTheRightLeg

      int numberOfEyes

    End Type

    and then later you could say (in brutally dirty pseudocode):

    function makeMermaid(){

     Stickman myMermaid = new Stickman();

     myMermaid.rightLeg=myMermaid.leftLeg;

     return myMermaid;

    }

Children
No Data