hexagon logo

More Generic Function Example

Construct Features Hits Function

Here is an example on how to use functions to simplify the syntax when typing in the commands for a Constructed Circle from two Auto Circles.

If you have two Auto Circles named CIR1 and CIR2 then you would have to use the syntax CIR1.HIT[1..CIR1.NUMHITS],CIR2.HIT[1..CIR2.NUMHITS] for the Constructed Circle.

With this Function example

ASSIGN/PAR_ALLHITS1=".HIT[1.."
ASSIGN/PAR_ALLHITS2=".NUMHITS]"
ASSIGN/ALLHITS=FUNCTION((IDA),(IDA)+PAR_ALLHITS1+(IDA)+PAR_ALLHITS2)

All you have to type in is ALLHITS("CIR1"),ALLHITS("CIR2")

Code example
ASSIGN/PAR_ALLHITS1=".HIT[1.."
ASSIGN/PAR_ALLHITS2=".NUMHITS]"
ASSIGN/ALLHITS=FUNCTION((IDA),(IDA)+PAR_ALLHITS1+(IDA)+PAR_ALLHITS2)
CIR1 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<4.291,3.5036,0>,<0,0,1>,0.6457
ACTL/<4.291,3.5036,0>,<0,0,1>,0.6457
TARG/<4.291,3.5036,0>,<0,0,1>
START ANG=0,END ANG=360
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=NO
CIR2 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<4.291,3.5036,-0.7874>,<0,0,1>,0.6457
ACTL/<4.291,3.5036,-0.7874>,<0,0,1>,0.6457
TARG/<4.291,3.5036,-0.7874>,<0,0,1>
START ANG=0,END ANG=360
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=NO
CIR5 =FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
THEO/<4.291,3.5036,-0.3937>,<0,0,1>,0.6457
ACTL/<4.291,3.5036,-0.3937>,<0,0,1>,0.6457
CONSTR/CIRCLE,BFRE,2D,ALLHITS("CIR1"),ALLHITS("CIR2"),,
OUTLIER_REMOVAL/OFF,3
FILTER/OFF,UPR=0
CIR3 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<3.1496,2.3622,0>,<0,0,1>,2.3622
ACTL/<3.1496,2.3622,0>,<0,0,1>,2.3622
TARG/<3.1496,2.3622,0>,<0,0,1>
START ANG=0,END ANG=360
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=NO
CIR4 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<3.1496,2.3622,-0.7874>,<0,0,1>,2.3622
ACTL/<3.1496,2.3622,-0.7874>,<0,0,1>,2.3622
TARG/<3.1496,2.3622,-0.7874>,<0,0,1>
START ANG=0,END ANG=360
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=NO
CIR6 =FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
THEO/<3.1496,2.3622,-0.3937>,<0,0,1>,2.3622
ACTL/<3.1496,2.3622,-0.3937>,<0,0,1>,2.3622
CONSTR/CIRCLE,BFRE,2D,ALLHITS("CIR3"),ALLHITS("CIR4"),,
OUTLIER_REMOVAL/OFF,3
FILTER/OFF,UPR=0
Parents
  • Woah Astonished! Mind blown. Never thought to use a function like that.

    Just curious, why not put it all in one line like this?:
    ASSIGN/ALLHITS=FUNCTION((IDA),(IDA)+".HIT[1.."+(IDA)+".NUMHITS]")

    Is there an advantage to use variables for the ".HIT[1.." and ".NUMHITS]" strings?


    i have been using this for my last few programs, works very well ! instead of naming the variable "ALLHITS", i named it "HITS" (to shorten things up).
Reply
  • Woah Astonished! Mind blown. Never thought to use a function like that.

    Just curious, why not put it all in one line like this?:
    ASSIGN/ALLHITS=FUNCTION((IDA),(IDA)+".HIT[1.."+(IDA)+".NUMHITS]")

    Is there an advantage to use variables for the ".HIT[1.." and ".NUMHITS]" strings?


    i have been using this for my last few programs, works very well ! instead of naming the variable "ALLHITS", i named it "HITS" (to shorten things up).
Children
No Data