I'm wondering how to use what I think is called "code-branching" to use another procedure I've already written so I don't have to keep
pasting the code again into whatever I'm using now for some specific function. So say for example i have:
and I have attached that to a bindkey which I use once in a while when the need calls for it. But now I'm working and I find another
thing that I can automate which will speed up my work, I need to do something like this:
shape~>bBox=list(0:yCoord(car(shape~>bBox)) cadr(shape~>bBox) )
so after the spot where I change the bBox to be at X=0 I want to change all those shapes to M2, I don't want to add the code to change
the layerName because I already have that written some where , it would make sense to me to just add the procedure call and then
return to where I was, Do I need to do anything to the original procedure which changes the layerName so once that branch is done it
returns to the code where I am stretching to the left Edge?
I'm a bit mystified by this question. It's just a matter of calling the function:
procedure( makeShapesStretchToLeftEdge() foreach(shape selectedSet() shape~>bBox=list(0:yCoord(car(shape~>bBox)) cadr(shape~>bBox) ) ) changeShapeTometal2() ; you could now add more code here to do something else too)
The whole point of a function is that it returns to where you were after you call it.
Hi Andrew - ok - thanks for answering that question - I was asking if perhaps , as an example, to the second code which changes layer I would have to add a line at the end like return() or some such call to make the branch resume at the first code which stretches shapes to the left edge. Apparently what you are saying, is that skill understands somehow the branch is done and it can resume the first code. ( the second function runs to completion before anything else in the primary procedure resumes ). Sorry, I realize it's kinda simplistic, but I don't want code from one function to continue before code from the second procedure completes. I also wanted to make sure the invocation of a procedure from within a procedure the flow returns to the line exactly after the invocation. I appreciate your time to answer this. Regards. Malcolm