// Rectangle by Multiple Methods // Macro Name: rect.mcl // Created by: Doug Oliver // Date: 05-05-05 // Release Version: v12.5 // 10-25-05 Fixed expression evaluation bug by adding parenthesis // around string assignments //Set corner points based on method // Corner Corner IF(#METHOD=0) #SPX=(#CP1X) #SPY=(#CP1Y) ENDIF // Center Corner IF(#METHOD=1) #SPX=(#CP1X-(#CP2X-#CP1X)) #SPY=(#CP1Y-(#CP2Y-#CP1Y)) ENDIF // Corner Length-Width-Angle IF(#METHOD=2) #SPX=(#CP1X) #SPY=(#CP1Y) #CP2X=(#CP1X+#LENGTH) #CP2Y=(#CP1Y+#WIDTH) ENDIF // Center Length-Width-Angle IF(#METHOD=3) #SPX=(#CP1X-(#LENGTH/2)) #SPY=(#CP1Y-(#WIDTH/2)) #CP2X=(#SPX+(#LENGTH)) #CP2Y=(#SPY+(#WIDTH)) ENDIF // If the start and end values are the same issue message and terminate the macro IF(#CP1X=#CP2X) //Output message, set flag and leave early PAUSE[TX="The X axis coordinates are the same, or Length is zero.", SC=50, SR=2, PT=0] GOTO(EXIT) ENDIF IF(#CP1Y=#CP2Y) //Output message, set flag and leave early PAUSE[TX="The Y axis coordinates are the same, or Width is zero.", SC=50, SR=2, PT=0] GOTO(EXIT) ENDIF // Check to see if Radius will fit #RADIUS=ABS(#RADIUS) IF(#RADIUS>=((ABS(#SPX-#CP2X))/2),OR #RADIUS>=((ABS(#SPY-#CP2Y))/2)) PAUSE[TX="Radius value will not fit in rectangle.", SR=1] GOTO(EXIT) ENDIF NEW_GRP[] LINE[XS=#SPX, YS=#SPY, ZS=#CP1Z, XE=#SPX, YE=#CP2Y, ZE=#CP1Z] LINE[XS=#SPX, YS=#CP2Y, ZS=#CP1Z, XE=#CP2X, YE=#CP2Y, ZE=#CP1Z] LINE[XS=#CP2X, YS=#CP2Y, ZS=#CP1Z, XE=#CP2X, YE=#SPY, ZE=#CP1Z] LINE[XS=#CP2X, YS=#SPY, ZS=#CP1Z, XE=#SPX, YE=#SPY, ZE=#CP1Z] IF(SEQBA()=1) #EL_NUM=#EL ELSE #EL_NUM=#EL-1 ENDIF RANGE_GRP[AR=0, E1=(#EL_NUM-3), E2=#EL_NUM] GRP_BLEND[RA=#RADIUS, RO=#RADIUS, RC=?] // Rotate rectangle for Corner Length-Width-Angle or Center Length-Width-Angle methods IF(#METHOD=2, OR #METHOD=3) ROTATE[XS=#CP1X, YS=#CP1Y, ZS=#CP1Z, AN=#ANGLE, CP=0, NC=1, TS=0, TY=0, SP=1] ENDIF GRP_DELETE[] UNDO[] @EXIT