Loading ...
Sorry, an error occurred while loading the content.

Path2 Help

Expand Messages
  • bidmaron
    In the XP I m working on, I need to build a path. Unfortunatley, there don t seem to be any API calls to add points to a path. What I d like to know is what
    Message 1 of 6 , Apr 25 8:35 PM
    View Source
    • 0 Attachment
      In the XP I'm working on, I need to build a path. Unfortunatley, there don't seem to be any
      API calls to add points to a path. What I'd like to know is what are SRes, SParm, and EParm
      in the Path2 structure? The other fields in the structure are pretty self-explanatory.
      Thanks to anyone who knows what these are or where I can find info on them.
      --Dale--
    • L. Lee Saunders
      Dale, I ve programmed many XP commands that create paths. Here is some code that adds a path //First append a empty record to the drawing list
      Message 2 of 6 , Apr 27 1:32 PM
      View Source
      • 0 Attachment
        Dale,
         
        I've programmed many XP commands that create paths.  Here is some code that adds a path
         

        //First append a empty record to the drawing list

        pEntRec=DLApndE(NULL,pEntRec,100);

         

        //Set the type to path

        pEntRec->CStuff.EType=ET_PATH2;

         

        //GetCStuff sets all the common entity stuff with the current set values

        GetCStuff(pEntRec);

         

        //Resize the entity so that it can contain all of the nodes

        //(Depth is one of my variables in the fractal commands: the number of

        // nodes is a power of two in a fractalized path)

        pEntRec=DLResize(DLClone(pEntRec),pEntRec->CStuff.ERLen+(8*pow(2,Depth)));

         

        //NodeCount holds my number of nodes and NodeArray holds the actual nodes 

        for (i=0;i<NodeCount;i++)

        {          

              pEntRec->Path.Path.Nodes[i].x=NodeArray[i].x;

              pEntRec->Path.Path.Nodes[i].y=NodeArray[i].y;

        }

                 

        pEntRec->Path.Path.Count=NodeCount;

         

        //EParm holds a float that is one less than the nodecount

        pEntRec->Path.Path.EParm=(float)NodeCount-1;

                   

        //SmType is SmoothType and since fractals are not smooth: SmType=0

        pEntRec->Path.Path.SmType=0;

         

        //SRes is hardcoded to 8

        pEntRec->Path.Path.SRes=8;

         

        //SParm is the opposite of EParm. (Start Parameter and End Parameter) and is

        //Always 0.

        pEntRec->Path.Path.SParm=0;

         

        //Draw your new path

        EDraw(pEntRec);

         

        Hope this helps!

         

        Lee

        ----- Original Message -----
        From: bidmaron
        Sent: Monday, April 25, 2005 10:35 PM
        Subject: [cc2-dev-l] Path2 Help



        In the XP I'm working on, I need to build a path.  Unfortunatley, there don't seem to be any
        API calls to add points to a path.  What I'd like to know is what are SRes, SParm, and EParm
        in the Path2 structure?  The other fields in the structure are pretty self-explanatory. 
        Thanks to anyone who knows what these are or where I can find info on them.
        --Dale--








        To Post a message, send it to:   cc2-dev-l@...
        To Unsubscribe, send a blank message to: cc2-dev-l-unsubscribe@...


      • bidmaron
        Thanks, Lee, that is very helpful. I can t believe I made the GE mistake you mentioned earlier. That is very brain-dead. I understand all. Thanks for
        Message 3 of 6 , Apr 27 6:34 PM
        View Source
        • 0 Attachment
          Thanks, Lee, that is very helpful. I can't believe I made the GE mistake you mentioned
          earlier. That is very brain-dead. I understand all. Thanks for getting back to me!
          --Dale--


          --- In cc2-dev-l@yahoogroups.com, "L. Lee Saunders" <saunderl@h...> wrote:
          > Dale,
          >
          > I've programmed many XP commands that create paths. Here is some code that adds a
          path
          >
          > //First append a empty record to the drawing list
          >
          > pEntRec=DLApndE(NULL,pEntRec,100);
          >
          >
          >
          > //Set the type to path
          >
          > pEntRec->CStuff.EType=ET_PATH2;
          >
          >
          >
          > //GetCStuff sets all the common entity stuff with the current set values
          >
          > GetCStuff(pEntRec);
          >
          >
          >
          >
          > //Resize the entity so that it can contain all of the nodes
          >
          > //(Depth is one of my variables in the fractal commands: the number of
          >
          > // nodes is a power of two in a fractalized path)
          >
          > pEntRec=DLResize(DLClone(pEntRec),pEntRec->CStuff.ERLen+(8*pow(2,Depth)));
          >
          >
          >
          > //NodeCount holds my number of nodes and NodeArray holds the actual nodes
          >
          > for (i=0;i<NodeCount;i++)
          >
          > {
          >
          > pEntRec->Path.Path.Nodes[i].x=NodeArray[i].x;
          >
          > pEntRec->Path.Path.Nodes[i].y=NodeArray[i].y;
          >
          > }
          >
          >
          >
          > pEntRec->Path.Path.Count=NodeCount;
          >
          >
          >
          > //EParm holds a float that is one less than the nodecount
          >
          > pEntRec->Path.Path.EParm=(float)NodeCount-1;
          >
          >
          >
          > //SmType is SmoothType and since fractals are not smooth: SmType=0
          >
          > pEntRec->Path.Path.SmType=0;
          >
          >
          >
          > //SRes is hardcoded to 8
          >
          > pEntRec->Path.Path.SRes=8;
          >
          >
          >
          > //SParm is the opposite of EParm. (Start Parameter and End Parameter) and is
          >
          > //Always 0.
          >
          > pEntRec->Path.Path.SParm=0;
          >
          >
          >
          >
          > //Draw your new path
          >
          > EDraw(pEntRec);
          >
          >
          >
          > Hope this helps!
          >
          >
          >
          > Lee
          >
          > ----- Original Message -----
          > From: bidmaron
          > To: cc2-dev-l@yahoogroups.com
          > Sent: Monday, April 25, 2005 10:35 PM
          > Subject: [cc2-dev-l] Path2 Help
          >
          >
          >
          >
          > In the XP I'm working on, I need to build a path. Unfortunatley, there don't seem to be
          any
          > API calls to add points to a path. What I'd like to know is what are SRes, SParm, and
          EParm
          > in the Path2 structure? The other fields in the structure are pretty self-explanatory.
          > Thanks to anyone who knows what these are or where I can find info on them.
          > --Dale--
          >
          >
          >
          >
          >
          >
          >
          >
          > To Post a message, send it to: cc2-dev-l@e...
          > To Unsubscribe, send a blank message to: cc2-dev-l-unsubscribe@e...
          >
          >
          >
          >
          ----------------------------------------------------------------------------
          --
          > Yahoo! Groups Links
          >
          > a.. To visit your group on the web, go to:
          > http://groups.yahoo.com/group/cc2-dev-l/
          >
          > b.. To unsubscribe from this group, send an email to:
          > cc2-dev-l-unsubscribe@yahoogroups.com
          >
          > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        • L. Lee Saunders
          Dale, Not a problem, thats what we re here for. Lee
          Message 4 of 6 , Apr 27 7:04 PM
          View Source
          • 0 Attachment
            Dale,

            Not a problem, thats what we're here for.

            Lee

            >Thanks, Lee, that is very helpful. I can't believe I made the GE mistake
            >you mentioned
            >earlier. That is very brain-dead. I understand all. Thanks for getting
            >back to me!
            >--Dale--
            >
            >
            >--- In cc2-dev-l@yahoogroups.com, "L. Lee Saunders" <saunderl@h...> wrote:
            > > Dale,
            > >
            > > I've programmed many XP commands that create paths. Here is some code
            >that adds a
            >path
            > >
            > > //First append a empty record to the drawing list
            > >
            > > pEntRec=DLApndE(NULL,pEntRec,100);
            > >
            > >
            > >
            > > //Set the type to path
            > >
            > > pEntRec->CStuff.EType=ET_PATH2;
            > >
            > >
            > >
            > > //GetCStuff sets all the common entity stuff with the current set values
            > >
            > > GetCStuff(pEntRec);
            > >
            > >
            > >
            > >
            > > //Resize the entity so that it can contain all of the nodes
            > >
            > > //(Depth is one of my variables in the fractal commands: the number of
            > >
            > > // nodes is a power of two in a fractalized path)
            > >
            > >
            >pEntRec=DLResize(DLClone(pEntRec),pEntRec->CStuff.ERLen+(8*pow(2,Depth)));
            > >
            > >
            > >
            > > //NodeCount holds my number of nodes and NodeArray holds the actual
            >nodes
            > >
            > > for (i=0;i<NodeCount;i++)
            > >
            > > {
            > >
            > > pEntRec->Path.Path.Nodes[i].x=NodeArray[i].x;
            > >
            > > pEntRec->Path.Path.Nodes[i].y=NodeArray[i].y;
            > >
            > > }
            > >
            > >
            > >
            > > pEntRec->Path.Path.Count=NodeCount;
            > >
            > >
            > >
            > > //EParm holds a float that is one less than the nodecount
            > >
            > > pEntRec->Path.Path.EParm=(float)NodeCount-1;
            > >
            > >
            > >
            > > //SmType is SmoothType and since fractals are not smooth: SmType=0
            > >
            > > pEntRec->Path.Path.SmType=0;
            > >
            > >
            > >
            > > //SRes is hardcoded to 8
            > >
            > > pEntRec->Path.Path.SRes=8;
            > >
            > >
            > >
            > > //SParm is the opposite of EParm. (Start Parameter and End Parameter)
            >and is
            > >
            > > //Always 0.
            > >
            > > pEntRec->Path.Path.SParm=0;
            > >
            > >
            > >
            > >
            > > //Draw your new path
            > >
            > > EDraw(pEntRec);
            > >
            > >
            > >
            > > Hope this helps!
            > >
            > >
            > >
            > > Lee
            > >
            > > ----- Original Message -----
            > > From: bidmaron
            > > To: cc2-dev-l@yahoogroups.com
            > > Sent: Monday, April 25, 2005 10:35 PM
            > > Subject: [cc2-dev-l] Path2 Help
            > >
            > >
            > >
            > >
            > > In the XP I'm working on, I need to build a path. Unfortunatley,
            >there don't seem to be
            >any
            > > API calls to add points to a path. What I'd like to know is what are
            >SRes, SParm, and
            >EParm
            > > in the Path2 structure? The other fields in the structure are pretty
            >self-explanatory.
            > > Thanks to anyone who knows what these are or where I can find info on
            >them.
            > > --Dale--
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            > > To Post a message, send it to: cc2-dev-l@e...
            > > To Unsubscribe, send a blank message to: cc2-dev-l-unsubscribe@e...
            > >
            > >
            > >
            > >
            >----------------------------------------------------------------------------
            >--
            > > Yahoo! Groups Links
            > >
            > > a.. To visit your group on the web, go to:
            > > http://groups.yahoo.com/group/cc2-dev-l/
            > >
            > > b.. To unsubscribe from this group, send an email to:
            > > cc2-dev-l-unsubscribe@yahoogroups.com
            > >
            > > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            >Service.
            >
            >
            >
          • Peter Olsson
            ... This is supposed to be: pEntRec=DLApndE(NULL, ET_PATH2, sizeof(PATH2)+Count*sizeof(GPOINT2)); The parameters are: 1. Drawing list (NULL for the main
            Message 5 of 6 , May 2, 2005
            View Source
            • 0 Attachment
              A few comments to the code:

              > //First append a empty record to the drawing list
              > pEntRec=DLApndE(NULL,pEntRec,100);

              This is supposed to be:

              pEntRec=DLApndE(NULL, ET_PATH2, sizeof(PATH2)+Count*sizeof(GPOINT2));

              The parameters are:

              1. Drawing list (NULL for the main drawing)
              2. Entity type
              3. Size (in bytes)

              > //Set the type to path
              > pEntRec->CStuff.EType=ET_PATH2;

              This is not needed if entity type is set in the call to DLApndE

              > // Resize the entity so that it can contain all of the nodes
              >
              > //(Depth is one of my variables in the fractal commands:
              > // the number of nodes is a power of two in a fractalized path)
              >
              > pEntRec=DLResize(DLClone(pEntRec),pEntRec->CStuff.ERLen+(8*pow
              > (2,Depth)));

              The DLClone will make a copy and save the original for undo later. When
              adding a new entity this is not needed. DLResize will change the size of the
              entity. It is easier to set this in DLApndE.

              > //EParm holds a float that is one less than the nodecount
              >
              > pEntRec->Path.Path.EParm=(float)NodeCount-1;

              Eparm is the T-value where the curve will stop. If you for example trim a
              spline it will still keep all nodes and just set the EParm to the correct
              stop value. If trim would move nodes the curve would not have stayed in the
              same location.

              When createing new entities you should use:

              For open paths:

              pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count-1;

              For closed paths (polygons)

              pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count;



              Conclusion there are a lot of ways to do this stuff. Here is another
              alternative for Lees code:

              //First append a empty record to the drawing list
              pEntRec=DLApndE(NULL, ET_PATH2, sizeof(PATH2)+NodeCount*sizeof(GPOINT2));

              // GetCStuff sets all the common entity stuff with the current set values
              GetCStuff(pEntRec);

              //NodeCount holds my number of nodes and NodeArray holds the actual nodes
              for (i=0;i<NodeCount;i++)
              pEntRec->Path.Path.Nodes[i]=NodeArray[i];

              pEntRec->Path.Path.Count=NodeCount;
              pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count-1;
              pEntRec->Path.Path.SmType=0;
              pEntRec->Path.Path.SRes=8;
              pEntRec->Path.Path.SParm=0;

              //Draw your new path
              EDraw(pEntRec);



              Good luck!

              Peter
            • bidmaron
              Peter, thanks a lot. I think I understand everything you said. Don t think I d ever have figured it out without this. --Dale--
              Message 6 of 6 , May 2, 2005
              View Source
              • 0 Attachment
                Peter, thanks a lot. I think I understand everything you said. Don't think I'd ever have
                figured it out without this.
                --Dale--
                --- In cc2-dev-l@yahoogroups.com, "Peter Olsson" <peter@p...> wrote:
                >
                > A few comments to the code:
                >
                > > //First append a empty record to the drawing list
                > > pEntRec=DLApndE(NULL,pEntRec,100);
                >
                > This is supposed to be:
                >
                > pEntRec=DLApndE(NULL, ET_PATH2, sizeof(PATH2)+Count*sizeof(GPOINT2));
                >
                > The parameters are:
                >
                > 1. Drawing list (NULL for the main drawing)
                > 2. Entity type
                > 3. Size (in bytes)
                >
                > > //Set the type to path
                > > pEntRec->CStuff.EType=ET_PATH2;
                >
                > This is not needed if entity type is set in the call to DLApndE
                >
                > > // Resize the entity so that it can contain all of the nodes
                > >
                > > //(Depth is one of my variables in the fractal commands:
                > > // the number of nodes is a power of two in a fractalized path)
                > >
                > > pEntRec=DLResize(DLClone(pEntRec),pEntRec->CStuff.ERLen+(8*pow
                > > (2,Depth)));
                >
                > The DLClone will make a copy and save the original for undo later. When
                > adding a new entity this is not needed. DLResize will change the size of the
                > entity. It is easier to set this in DLApndE.
                >
                > > //EParm holds a float that is one less than the nodecount
                > >
                > > pEntRec->Path.Path.EParm=(float)NodeCount-1;
                >
                > Eparm is the T-value where the curve will stop. If you for example trim a
                > spline it will still keep all nodes and just set the EParm to the correct
                > stop value. If trim would move nodes the curve would not have stayed in the
                > same location.
                >
                > When createing new entities you should use:
                >
                > For open paths:
                >
                > pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count-1;
                >
                > For closed paths (polygons)
                >
                > pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count;
                >
                >
                >
                > Conclusion there are a lot of ways to do this stuff. Here is another
                > alternative for Lees code:
                >
                > //First append a empty record to the drawing list
                > pEntRec=DLApndE(NULL, ET_PATH2, sizeof(PATH2)+NodeCount*sizeof(GPOINT2));
                >
                > // GetCStuff sets all the common entity stuff with the current set values
                > GetCStuff(pEntRec);
                >
                > //NodeCount holds my number of nodes and NodeArray holds the actual nodes
                > for (i=0;i<NodeCount;i++)
                > pEntRec->Path.Path.Nodes[i]=NodeArray[i];
                >
                > pEntRec->Path.Path.Count=NodeCount;
                > pEntRec->Path.Path.EParm=(float)pEntRec->Path.Path.Count-1;
                > pEntRec->Path.Path.SmType=0;
                > pEntRec->Path.Path.SRes=8;
                > pEntRec->Path.Path.SParm=0;
                >
                > //Draw your new path
                > EDraw(pEntRec);
                >
                >
                >
                > Good luck!
                >
                > Peter
              Your message has been successfully submitted and would be delivered to recipients shortly.