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
  • I'm not exactly sure what the problem is... I've checked and rechecked the code and I have it typed in exactly as it's shown here, but I keep getting two error messages as soon as I enter the ALLHITS("CIR3"),ALLHITS("CIR4").

    I'm getting the following errors-

    Math failed for CIR5: Input features not defined earlier.

    and

    Theo math failed for CIR5: Illegal number of input features used
    Meas math failed for CIR5: Illegal number of input features used.

    Am I missing something?

    I've used another method in the past that I found on the forum to take the points from two circles to create one circle where the points are put into a feature set and then a circle is created from the feature set, but this seemed both cleaner and simpler. However... obviously cleaner and simpler isn't advantageous if it doesn't work. I don't know if there's something I'm leaving out (and if I'm leaving something out it's because it's not shown here) or if it's something that's not compatible with the version I'm running 19R1 SP11.
  • DaVe_M,
    Can you post your code so we can take a look at it?
Reply Children
No Data