# editAttr_udf_1 # written by John Dannenhoffer # command blocks take the form: # PATBEG var ncopy (optional) # type oper attr1 ... # bool oper attr1 ... (optional) # ... (optional) # action attr1 ... # PATEND (only if there is a matching PATBEG) # # where: # var loop variable (cannot be same as one outside) # ncopy the number of copies of the pattern # # where type can be: # NODE to select Node(s) # EDGE to select Edge(s) # FACE to select Face(s) # # where oper can be: # HAS matches attr1 and attr2 and ... # ADJ2NODE adjacent to a Node that matches attr1 and attr2 and ... # ADJ2EDGE adjacent to an Edge that matches attr1 and attr2 and ... # ADJ2FACE adjacent to a Face that matches attr1 and attr2 and ... # # where bool can be: # AND this condition must also hold # ANDNOT this condition must not hold # # where attr1 is in the form: # attrName=attrValue matches the name and the value # attributeName=* * is a wildcard # attributeName= (only in SET) to delete the attrName # # where action can be: # SET sets attr1 and attr2 and ... # ADD adds attra and attr2 and ... # # # introduces a comment # END the remainder of the file is ignored # # note: all command can be either UPPERCASE or lowercase, but not MixedCase # note: white-space at beginning of a line is ignored # note: tokens are delimited with white-spaces # note: editAttr has access to variables defined in the .csm script # make three adjacent boxes BOX 0 0 0 0 1 1 BOX 1 0 0 0 1 1 BOX 2 0 0 0 1 1 BOX 3 0 0 0 1 1 RULE # label the Faces SELECT FACE @nbody 1 ATTRIBUTE name $xmin ATTRIBUTE _color $red SELECT FACE @nbody 2 ATTRIBUTE name $xmax ATTRIBUTE _color $red SELECT FACE -.1 3.1 -.1 0.1 -.1 1.1 ATTRIBUTE name $ymin ATTRIBUTE _color $green SELECT FACE -.1 3.1 0.9 1.1 -.1 1.1 ATTRIBUTE name $ymax ATTRIBUTE _color $green SELECT FACE -.1 3.1 -.1 1.1 -.1 0.1 ATTRIBUTE name $zmin ATTRIBUTE _color $blue SELECT FACE -.1 3.1 -.1 1.1 0.9 1.1 ATTRIBUTE name $zmax ATTRIBUTE _color $blue # color the one of the Zmax Edges yellow SELECT EDGE 1 1/2 1 ATTRIBUTE _color $yellow # make a copy (that we will work on) RESTORE . TRANSLATE 0 2 0 # set a variable outside editAttr SET theName $xmin UDPARG editAttr verbose 1 # print data while processing (good for debugging) UDPRIM editAttr filename << # use inline file # make the Faces adjacent to the yellow Edge magenta FACE ADJ2EDGE _color=yellow SET _color=magenta # make Faces adjacent to magenta Faces magenta too FACE ADJ2FACE _color=magenta SET _color=magenta # turn the grid on Edges that are adjacent to a magenta Face (but is not yellow) EDGE ADJ2FACE _color=magenta ANDNOT HAS _color=yellow SET _grd=on # turn the Node a xmax,ymax,zmin on and make it red NODE ADJ2FACE name=xmax AND ADJ2FACE name=ymax AND ADJ2FACE name=zmin SET _viz=on _color=red # use the default color (yellow) by unsetting _color on the magenta Faces that are on ymax FACE HAS _color=magenta name=ymax SET _color= # turn the grid on xmin on (the ! causes theName to be evaluated) FACE HAS name=!theName SET _grd=on # make all of the max Face transparent FACE HAS name=*max SET _trn=on # put a vector attribute on the z Faces FACE HAS name=z* SET number=1;2;3;4 >> END