Kubotek Forum

KeyCreator CAD & CKD Viewer Technical discussion of CAD/CAM and integrated partner products
Customer Forum > KeyCreator CAD & CKD Viewer > Mirror to all quadrants View modes: 
User avatar
Advanced member
Advanced member
Hans_Winkler - 2/13/2019 3:05:33 PM
   
Mirror to all quadrants
Hello everyone,
below is KXL code to mirror copy selected entities to the other three quadrants in one step.
Program flow:
Select entities to be mirrored, indicate mirror position, done!

// beginning of code
:START
    MaskEntity 0
    GENSEL "Select Entities to be mirrored to all quadrants...Press ESC to Quit", nNumSel, 0, 1, 0, 0, 0, 0
    if (@key == -3)
        EXIT
    if (@key == -2)
        EXIT

    CLEAR aGenSelEnts, aGenSelEnts2
    GETSELECTED aGenSelEnts

:INDICATE_POS
    INT intDefault
    if (intDefault == 0)
        intDefault = 1
    GETPOS "Indicate the mirror position... ", intDefault
    if (@key == -3)
        EXIT
    if (@key == -2)
        goto START
    intDefault = @key

    CLEAR adPlane
    DOUBLE adPlane[0]
    ARRAY adPlane[3] = {@xworld, @yworld, @zworld}

// mirror horizontally
    XFormMirror 1, aGenSelEnts, 2, adPlane, , , aGenSelEnts2
// add the newly created entities to the selected entity array
    HAPPEND aGenSelEnts, aGenSelEnts2
// mirror vertically
    XFormMirror 1, aGenSelEnts, 1, adPlane, ,

    NoteState
    goto START
// end of code

Hans



1
Login