# Author - Maciej Rogowski
# Copyright 2024 Maciej Rogowski. All rights reserved.
# Description - Creates a dowel joint between two boards.








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































import adsk.core



































































































import adsk.fusion



































































































import traceback



































































































import os



































































































import math



































































































import json



































































































import sys



































































































import subprocess



































































































SN46rVt5 = False



































































































BKhfFwk7 = False



































































































QJQwj7K7 = "./"



































































































R85NnM6N = None



































































































class H44bB1GG:



































































































    def __init__(Q7B515Ph):



































































































        Q7B515Ph.Ghjt2RRG = None



































































































        Q7B515Ph.KkqWNNQ8 = None



































































































        Q7B515Ph.jfW6CB2p = None



































































































        Q7B515Ph.P1c4gJfR = None



































































































        Q7B515Ph.D9s2QnJf = None



































































































        Q7B515Ph.JMp17LRK = None



































































































        Q7B515Ph.m5klvjDJ = None



































































































        Q7B515Ph.GvRGVm7D = None



































































































        Q7B515Ph.d1H7V1k2 = None



































































































        Q7B515Ph.KBj2qHB2 = None



































































































        Q7B515Ph.Cvv6nT4S = None



































































































        Q7B515Ph.dlCC66hR = None



































































































        Q7B515Ph.GLRnsR36 = None



































































































        Q7B515Ph.fntr62Mw = None



































































































        Q7B515Ph.kQJ1W3kk = None



































































































        Q7B515Ph.Tr6qbTcR = None



































































































        Q7B515Ph.PkPj6wfk = None



































































































        Q7B515Ph.JSdvj575 = None



































































































        Q7B515Ph.SkVhr2pz = None



































































































        Q7B515Ph.j7ZGQ7m6 = None



































































































        Q7B515Ph.Kbw14qw6 = None



































































































        Q7B515Ph.dLK6wJfD = None



































































































        Q7B515Ph.tcc9nT4f = None



































































































        Q7B515Ph.Wn6ZCbfm = None



































































































        Q7B515Ph.Jj7nd432 = False



































































































        Q7B515Ph.fbk2MbtH = False



































































































cL62qdlC = None



































































































p169ZFkB = None



































































































rs33V1ZR = None



































































































lMB54F3t = None



































































































s15BhdVN = None



































































































P6KQF3wm = None



































































































ZwNS2R4W = None



































































































FLL52DC8 = None



































































































d6GgpZ2G = True



































































































B6b7pZF4 = 0



































































































tflPNvG7 = []



































































































PPs51G4B = False



































































































p591sr8r = 100



































































































Z9QPzJ73 = None



































































































Sl81K1p9 = False



































































































kgmD6nNg = True



































































































TqnNd8K5 = None



































































































D26P8rgj = None



































































































kcPDHw12 = False



































































































f1DG2PWg = None



































































































thT57b72 = None



































































































p1wP7Jl7 = []



































































































wq6D3162 = []



































































































def qN9pKtLP(n3n45Dsw = None):



































































































    global p169ZFkB



































































































    if n3n45Dsw is None:



































































































        n3n45Dsw = p169ZFkB



































































































    if n3n45Dsw:



































































































        n3n45Dsw.messageBox('Failed:\n{}'.format(traceback.format_exc()))



































































































def JqKMTZvQ():



































































































    global cL62qdlC



































































































    global p169ZFkB



































































































    cL62qdlC = adsk.core.Application.get()



































































































    p169ZFkB = cL62qdlC.userInterface



































































































def run(P72dkcWf):



































































































    global p169ZFkB



































































































    global thT57b72



































































































    global p1wP7Jl7



































































































    global kcPDHw12



































































































    global QJQwj7K7



































































































    global rs33V1ZR



































































































    try:



































































































        JqKMTZvQ()



































































































        Gc3KVNck = p169ZFkB.commandDefinitions



































































































        bpMvcrV9 = Gc3KVNck.itemById('DowelJointMRButtonDefIdPython')



































































































        if bpMvcrV9:



































































































            bpMvcrV9.deleteMe()



































































































        CmpSdG4r = p169ZFkB.allToolbarPanels.itemById('SolidModifyPanel')



































































































        BGftzK63 = CmpSdG4r.controls.itemById('DowelJointMRButtonDefIdPython')



































































































        if BGftzK63:



































































































            BGftzK63.deleteMe()



































































































        rs33V1ZR = Gc3KVNck.addButtonDefinition('DowelJointMRButtonDefIdPython',



































































































                                               'Dowel Joint',



































































































                                               'Creates a dowel joint between two boards.',



































































































                                               QJQwj7K7 + 'Resources')



































































































        qS9qP3k1 = BPdg8Hbp()



































































































        rs33V1ZR.commandCreated.add(qS9qP3k1)



































































































        thT57b72 = qS9qP3k1



































































































        CmpSdG4r = p169ZFkB.allToolbarPanels.itemById('SolidModifyPanel')



































































































        CmpSdG4r.controls.addCommand(rs33V1ZR)



































































































        kcPDHw12 = mqN834w4()  



































































































    except Exception:



































































































        qN9pKtLP()



































































































def stop(P72dkcWf):



































































































    global p169ZFkB



































































































    global thT57b72



































































































    global p1wP7Jl7



































































































    global wq6D3162



































































































    global P6KQF3wm



































































































    global ZwNS2R4W



































































































    global lMB54F3t



































































































    global s15BhdVN



































































































    global FLL52DC8



































































































    global tflPNvG7



































































































    global Z9QPzJ73



































































































    global TqnNd8K5



































































































    global D26P8rgj



































































































    global rs33V1ZR



































































































    try:



































































































        bpMvcrV9 = p169ZFkB.commandDefinitions.itemById('DowelJointMRButtonDefIdPython')



































































































        if bpMvcrV9:



































































































            bpMvcrV9.deleteMe()



































































































        CmpSdG4r = p169ZFkB.allToolbarPanels.itemById('SolidModifyPanel')



































































































        BGftzK63 = CmpSdG4r.controls.itemById('DowelJointMRButtonDefIdPython')



































































































        if BGftzK63:



































































































            BGftzK63.deleteMe()



































































































        thT57b72 = None  



































































































        p1wP7Jl7 = []



































































































        wq6D3162 = []



































































































        P6KQF3wm = None



































































































        ZwNS2R4W = None  



































































































        rs33V1ZR = None  



































































































        lMB54F3t = None



































































































        s15BhdVN = None



































































































        FLL52DC8 = None



































































































        tflPNvG7 = []



































































































        Z9QPzJ73 = None



































































































        TqnNd8K5 = None



































































































        D26P8rgj = None



































































































    except Exception:



































































































        qN9pKtLP()



































































































def mqN834w4():



































































































    try:



































































































        Zr26b2kG = os.path.dirname(os.path.realpath(__file__))



































































































        LqDQ61fh = Zr26b2kG + '/set.set'



































































































        BkNWGgDL = Zr26b2kG + '/options.set'



































































































        if os.path.isfile(LqDQ61fh) and os.path.isfile(BkNWGgDL):



































































































            if os.path.getsize(LqDQ61fh) == 0 or os.path.getsize(BkNWGgDL) == 0:



































































































                return False



































































































            Tr2h46vZ = abs(os.path.getmtime(LqDQ61fh) - os.path.getmtime(BkNWGgDL))



































































































            if Tr2h46vZ >= 2.4 and Tr2h46vZ <= 2.8:



































































































                return True



































































































        return False



































































































    except Exception:



































































































        qN9pKtLP()



































































































        return None



































































































def wC12Jb16():



































































































    import time



































































































    try:



































































































        Zr26b2kG = os.path.dirname(os.path.realpath(__file__))



































































































        LqDQ61fh = Zr26b2kG + '/set.set'



































































































        with open(LqDQ61fh, 'w') as R7DB17pB:



































































































            Ls4HjdF8 = 'True'



































































































            R7DB17pB.write(Ls4HjdF8)



































































































        time.sleep(2.5)



































































































        BkNWGgDL = Zr26b2kG + '/options.set'



































































































        with open(BkNWGgDL, 'w') as lbwn3335:



































































































            Ls4HjdF8 = 'True'



































































































            lbwn3335.write(Ls4HjdF8)



































































































    except Exception:



































































































        qN9pKtLP()



































































































def tcr2H9Mv(g2cPPlpW):



































































































    return chr(int(g2cPPlpW) + 65)



































































































def vQTlJ4cM(T9flJVvR):



































































































    return str(ord(T9flJVvR) - 65)



































































































def CL3tjmwr(Ls4HjdF8):



































































































    if len(Ls4HjdF8) >= 10:



































































































        if Ls4HjdF8[8] == 'J':



































































































            D45BZ5Nl = str((int(vQTlJ4cM(Ls4HjdF8[1])) + int(vQTlJ4cM(Ls4HjdF8[5])) + int(Ls4HjdF8[2]) + int(vQTlJ4cM(Ls4HjdF8[0])) + int(vQTlJ4cM(Ls4HjdF8[4])) + int(Ls4HjdF8[3]) + 3870) * 2)



































































































            if Ls4HjdF8[6] == D45BZ5Nl[-3]:



































































































                if Ls4HjdF8[7] == D45BZ5Nl[-2]:



































































































                    if vQTlJ4cM(Ls4HjdF8[9]) == D45BZ5Nl[-1]:



































































































                        return True



































































































    return False



































































































def SGlFLNcV(qd7LfHBp):



































































































    import pickle



































































































    try:



































































































        Zr26b2kG = os.path.dirname(os.path.realpath(__file__))



































































































        jBRsdq7q = Zr26b2kG + '/settings.set'



































































































        gm3ttsd7 = open(jBRsdq7q, 'wb')



































































































        pickle.dump(qd7LfHBp, gm3ttsd7)



































































































        gm3ttsd7.close()



































































































    except Exception:



































































































        qN9pKtLP()



































































































def GKvgKwgK():



































































































    import pickle



































































































    try:



































































































        qd7LfHBp = []



































































































        Zr26b2kG = os.path.dirname(os.path.realpath(__file__))



































































































        jBRsdq7q = Zr26b2kG + '/settings.set'



































































































        gm3ttsd7 = open(jBRsdq7q, 'rb')



































































































        if os.path.getsize(jBRsdq7q) > 0:



































































































            qd7LfHBp = pickle.load(gm3ttsd7)



































































































            gm3ttsd7.close()



































































































        return qd7LfHBp



































































































    except Exception:



































































































        qN9pKtLP()



































































































def F2SQPL65(JmH6T73f):



































































































    try:



































































































        if JmH6T73f == 'True':



































































































            zq2m5bkf = True



































































































        else:



































































































            zq2m5bkf = False



































































































        return zq2m5bkf



































































































    except Exception:



































































































        qN9pKtLP()



































































































        return None



































































































def Fg9WMS7K(JNL1B1QF):



































































































    global cL62qdlC



































































































    try:



































































































        SCCnSTpn = cL62qdlC.activeProduct



































































































        qzLPt3WM = SCCnSTpn.rootComponent



































































































        VSpn3C3M = JNL1B1QF.parentComponent



































































































        PMnbGwwd = qzLPt3WM.allOccurrencesByComponent(VSpn3C3M).item(0)



































































































        if PMnbGwwd is not None:



































































































            fzJ514nM = JNL1B1QF.createForAssemblyContext(PMnbGwwd)



































































































        else:



































































































            fzJ514nM = JNL1B1QF



































































































        return fzJ514nM



































































































    except Exception:



































































































        qN9pKtLP()



































































































def Fnljrl6Z(hL5pdT5Q, JNL1B1QF):



































































































    bncsHg6r = hL5pdT5Q.copy()



































































































    try:



































































































        Q23QT71H = []



































































































        PMnbGwwd = JNL1B1QF



































































































        while PMnbGwwd.assemblyContext is not None:



































































































            PMnbGwwd = PMnbGwwd.assemblyContext



































































































            fv6PNvPN = PMnbGwwd.transform



































































































            Q23QT71H.append(fv6PNvPN)



































































































        for fv6PNvPN in Q23QT71H:



































































































            w556tdnc = fv6PNvPN



































































































            bncsHg6r.transformBy(w556tdnc)



































































































        return bncsHg6r



































































































    except Exception:



































































































        qN9pKtLP()



































































































def F6Dn2jTn(JNL1B1QF):



































































































    try:



































































































        PMnbGwwd = JNL1B1QF



































































































        GtdqBD6t = False



































































































        for qPf1Nk77 in range(1000):



































































































            if PMnbGwwd.assemblyContext:



































































































                if PMnbGwwd.assemblyContext.isReferencedComponent:



































































































                    GtdqBD6t = True



































































































                PMnbGwwd = PMnbGwwd.assemblyContext



































































































            else:



































































































                break



































































































        return GtdqBD6t



































































































    except Exception:



































































































        qN9pKtLP()



































































































        return None



































































































def jBzgm24S(zKbKv1H5=False):



































































































    global tflPNvG7



































































































    global p591sr8r



































































































    global B6b7pZF4



































































































    global ZwNS2R4W



































































































    try:



































































































        if B6b7pZF4 < p591sr8r:



































































































            for qPf1Nk77 in range(p591sr8r):



































































































                lh7bb96n = ZwNS2R4W.Kbw14qw6.getInputAtPosition(qPf1Nk77, 0)



































































































                qJL3J3Sg = ZwNS2R4W.Kbw14qw6.getInputAtPosition(qPf1Nk77, 1)  



































































































                if zKbKv1H5:



































































































                    qJL3J3Sg.value = tflPNvG7[qPf1Nk77]



































































































                if qPf1Nk77 < B6b7pZF4:



































































































                    lh7bb96n.isVisible = True



































































































                    qJL3J3Sg.isVisible = True



































































































                else:



































































































                    lh7bb96n.isVisible = False



































































































                    qJL3J3Sg.isVisible = False



































































































        else:



































































































            ZwNS2R4W.j7ZGQ7m6.isEnabledCheckBoxChecked = False



































































































    except Exception:



































































































        qN9pKtLP()



































































































def zvCJLGzL():



































































































    global ZwNS2R4W



































































































    try:



































































































        if ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Spacing from One Side':



































































































            ZwNS2R4W.KBj2qHB2.isEnabled = True



































































































            ZwNS2R4W.Cvv6nT4S.isEnabled = False



































































































            ZwNS2R4W.fntr62Mw.isEnabled = True



































































































        elif ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Symmetrical Spacing':



































































































            ZwNS2R4W.KBj2qHB2.isEnabled = True



































































































            ZwNS2R4W.Cvv6nT4S.isEnabled = False



































































































            ZwNS2R4W.fntr62Mw.isEnabled = False



































































































        elif ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Number of Dowels':



































































































            ZwNS2R4W.KBj2qHB2.isEnabled = False



































































































            ZwNS2R4W.Cvv6nT4S.isEnabled = True



































































































            ZwNS2R4W.fntr62Mw.isEnabled = False



































































































    except Exception:



































































































        qN9pKtLP()



































































































def GL2N2513():



































































































    global cL62qdlC



































































































    global s15BhdVN



































































































    global lMB54F3t



































































































    global Z9QPzJ73



































































































    global ZwNS2R4W



































































































    try:



































































































        s15BhdVN = ZwNS2R4W.P1c4gJfR.selection(0).entity.body  



































































































        FLG167Bm = ZwNS2R4W.dlCC66hR.value



































































































        jg5Vswsc = ZwNS2R4W.GLRnsR36.value



































































































        ZwNS2R4W.dlCC66hR.isEnabled = True



































































































        ZwNS2R4W.GLRnsR36.isEnabled = True



































































































        hSzzCCB7 = ZwNS2R4W.P1c4gJfR.selection(0).entity  



































































































        J4d7z9s6 = hSzzCCB7.edges



































































































        if J4d7z9s6.count == 4:



































































































            kP3qgm68 = J4d7z9s6.count



































































































            gghzSlmM = J4d7z9s6.item(0).startVertex



































































































            Tjh2Hl7L = 10000000.0



































































































            for qPf1Nk77 in range(kP3qgm68):



































































































                V5jp3z41 = J4d7z9s6.item(qPf1Nk77)



































































































                if (V5jp3z41.length < Tjh2Hl7L):



































































































                    Tjh2Hl7L = V5jp3z41.length



































































































                    ZhtWjN2z = qPf1Nk77



































































































            Tjh2Hl7L = 10000000.0



































































































            for qPf1Nk77 in range(kP3qgm68):



































































































                V5jp3z41 = J4d7z9s6.item(qPf1Nk77)



































































































                if (V5jp3z41.length < Tjh2Hl7L and qPf1Nk77 != ZhtWjN2z):



































































































                    Tjh2Hl7L = V5jp3z41.length



































































































                    QJQ5Pg6q = qPf1Nk77



































































































            if not (gghzSlmM.geometry.distanceTo(J4d7z9s6.item(ZhtWjN2z).startVertex.geometry) < 0.01 or gghzSlmM.geometry.distanceTo(J4d7z9s6.item(ZhtWjN2z).endVertex.geometry) < 0.01):



































































































                vh49WqTz = QJQ5Pg6q



































































































                QJQ5Pg6q = ZhtWjN2z



































































































                ZhtWjN2z = vh49WqTz



































































































            CVQ5l2T6 = ZhtWjN2z



































































































            Jl17LcHz = hSzzCCB7.centroid



































































































            V5jp3z41 = J4d7z9s6.item(CVQ5l2T6)



































































































            FLc42Fb1 = adsk.core.Point3D.create((V5jp3z41.startVertex.geometry.x + V5jp3z41.endVertex.geometry.x) / 2, (V5jp3z41.startVertex.geometry.y + V5jp3z41.endVertex.geometry.y) / 2, (V5jp3z41.startVertex.geometry.z + V5jp3z41.endVertex.geometry.z) / 2)



































































































            w4NzLRJ8 = adsk.core.Vector3D.create(Jl17LcHz.x - FLc42Fb1.x, Jl17LcHz.y - FLc42Fb1.y, Jl17LcHz.z - FLc42Fb1.z)



































































































            w4NzLRJ8.normalize()



































































































            ZwNS2R4W.dlCC66hR.setManipulator(FLc42Fb1, w4NzLRJ8)



































































































            ZwNS2R4W.dlCC66hR.value = FLG167Bm



































































































            vqF6mKzp = QJQ5Pg6q



































































































            Jl17LcHz = hSzzCCB7.centroid



































































































            jQkFz5S2 = J4d7z9s6.item(vqF6mKzp)



































































































            sf2rZN44 = adsk.core.Point3D.create((jQkFz5S2.startVertex.geometry.x + jQkFz5S2.endVertex.geometry.x) / 2, (jQkFz5S2.startVertex.geometry.y + jQkFz5S2.endVertex.geometry.y) / 2, (jQkFz5S2.startVertex.geometry.z + jQkFz5S2.endVertex.geometry.z) / 2)



































































































            KRqf3P3Q = adsk.core.Vector3D.create(Jl17LcHz.x - sf2rZN44.x, Jl17LcHz.y - sf2rZN44.y, Jl17LcHz.z - sf2rZN44.z)



































































































            KRqf3P3Q.normalize()



































































































            ZwNS2R4W.GLRnsR36.setManipulator(sf2rZN44, KRqf3P3Q)



































































































            ZwNS2R4W.GLRnsR36.value = jg5Vswsc



































































































        else:



































































































            SCCnSTpn = cL62qdlC.activeProduct  



































































































            JNCsz5nW = SCCnSTpn.rootComponent



































































































            n4vcQHR7 = JNCsz5nW



































































































            nb9q224D = n4vcQHR7.sketches



































































































            l1Zpd1h3 = nb9q224D.add(hSzzCCB7)



































































































            F1FVH6ts = l1Zpd1h3.sketchCurves.sketchLines



































































































            CDkQ3GQD = l1Zpd1h3.boundingBox.maxPoint



































































































            v916C8JS = l1Zpd1h3.boundingBox.minPoint



































































































            dwrC1r4l = F1FVH6ts.addTwoPointRectangle(CDkQ3GQD, v916C8JS)



































































































            BbqSHHWl = F1FVH6ts.item(0).startSketchPoint.geometry



































































































            Z9QPzJ73 = BbqSHHWl.copy()



































































































            HZzW3H3V = dwrC1r4l.count



































































































            Tjh2Hl7L = 10000000



































































































            for qPf1Nk77 in range(HZzW3H3V):



































































































                Q32CtRn1 = dwrC1r4l.item(qPf1Nk77)



































































































                if (Q32CtRn1.length < Tjh2Hl7L):



































































































                    Tjh2Hl7L = Q32CtRn1.length



































































































                    ZhtWjN2z = qPf1Nk77



































































































            Tjh2Hl7L = 10000000



































































































            for qPf1Nk77 in range(HZzW3H3V):



































































































                Q32CtRn1 = dwrC1r4l.item(qPf1Nk77)



































































































                if (Q32CtRn1.length < Tjh2Hl7L and qPf1Nk77 != ZhtWjN2z):



































































































                    Tjh2Hl7L = Q32CtRn1.length



































































































                    QJQ5Pg6q = qPf1Nk77



































































































            if BbqSHHWl.distanceTo(dwrC1r4l.item(ZhtWjN2z).startSketchPoint.geometry) > BbqSHHWl.distanceTo(dwrC1r4l.item(QJQ5Pg6q).startSketchPoint.geometry):



































































































                vh49WqTz = QJQ5Pg6q



































































































                QJQ5Pg6q = ZhtWjN2z



































































































                ZhtWjN2z = vh49WqTz



































































































            Jfsd1BVW = ZhtWjN2z



































































































            wT4h1rSl = QJQ5Pg6q



































































































            SJTN3sct = dwrC1r4l.item(Jfsd1BVW).worldGeometry



































































































            PQ7z1gl5 = dwrC1r4l.item(wT4h1rSl).worldGeometry



































































































            KL4WgQnW = adsk.core.Point3D.create((SJTN3sct.startPoint.x + SJTN3sct.endPoint.x) / 2, (SJTN3sct.startPoint.y + SJTN3sct.endPoint.y) / 2, (SJTN3sct.startPoint.z + SJTN3sct.endPoint.z) / 2)



































































































            r44kL2w3 = adsk.core.Point3D.create((PQ7z1gl5.startPoint.x + PQ7z1gl5.endPoint.x) / 2, (PQ7z1gl5.startPoint.y + PQ7z1gl5.endPoint.y) / 2, (PQ7z1gl5.startPoint.z + PQ7z1gl5.endPoint.z) / 2)



































































































            HGjPNd2T = adsk.core.Point3D.create((KL4WgQnW.x + r44kL2w3.x) / 2, (KL4WgQnW.y + r44kL2w3.y) / 2, (KL4WgQnW.z + r44kL2w3.z) / 2)



































































































            Jl17LcHz = HGjPNd2T



































































































            FLc42Fb1 = KL4WgQnW



































































































            w4NzLRJ8 = adsk.core.Vector3D.create(Jl17LcHz.x - FLc42Fb1.x, Jl17LcHz.y - FLc42Fb1.y, Jl17LcHz.z - FLc42Fb1.z)



































































































            w4NzLRJ8.normalize()



































































































            ZwNS2R4W.dlCC66hR.setManipulator(FLc42Fb1, w4NzLRJ8)



































































































            ZwNS2R4W.dlCC66hR.value = FLG167Bm



































































































            sf2rZN44 = r44kL2w3



































































































            KRqf3P3Q = adsk.core.Vector3D.create(Jl17LcHz.x - sf2rZN44.x, Jl17LcHz.y - sf2rZN44.y, Jl17LcHz.z - sf2rZN44.z)



































































































            KRqf3P3Q.normalize()



































































































            ZwNS2R4W.GLRnsR36.setManipulator(sf2rZN44, KRqf3P3Q)



































































































            ZwNS2R4W.GLRnsR36.value = jg5Vswsc



































































































            l1Zpd1h3.deleteMe()



































































































            ZwNS2R4W.P1c4gJfR.addSelection(hSzzCCB7)



































































































            if ZwNS2R4W.jfW6CB2p.selectionCount == 0 and lMB54F3t is not None:



































































































                ZwNS2R4W.jfW6CB2p.addSelection(lMB54F3t)



































































































    except Exception:



































































































        qN9pKtLP()



































































































def gtGtR4Z2(wS1Cdn33):



































































































    global cL62qdlC



































































































    global Z9QPzJ73



































































































    global PPs51G4B



































































































    global tflPNvG7



































































































    global ZwNS2R4W



































































































    global FLL52DC8



































































































    global d6GgpZ2G



































































































    global TqnNd8K5



































































































    global D26P8rgj



































































































    try:



































































































        if ZwNS2R4W.jfW6CB2p.selectionCount == 0 or ZwNS2R4W.P1c4gJfR.selectionCount == 0:



































































































            return



































































































        C4qPFFk7 = ZwNS2R4W.jfW6CB2p.selection(0).entity  



































































































        hSzzCCB7 = ZwNS2R4W.P1c4gJfR.selection(0).entity  



































































































        qjFkNh12 = ZwNS2R4W.JMp17LRK.value



































































































        gZzgk1rz = ZwNS2R4W.JMp17LRK.expression



































































































        jbGf9p52 = ZwNS2R4W.m5klvjDJ.value



































































































        dhLkHJqk = ZwNS2R4W.m5klvjDJ.expression



































































































        F3J723q7 = ZwNS2R4W.GvRGVm7D.value



































































































        FdDrMB1L = ZwNS2R4W.GvRGVm7D.expression



































































































        g13wJTcV = ZwNS2R4W.d1H7V1k2.selectedItem.name



































































































        QclPWTn1 = ZwNS2R4W.KBj2qHB2.value



































































































        wgJ26kdV = ZwNS2R4W.KBj2qHB2.expression



































































































        RBl3Qd26 = ZwNS2R4W.Cvv6nT4S.value



































































































        rw4bCR2q = ZwNS2R4W.dlCC66hR.value



































































































        HrFsPC41 = ZwNS2R4W.dlCC66hR.expression



































































































        rKvPh9PQ = ZwNS2R4W.GLRnsR36.value



































































































        nGMd4MTf = ZwNS2R4W.GLRnsR36.expression



































































































        pj43FN6D = ZwNS2R4W.fntr62Mw.value



































































































        FLL52DC8 = ZwNS2R4W.kQJ1W3kk.value



































































































        t7T1T9Js = ZwNS2R4W.Tr6qbTcR.value



































































































        d6GgpZ2G = ZwNS2R4W.SkVhr2pz.value



































































































        VckQgCVZ(wS1Cdn33,



































































































                                     Z9QPzJ73,



































































































                                     PPs51G4B,



































































































                                     tflPNvG7,



































































































                                     C4qPFFk7,



































































































                                     hSzzCCB7,



































































































                                     qjFkNh12,



































































































                                     gZzgk1rz,



































































































                                     jbGf9p52,



































































































                                     dhLkHJqk,



































































































                                     F3J723q7,



































































































                                     FdDrMB1L,



































































































                                     g13wJTcV,



































































































                                     QclPWTn1,



































































































                                     wgJ26kdV,



































































































                                     RBl3Qd26,



































































































                                     rw4bCR2q,



































































































                                     HrFsPC41,



































































































                                     rKvPh9PQ,



































































































                                     nGMd4MTf,



































































































                                     pj43FN6D,



































































































                                     FLL52DC8,



































































































                                     t7T1T9Js,



































































































                                     d6GgpZ2G,



































































































                                     TqnNd8K5,



































































































                                     D26P8rgj)



































































































    except Exception:



































































































        qN9pKtLP()



































































































def VckQgCVZ(wS1Cdn33,



































































































                                 nonRectangularOriginPoint,



































































































                                 areSuppressed,



































































































                                 suppressedList,



































































































                                 C4qPFFk7,



































































































                                 hSzzCCB7,



































































































                                 qjFkNh12,



































































































                                 gZzgk1rz,



































































































                                 jbGf9p52,



































































































                                 dhLkHJqk,



































































































                                 F3J723q7,



































































































                                 FdDrMB1L,



































































































                                 g13wJTcV,



































































































                                 QclPWTn1,



































































































                                 wgJ26kdV,



































































































                                 RBl3Qd26,



































































































                                 rw4bCR2q,



































































































                                 HrFsPC41,



































































































                                 rKvPh9PQ,



































































































                                 nGMd4MTf,



































































































                                 pj43FN6D,



































































































                                 onlyHoles,



































































































                                 t7T1T9Js,



































































































                                 dowelChamfer,



































































































                                 existingDowelJointAfterGroupIndex,



































































































                                 l5C6s6Mv):



































































































    global cL62qdlC



































































































    global p169ZFkB



































































































    global B6b7pZF4



































































































    global Sl81K1p9



































































































    try:



































































































        SCCnSTpn = cL62qdlC.activeProduct  



































































































        ZPfqj7m3 = False



































































































        if SCCnSTpn.designType == adsk.fusion.DesignTypes.ParametricDesignType:



































































































            nWFtrp6n = True



































































































        else:



































































































            nWFtrp6n = False



































































































        if existingDowelJointAfterGroupIndex is not None:



































































































            d9c44dQG = SCCnSTpn.timeline



































































































            d9c44dQG.markerPosition = existingDowelJointAfterGroupIndex



































































































        if l5C6s6Mv is not None:



































































































            l5C6s6Mv.isSuppressed = True



































































































        if not wS1Cdn33 and not onlyHoles:



































































































            JNCsz5nW = SCCnSTpn.rootComponent



































































































            Sl81K1p9 = False



































































































            rmljKVH1 = JNCsz5nW.occurrences.itemByName('Dowels:1')



































































































            if not rmljKVH1:



































































































                mn8PKM73 = JNCsz5nW.occurrences.addNewComponent(adsk.core.Matrix3D.create())



































































































                Sl81K1p9 = True



































































































                mn8PKM73.component.name = 'Dowels'



































































































            else:



































































































                mn8PKM73 = JNCsz5nW.occurrences.itemByName('Dowels:1')



































































































            gj7ss7LT = mn8PKM73.component.occurrences.addNewComponent(adsk.core.Matrix3D.create())



































































































            gj7ss7LT.component.name = 'Dowels'



































































































            n4vcQHR7 = gj7ss7LT.component



































































































        else:



































































































            n4vcQHR7 = hSzzCCB7.body.parentComponent



































































































        J4d7z9s6 = hSzzCCB7.edges



































































































        nb9q224D = n4vcQHR7.sketches



































































































        l1Zpd1h3 = nb9q224D.add(hSzzCCB7)



































































































        l1Zpd1h3.name = 'Dowel Joint'



































































































        l1Zpd1h3.isComputeDeferred = True



































































































        RNkfHh11 = l1Zpd1h3.geometricConstraints



































































































        QkN67N42 = l1Zpd1h3.sketchDimensions



































































































        F1FVH6ts = l1Zpd1h3.sketchCurves.sketchLines



































































































        dcw3g86C = l1Zpd1h3.sketchCurves.sketchCircles



































































































        for GFqbrrvM in l1Zpd1h3.sketchCurves:



































































































            GFqbrrvM.isConstruction = True



































































































        if l1Zpd1h3.sketchCurves.count != 4:



































































































            p6SrpzzK = l1Zpd1h3.sketchCurves.count



































































































            d8cDlDLG = 0.0



































































































            jSDHQD3R = 0



































































































            for R63q39WN in range(p6SrpzzK):



































































































                GFqbrrvM = l1Zpd1h3.sketchCurves.item(R63q39WN)



































































































                GFqbrrvM.isConstruction = True



































































































                if d8cDlDLG < GFqbrrvM.length:



































































































                    d8cDlDLG = GFqbrrvM.length



































































































                    jSDHQD3R = R63q39WN



































































































            d8cDlDLG = 0.0



































































































            SztjHf4F = 0



































































































            for R63q39WN in range(p6SrpzzK):



































































































                GFqbrrvM = l1Zpd1h3.sketchCurves.item(R63q39WN)



































































































                if d8cDlDLG < GFqbrrvM.length and R63q39WN != jSDHQD3R:



































































































                    d8cDlDLG = GFqbrrvM.length



































































































                    SztjHf4F = R63q39WN



































































































            qbg672Dr = l1Zpd1h3.sketchCurves.item(jSDHQD3R)  



































































































            pF28wv6p = l1Zpd1h3.sketchCurves.item(SztjHf4F)  



































































































            V4K6rt6P = adsk.core.Matrix3D.create()



































































































            J1L3gmVd = math.radians(90)



































































































            twlNvbQ4 = adsk.core.Vector3D.create(0, 0, 1)



































































































            RRt3jHN4 = qbg672Dr.startSketchPoint.geometry.copy()



































































































            V4K6rt6P.setToRotation(J1L3gmVd, twlNvbQ4, RRt3jHN4)



































































































            SH9pds17 = qbg672Dr.geometry.asInfiniteLine()



































































































            SH9pds17.transformBy(V4K6rt6P)



































































































            FhwjZP36 = SH9pds17.intersectWithCurve(pF28wv6p.geometry.asInfiniteLine()).item(0)



































































































            k8rl982f = F1FVH6ts.addByTwoPoints(qbg672Dr.startSketchPoint, FhwjZP36)



































































































            tcTrShq2 = adsk.core.Matrix3D.create()



































































































            qCfjn7ST = qbg672Dr.endSketchPoint.geometry.copy()



































































































            tcTrShq2.setToRotation(J1L3gmVd, twlNvbQ4, qCfjn7ST)



































































































            SCtDB943 = qbg672Dr.geometry.asInfiniteLine()



































































































            SCtDB943.transformBy(tcTrShq2)



































































































            pV4HkK2m = SCtDB943.intersectWithCurve(pF28wv6p.geometry.asInfiniteLine()).item(0)



































































































            p9H1KP73 = F1FVH6ts.addByTwoPoints(qbg672Dr.endSketchPoint, pV4HkK2m)



































































































            if t7T1T9Js and not wS1Cdn33:



































































































                RNkfHh11.addPerpendicular(k8rl982f, qbg672Dr)



































































































                RNkfHh11.addCoincident(k8rl982f.endSketchPoint, pF28wv6p)



































































































                RNkfHh11.addPerpendicular(p9H1KP73, qbg672Dr)



































































































                RNkfHh11.addCoincident(p9H1KP73.endSketchPoint, pF28wv6p)



































































































            dwrC1r4l = adsk.core.ObjectCollection.create()



































































































            dwrC1r4l.add(qbg672Dr)



































































































            dwrC1r4l.add(k8rl982f)



































































































            dwrC1r4l.add(p9H1KP73)



































































































            k8rl982f.isConstruction = True



































































































            p9H1KP73.isConstruction = True



































































































            if nonRectangularOriginPoint is not None:



































































































                BbqSHHWl = nonRectangularOriginPoint



































































































            else:



































































































                BbqSHHWl = F1FVH6ts.item(0).startSketchPoint.geometry



































































































        else:



































































































            dwrC1r4l = F1FVH6ts  



































































































            gghzSlmM = J4d7z9s6.item(0).startVertex



































































































            l1Zpd1h3.isComputeDeferred = False



































































































            BbqSHHWl = l1Zpd1h3.project(gghzSlmM).item(0).geometry  



































































































            l1Zpd1h3.isComputeDeferred = True



































































































        HZzW3H3V = dwrC1r4l.count



































































































        Tjh2Hl7L = 10000000.0



































































































        for qPf1Nk77 in range(HZzW3H3V):



































































































            Q32CtRn1 = dwrC1r4l.item(qPf1Nk77)  



































































































            if (Q32CtRn1.length < Tjh2Hl7L):



































































































                Tjh2Hl7L = Q32CtRn1.length



































































































                ZhtWjN2z = qPf1Nk77



































































































        Tjh2Hl7L = 10000000.0



































































































        for qPf1Nk77 in range(HZzW3H3V):



































































































            Q32CtRn1 = dwrC1r4l.item(qPf1Nk77)  



































































































            if (Q32CtRn1.length < Tjh2Hl7L and qPf1Nk77 != ZhtWjN2z):



































































































                Tjh2Hl7L = Q32CtRn1.length



































































































                QJQ5Pg6q = qPf1Nk77



































































































        if BbqSHHWl.distanceTo(dwrC1r4l.item(ZhtWjN2z).startSketchPoint.geometry) > BbqSHHWl.distanceTo(dwrC1r4l.item(QJQ5Pg6q).startSketchPoint.geometry):  



































































































            vh49WqTz = QJQ5Pg6q



































































































            QJQ5Pg6q = ZhtWjN2z



































































































            ZhtWjN2z = vh49WqTz



































































































        Jfsd1BVW = ZhtWjN2z



































































































        wT4h1rSl = QJQ5Pg6q



































































































        SJTN3sct = dwrC1r4l.item(Jfsd1BVW)  



































































































        PQ7z1gl5 = dwrC1r4l.item(wT4h1rSl)  



































































































        KL4WgQnW = adsk.core.Point3D.create((SJTN3sct.geometry.startPoint.x + SJTN3sct.geometry.endPoint.x) / 2, (SJTN3sct.geometry.startPoint.y + SJTN3sct.geometry.endPoint.y) / 2, 0)



































































































        r44kL2w3 = adsk.core.Point3D.create((PQ7z1gl5.geometry.startPoint.x + PQ7z1gl5.geometry.endPoint.x) / 2, (PQ7z1gl5.geometry.startPoint.y + PQ7z1gl5.geometry.endPoint.y) / 2, 0)



































































































        rdKq5W3M = F1FVH6ts.addByTwoPoints(KL4WgQnW, r44kL2w3)



































































































        rdKq5W3M.isConstruction = True



































































































        if (g13wJTcV == "Symmetrical Spacing") and t7T1T9Js and ((rw4bCR2q >= rdKq5W3M.length / 2) or (rKvPh9PQ >= rdKq5W3M.length / 2)):



































































































            if not wS1Cdn33:



































































































                l1Zpd1h3.deleteMe()



































































































                if not onlyHoles:



































































































                    gj7ss7LT.deleteMe()



































































































            return



































































































        if t7T1T9Js and not wS1Cdn33:



































































































            RNkfHh11.addMidPoint(rdKq5W3M.startSketchPoint, SJTN3sct)



































































































            RNkfHh11.addMidPoint(rdKq5W3M.endSketchPoint, PQ7z1gl5)



































































































        if g13wJTcV == 'Spacing from One Side':



































































































            RBl3Qd26 = int((rdKq5W3M.length - rw4bCR2q - rKvPh9PQ) / QclPWTn1) + 1



































































































        if g13wJTcV == 'Symmetrical Spacing':



































































































            HVn31LW7 = int(((rdKq5W3M.length / 2) - rw4bCR2q) / QclPWTn1)



































































































            zwq9jT24 = int(((rdKq5W3M.length / 2) - rKvPh9PQ) / QclPWTn1)



































































































            RBl3Qd26 = HVn31LW7 + zwq9jT24 + 1



































































































        B6b7pZF4 = RBl3Qd26



































































































        KWLn56ZV = KL4WgQnW.vectorTo(r44kL2w3)



































































































        KWLn56ZV.normalize()



































































































        mCMV6n9r = 1.0



































































































        if g13wJTcV == 'Spacing from One Side' and not pj43FN6D:



































































































            mCMV6n9r = rw4bCR2q



































































































        if g13wJTcV == 'Spacing from One Side' and pj43FN6D:



































































































            f4LDpPz3 = int((rdKq5W3M.length - rw4bCR2q - rKvPh9PQ) / QclPWTn1)



































































































            mCMV6n9r = rdKq5W3M.length - rKvPh9PQ - QclPWTn1 * f4LDpPz3



































































































        if g13wJTcV == 'Symmetrical Spacing':



































































































            mCMV6n9r = (rdKq5W3M.length / 2) - HVn31LW7 * QclPWTn1



































































































        if g13wJTcV == 'Number of Dowels':



































































































            mCMV6n9r = rw4bCR2q



































































































        KWLn56ZV.scaleBy(mCMV6n9r)



































































































        nbbdq7sj = KL4WgQnW.copy()



































































































        nbbdq7sj.translateBy(KWLn56ZV)



































































































        L33jwgrl = dcw3g86C.addByCenterRadius(nbbdq7sj, qjFkNh12 / 2)



































































































        if RBl3Qd26 > 1:



































































































            KWLn56ZV.normalize()



































































































            DHVgQBw2 = 1.0



































































































            if g13wJTcV == 'Spacing from One Side' and not pj43FN6D:



































































































                f4LDpPz3 = int((rdKq5W3M.length - rw4bCR2q - rKvPh9PQ) / QclPWTn1)



































































































                DHVgQBw2 = rw4bCR2q + QclPWTn1 * f4LDpPz3



































































































            if g13wJTcV == 'Spacing from One Side' and pj43FN6D:



































































































                DHVgQBw2 = rdKq5W3M.length - rKvPh9PQ



































































































            if g13wJTcV == 'Symmetrical Spacing':



































































































                DHVgQBw2 = (rdKq5W3M.length / 2) + zwq9jT24 * QclPWTn1



































































































            if g13wJTcV == 'Number of Dowels':



































































































                DHVgQBw2 = rdKq5W3M.length - rKvPh9PQ



































































































            KWLn56ZV.scaleBy(DHVgQBw2)



































































































            mPT1kGjh = KL4WgQnW.copy()



































































































            mPT1kGjh.translateBy(KWLn56ZV)



































































































            m25fLCF1 = dcw3g86C.addByCenterRadius(mPT1kGjh, qjFkNh12 / 2)



































































































        WgFvh2P9 = []



































































































        if not wS1Cdn33:



































































































            Gw65k17H = L33jwgrl.centerSketchPoint.geometry.copy()



































































































            Gw65k17H.x = Gw65k17H.x - 3 * qjFkNh12



































































































            Gw65k17H.y = Gw65k17H.y - 3 * qjFkNh12



































































































            kq7SC8p7 = QkN67N42.addDiameterDimension(L33jwgrl, Gw65k17H)



































































































            F421jBPP = kq7SC8p7.parameter



































































































            if F421jBPP:



































































































                F421jBPP.expression = gZzgk1rz



































































































                F421jBPP.attributes.add('MRDowelJoint', 'dowelDia', gZzgk1rz)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'holeDepth', dhLkHJqk)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'dowelLength', FdDrMB1L)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'locationType', g13wJTcV)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'spacing', wgJ26kdV)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'numberOfDowels', str(RBl3Qd26))



































































































                F421jBPP.attributes.add('MRDowelJoint', 'offset1', HrFsPC41)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'offset2', nGMd4MTf)



































































































                F421jBPP.attributes.add('MRDowelJoint', 'flip', str(pj43FN6D))



































































































                F421jBPP.attributes.add('MRDowelJoint', 'holes', str(onlyHoles))



































































































                F421jBPP.attributes.add('MRDowelJoint', 'parametric', str(t7T1T9Js))



































































































                F421jBPP.attributes.add('MRDowelJoint', 'dowelChamfer', str(dowelChamfer))



































































































                F421jBPP.attributes.add('MRDowelJoint', 'areSuppressed', str(areSuppressed))



































































































                if areSuppressed:



































































































                    F421jBPP.attributes.add('MRDowelJoint', 'suppressedList', str(suppressedList))



































































































            else:



































































































                ZPfqj7m3 = True



































































































        if t7T1T9Js and not wS1Cdn33:



































































































            if RBl3Qd26 > 1:



































































































                Gw65k17H = m25fLCF1.centerSketchPoint.geometry.copy()



































































































                Gw65k17H.x = Gw65k17H.x - 3 * qjFkNh12



































































































                Gw65k17H.y = Gw65k17H.y - 3 * qjFkNh12



































































































                mghJWNKB = QkN67N42.addDiameterDimension(m25fLCF1, Gw65k17H)



































































































                if nWFtrp6n:



































































































                    try:



































































































                        mghJWNKB.parameter.expression = kq7SC8p7.parameter.name



































































































                    except Exception:



































































































                        ZPfqj7m3 = True



































































































        if g13wJTcV == 'Number of Dowels':



































































































            jPmGM7Rm = []



































































































        for qPf1Nk77 in range(0, RBl3Qd26 - 2, 1):



































































































            KWLn56ZV.normalize()



































































































            if g13wJTcV == 'Spacing from One Side':



































































































                SDrphgRt = mCMV6n9r + QclPWTn1 * (qPf1Nk77 + 1)



































































































            if g13wJTcV == 'Symmetrical Spacing':



































































































                SDrphgRt = mCMV6n9r + QclPWTn1 * (qPf1Nk77 + 1)



































































































            if g13wJTcV == 'Number of Dowels':



































































































                SDrphgRt = rw4bCR2q + (rdKq5W3M.length - rw4bCR2q - rKvPh9PQ) / (RBl3Qd26 - 1) * (qPf1Nk77 + 1)



































































































            KWLn56ZV.scaleBy(SDrphgRt)



































































































            PT45PMH9 = KL4WgQnW.copy()



































































































            PT45PMH9.translateBy(KWLn56ZV)



































































































            jKlJGGfG = dcw3g86C.addByCenterRadius(PT45PMH9, qjFkNh12 / 2)



































































































            WgFvh2P9.append(jKlJGGfG)



































































































            if t7T1T9Js and not wS1Cdn33:



































































































                if (g13wJTcV == "Spacing from One Side") or (g13wJTcV == 'Symmetrical Spacing'):



































































































                    RNkfHh11.addCoincident(jKlJGGfG.centerSketchPoint, rdKq5W3M)



































































































                if g13wJTcV == 'Number of Dowels':



































































































                    if ((qPf1Nk77 != 0) and (qPf1Nk77 != RBl3Qd26 - 3)) or (qPf1Nk77 == 0 and RBl3Qd26 == 3):



































































































                        RNkfHh11.addCoincident(jKlJGGfG.centerSketchPoint, rdKq5W3M)



































































































                Gw65k17H = jKlJGGfG.centerSketchPoint.geometry.copy()



































































































                Gw65k17H.x = Gw65k17H.x - 3 * qjFkNh12



































































































                Gw65k17H.y = Gw65k17H.y - 3 * qjFkNh12



































































































                pcfGPwCV = QkN67N42.addDiameterDimension(jKlJGGfG, Gw65k17H)



































































































                if nWFtrp6n:



































































































                    try:



































































































                        pcfGPwCV.parameter.expression = kq7SC8p7.parameter.name



































































































                    except Exception:



































































































                        ZPfqj7m3 = True



































































































                if (g13wJTcV == "Spacing from One Side") or (g13wJTcV == 'Symmetrical Spacing'):



































































































                    Gw65k17H = jKlJGGfG.centerSketchPoint.geometry.copy()



































































































                    Gw65k17H.x = Gw65k17H.x + 2 * qjFkNh12



































































































                    Gw65k17H.y = Gw65k17H.y - 4 * qjFkNh12



































































































                if qPf1Nk77 == 0:



































































































                    if (g13wJTcV == "Spacing from One Side") or (g13wJTcV == 'Symmetrical Spacing'):



































































































                        CqbdC7W4 = QkN67N42.addDistanceDimension(jKlJGGfG.centerSketchPoint, L33jwgrl.centerSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                        try:



































































































                            CqbdC7W4.parameter.expression = wgJ26kdV



































































































                        except Exception:



































































































                            ZPfqj7m3 = True



































































































                    if g13wJTcV == 'Number of Dowels':



































































































                        R2qqLgWd = F1FVH6ts.addByTwoPoints(jKlJGGfG.centerSketchPoint, L33jwgrl.centerSketchPoint)



































































































                        R2qqLgWd.isConstruction = True



































































































                        jPmGM7Rm.append(R2qqLgWd)



































































































                if qPf1Nk77 == 1 and RBl3Qd26 > 3:



































































































                    if g13wJTcV == 'Number of Dowels':



































































































                        csDgcGdF = F1FVH6ts.addByTwoPoints(jKlJGGfG.centerSketchPoint, L33jwgrl.centerSketchPoint)



































































































                        csDgcGdF.isConstruction = True



































































































                if qPf1Nk77 > 0:



































































































                    if (g13wJTcV == "Spacing from One Side") or (g13wJTcV == 'Symmetrical Spacing'):



































































































                        stKQdJHS = QkN67N42.addDistanceDimension(jKlJGGfG.centerSketchPoint, WgFvh2P9[qPf1Nk77 - 1].centerSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                        if nWFtrp6n:



































































































                            try:



































































































                                stKQdJHS.parameter.expression = CqbdC7W4.parameter.name



































































































                            except Exception:



































































































                                ZPfqj7m3 = True



































































































                    if g13wJTcV == 'Number of Dowels':



































































































                        R2qqLgWd = F1FVH6ts.addByTwoPoints(jKlJGGfG.centerSketchPoint, WgFvh2P9[qPf1Nk77 - 1].centerSketchPoint)



































































































                        R2qqLgWd.isConstruction = True



































































































                        jPmGM7Rm.append(R2qqLgWd)



































































































                if (qPf1Nk77 == RBl3Qd26 - 3) and (RBl3Qd26 > 1):



































































































                    if (g13wJTcV == "Spacing from One Side") or (g13wJTcV == 'Symmetrical Spacing'):



































































































                        Gw65k17H = m25fLCF1.centerSketchPoint.geometry.copy()



































































































                        Gw65k17H.x = Gw65k17H.x + 2 * qjFkNh12



































































































                        Gw65k17H.y = Gw65k17H.y - 4 * qjFkNh12



































































































                        stKQdJHS = QkN67N42.addDistanceDimension(jKlJGGfG.centerSketchPoint, m25fLCF1.centerSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                        if nWFtrp6n:



































































































                            try:



































































































                                stKQdJHS.parameter.expression = CqbdC7W4.parameter.name



































































































                            except Exception:



































































































                                ZPfqj7m3 = True



































































































                    if g13wJTcV == 'Number of Dowels':



































































































                        R2qqLgWd = F1FVH6ts.addByTwoPoints(jKlJGGfG.centerSketchPoint, m25fLCF1.centerSketchPoint)



































































































                        R2qqLgWd.isConstruction = True



































































































                        jPmGM7Rm.append(R2qqLgWd)



































































































                        J471bhmN = F1FVH6ts.addByTwoPoints(WgFvh2P9[qPf1Nk77 - 1].centerSketchPoint, m25fLCF1.centerSketchPoint)



































































































                        J471bhmN.isConstruction = True



































































































        if t7T1T9Js and not wS1Cdn33:



































































































            RNkfHh11.addCoincident(L33jwgrl.centerSketchPoint, rdKq5W3M)



































































































            if RBl3Qd26 > 1:



































































































                RNkfHh11.addCoincident(m25fLCF1.centerSketchPoint, rdKq5W3M)



































































































            Gw65k17H = L33jwgrl.centerSketchPoint.geometry.copy()



































































































            Gw65k17H.x = Gw65k17H.x + 2 * qjFkNh12



































































































            Gw65k17H.y = Gw65k17H.y - 4 * qjFkNh12



































































































            if (g13wJTcV == "Number of Dowels") or ((g13wJTcV == 'Spacing from One Side') and not pj43FN6D):



































































































                d4lZ7KC1 = QkN67N42.addDistanceDimension(L33jwgrl.centerSketchPoint, rdKq5W3M.startSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                try:



































































































                    d4lZ7KC1.parameter.expression = HrFsPC41



































































































                except Exception:



































































































                    ZPfqj7m3 = True



































































































            if (g13wJTcV == "Symmetrical Spacing") or ((g13wJTcV == 'Spacing from One Side') and pj43FN6D):



































































































                if RBl3Qd26 > 1:



































































































                    d4lZ7KC1 = QkN67N42.addDistanceDimension(L33jwgrl.centerSketchPoint, rdKq5W3M.startSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H, False)  



































































































                    try:



































































































                        d4lZ7KC1.parameter.expression = HrFsPC41



































































































                    except Exception:



































































































                        ZPfqj7m3 = True



































































































                if (RBl3Qd26 == 1) and (g13wJTcV == 'Spacing from One Side'):



































































































                    d4lZ7KC1 = QkN67N42.addDistanceDimension(L33jwgrl.centerSketchPoint, rdKq5W3M.endSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                    try:



































































































                        d4lZ7KC1.parameter.expression = HrFsPC41



































































































                    except Exception:



































































































                        ZPfqj7m3 = True



































































































            Gw65k17H = rdKq5W3M.endSketchPoint.geometry.copy()



































































































            Gw65k17H.x = Gw65k17H.x + 2 * qjFkNh12



































































































            Gw65k17H.y = Gw65k17H.y - 4 * qjFkNh12



































































































            if g13wJTcV == ('Number of Dowels'):



































































































                zfB96NGl = QkN67N42.addDistanceDimension(m25fLCF1.centerSketchPoint, rdKq5W3M.endSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                try:



































































































                    zfB96NGl.parameter.expression = nGMd4MTf



































































































                except Exception:



































































































                    ZPfqj7m3 = True



































































































            if (g13wJTcV == "Symmetrical Spacing") or (g13wJTcV == 'Spacing from One Side'):



































































































                if RBl3Qd26 > 1:



































































































                    if (g13wJTcV == "Symmetrical Spacing") or ((g13wJTcV == 'Spacing from One Side') and not pj43FN6D):



































































































                        zfB96NGl = QkN67N42.addDistanceDimension(m25fLCF1.centerSketchPoint, rdKq5W3M.endSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H, False)  



































































































                        try:



































































































                            zfB96NGl.parameter.expression = nGMd4MTf



































































































                        except Exception:



































































































                            ZPfqj7m3 = True



































































































                    if ((g13wJTcV == 'Spacing from One Side') and pj43FN6D):



































































































                        zfB96NGl = QkN67N42.addDistanceDimension(m25fLCF1.centerSketchPoint, rdKq5W3M.endSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                        try:



































































































                            zfB96NGl.parameter.expression = nGMd4MTf



































































































                        except Exception:



































































































                            ZPfqj7m3 = True



































































































                if RBl3Qd26 == 2:



































































































                    Gw65k17H = m25fLCF1.centerSketchPoint.geometry.copy()



































































































                    Gw65k17H.x = Gw65k17H.x + 2 * qjFkNh12



































































































                    Gw65k17H.y = Gw65k17H.y - 4 * qjFkNh12



































































































                    r7BcKtQP = QkN67N42.addDistanceDimension(L33jwgrl.centerSketchPoint, m25fLCF1.centerSketchPoint, adsk.fusion.DimensionOrientations.AlignedDimensionOrientation, Gw65k17H)  



































































































                    try:



































































































                        r7BcKtQP.parameter.expression = wgJ26kdV



































































































                    except Exception:



































































































                        ZPfqj7m3 = True



































































































            if ZPfqj7m3:



































































































                p169ZFkB.messageBox("Unable to constrain geometry.")



































































































            if g13wJTcV == 'Symmetrical Spacing':



































































































                if RBl3Qd26 > 2:



































































































                    m43M5szR = HVn31LW7 - 1



































































































                    RNkfHh11.addMidPoint(WgFvh2P9[m43M5szR].centerSketchPoint, rdKq5W3M)



































































































                if RBl3Qd26 == 2:



































































































                    if rw4bCR2q > rKvPh9PQ:



































































































                        RNkfHh11.addMidPoint(L33jwgrl.centerSketchPoint, rdKq5W3M)



































































































                    else:



































































































                        RNkfHh11.addMidPoint(m25fLCF1.centerSketchPoint, rdKq5W3M)



































































































                if RBl3Qd26 == 1:



































































































                    RNkfHh11.addMidPoint(L33jwgrl.centerSketchPoint, rdKq5W3M)



































































































            if g13wJTcV == 'Number of Dowels':



































































































                R8Hw6l5M = len(jPmGM7Rm)



































































































                for R63q39WN in range(1, R8Hw6l5M, 1):



































































































                    try:



































































































                        RNkfHh11.addEqual(jPmGM7Rm[R63q39WN], jPmGM7Rm[0])



































































































                    except Exception:



































































































                        pass



































































































            if g13wJTcV == 'Number of Dowels' and RBl3Qd26 > 3:



































































































                try:



































































































                    RNkfHh11.addMidPoint(WgFvh2P9[0].centerSketchPoint, csDgcGdF)



































































































                except Exception:



































































































                    RNkfHh11.addCoincident(WgFvh2P9[0].centerSketchPoint, rdKq5W3M)



































































































                try:



































































































                    RNkfHh11.addMidPoint(WgFvh2P9[RBl3Qd26 - 3].centerSketchPoint, J471bhmN)



































































































                except Exception:



































































































                    RNkfHh11.addCoincident(WgFvh2P9[RBl3Qd26 - 3].centerSketchPoint, rdKq5W3M)



































































































        l1Zpd1h3.isComputeDeferred = False



































































































        jZ9hNCkw = n4vcQHR7.features.extrudeFeatures



































































































        Z79dqh4q = adsk.core.ObjectCollection.create()



































































































        if areSuppressed:



































































































            V2318kV3 = []



































































































            V2318kV3.append(L33jwgrl)



































































































            V2318kV3.extend(WgFvh2P9)



































































































            if RBl3Qd26 > 1:



































































































                V2318kV3.append(m25fLCF1)



































































































            for qPf1Nk77 in range(len(V2318kV3)):



































































































                if suppressedList[qPf1Nk77]:



































































































                    m74dNKND = V2318kV3[qPf1Nk77]



































































































                    n6KkNt5z = m74dNKND.centerSketchPoint.geometry



































































































                    for K63q8wB7 in l1Zpd1h3.profiles:



































































































                        for F5ZrzvW2 in K63q8wB7.profileLoops.item(0).profileCurves:



































































































                            if F5ZrzvW2.geometry.center.distanceTo(n6KkNt5z) < 0.01:  



































































































                                Z79dqh4q.add(K63q8wB7)



































































































                            break



































































































            if wS1Cdn33:



































































































                FGq13Jz7 = SCCnSTpn.rootComponent.customGraphicsGroups



































































































                zS37PJP1 = False



































































































                for fw2WZgrb in FGq13Jz7:



































































































                    if fw2WZgrb.id == 'MRDowelJoint':



































































































                        r34T1f61 = fw2WZgrb



































































































                        zS37PJP1 = True



































































































                        break



































































































                if not zS37PJP1:



































































































                    r34T1f61 = FGq13Jz7.add()



































































































                    r34T1f61.id = 'MRDowelJoint'



































































































                    r34T1f61.billBoarding = adsk.fusion.CustomGraphicsBillBoard.create(adsk.core.Point3D.create(0, 0, 0))



































































































                    r34T1f61.viewScale = adsk.fusion.CustomGraphicsViewScale.create(1, adsk.core.Point3D.create(0, 0, 0))



































































































                    r34T1f61.depthPriority = 10



































































































                try:



































































































                    for qPf1Nk77 in range(len(V2318kV3)):



































































































                        Kbl4P4g6 = V2318kV3[qPf1Nk77]



































































































                        rH57MzT4 = Fnljrl6Z(Kbl4P4g6.centerSketchPoint.worldGeometry, hSzzCCB7)



































































































                        scZ34p7m = adsk.core.Matrix3D.create()



































































































                        scZ34p7m.translation = rH57MzT4.asVector()



































































































                        r34T1f61.addText(str(qPf1Nk77 + 1), 'Arial', 16, scZ34p7m)



































































































                except Exception:



































































































                    pass



































































































        else:



































































































            for qPf1Nk77 in range(l1Zpd1h3.profiles.count):



































































































                Z79dqh4q.add(l1Zpd1h3.profiles.item(qPf1Nk77))



































































































        if Z79dqh4q.count > 0:



































































































            jk46Pfrg = adsk.core.ValueInput.createByString("0 deg")



































































































            KCkh1rKJ = jZ9hNCkw.createInput(Z79dqh4q, adsk.fusion.FeatureOperations.CutFeatureOperation)  



































































































            if t7T1T9Js and not wS1Cdn33:



































































































                tC7C55jl = adsk.fusion.DistanceExtentDefinition.create(adsk.core.ValueInput.createByString(dhLkHJqk))



































































































                B5B1ZRM3 = adsk.fusion.DistanceExtentDefinition.create(adsk.core.ValueInput.createByString(FdDrMB1L + "- (" + dhLkHJqk + ')'))



































































































            else:



































































































                tC7C55jl = adsk.fusion.DistanceExtentDefinition.create(adsk.core.ValueInput.createByReal(jbGf9p52))



































































































                B5B1ZRM3 = adsk.fusion.DistanceExtentDefinition.create(adsk.core.ValueInput.createByReal(F3J723q7 - jbGf9p52))



































































































            if not wS1Cdn33:



































































































                KCkh1rKJ.setTwoSidesExtent(tC7C55jl, B5B1ZRM3, jk46Pfrg, jk46Pfrg)



































































































                KCkh1rKJ.participantBodies = [hSzzCCB7.body, C4qPFFk7]



































































































                Ckj577Sb = jZ9hNCkw.add(KCkh1rKJ)



































































































                Ckj577Sb.name = 'Extrude Dowel Holes'



































































































            if not onlyHoles:



































































































                CnL6QP8D = jZ9hNCkw.createInput(Z79dqh4q, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)  



































































































                CnL6QP8D.setTwoSidesExtent(tC7C55jl, B5B1ZRM3, jk46Pfrg, jk46Pfrg)



































































































                WCNn71Fm = jZ9hNCkw.add(CnL6QP8D)



































































































                if not wS1Cdn33:



































































































                    WCNn71Fm.name = 'Extrude Dowels'



































































































                if not wS1Cdn33 and dowelChamfer and ((rw4bCR2q + rKvPh9PQ) < rdKq5W3M.length):



































































































                    T6k5Mv1D = adsk.core.ValueInput.createByReal(qjFkNh12 / 8)



































































































                    ctKBw71w = n4vcQHR7.features.chamferFeatures



































































































                    Q2CzMJ2F = adsk.core.ObjectCollection.create()



































































































                    for qPf1Nk77 in range(Z79dqh4q.count):



































































































                        Q2CzMJ2F.add(WCNn71Fm.bodies.item(qPf1Nk77).edges.item(0))



































































































                        Q2CzMJ2F.add(WCNn71Fm.bodies.item(qPf1Nk77).edges.item(1))



































































































                    ZsD3hcD6 = ctKBw71w.createInput2()



































































































                    ZsD3hcD6.chamferEdgeSets.addEqualDistanceChamferEdgeSet(Q2CzMJ2F, T6k5Mv1D, True)



































































































                    ctKBw71w.add(ZsD3hcD6)



































































































                if not wS1Cdn33:



































































































                    l1J7WV12 = cL62qdlC.materialLibraries



































































































                    ql2n1jTN = l1J7WV12.itemByName('Fusion 360 Material Library')



































































































                    if ql2n1jTN:



































































































                        VKrCvS55 = ql2n1jTN.materials.itemByName('Pine')



































































































                        WCNn71Fm.parentComponent.material = VKrCvS55



































































































                if wS1Cdn33:



































































































                    if areSuppressed:



































































































                        WCNn71Fm.parentComponent.opacity = 0.5



































































































        else:



































































































            l1Zpd1h3.isVisible = False



































































































    except Exception:



































































































        qN9pKtLP()



































































































def WJzw4t6T():



































































































    global cL62qdlC



































































































    global p169ZFkB



































































































    global FLL52DC8



































































































    global d6GgpZ2G



































































































    global lMB54F3t



































































































    global s15BhdVN



































































































    global PPs51G4B



































































































    global tflPNvG7



































































































    global p591sr8r



































































































    global TqnNd8K5



































































































    global D26P8rgj



































































































    global ZwNS2R4W



































































































    try:



































































































        SCCnSTpn = cL62qdlC.activeProduct  



































































































        d9c44dQG = SCCnSTpn.timeline



































































































        bKg8s7qj = ZwNS2R4W.D9s2QnJf.selection(0).entity



































































































        D26P8rgj = bKg8s7qj.timelineObject.parentGroup  



































































































        Q66BPtdt = None



































































































        hSzzCCB7 = None



































































































        gZzgk1rz = ''



































































































        dhLkHJqk = ''



































































































        FdDrMB1L = ''



































































































        g13wJTcV = 'Number of Dowels'



































































































        wgJ26kdV = ''



































































































        RBl3Qd26 = 0



































































































        HrFsPC41 = ''



































































































        nGMd4MTf = ''



































































































        pj43FN6D = False



































































































        FLL52DC8 = False



































































































        t7T1T9Js = False



































































































        d6GgpZ2G = False



































































































        PPs51G4B = False



































































































        rdLfSV7L = None



































































































        if D26P8rgj.item(1).entity.objectType == adsk.fusion.Sketch.classType():



































































































            l1Zpd1h3 = D26P8rgj.item(1).entity



































































































        elif D26P8rgj.item(0).entity.objectType == adsk.fusion.Sketch.classType():



































































































            l1Zpd1h3 = D26P8rgj.item(0).entity



































































































        else:



































































































            return



































































































        tQNMsZ1W = l1Zpd1h3.sketchDimensions



































































































        for Jj6789GV in tQNMsZ1W:



































































































            if Jj6789GV.objectType == adsk.fusion.SketchDiameterDimension.classType():



































































































                try:



































































































                    Htqw95CP = Jj6789GV.parameter.attributes



































































































                    if Htqw95CP.itemByName('MRDowelJoint', 'dowelDia'):



































































































                        rdLfSV7L = Htqw95CP



































































































                        break



































































































                except Exception:



































































































                    p169ZFkB.messageBox("Unable to read the dowel joint.")



































































































        if rdLfSV7L is not None:



































































































            gZzgk1rz = rdLfSV7L.itemByName('MRDowelJoint', 'dowelDia').value



































































































            dhLkHJqk = rdLfSV7L.itemByName('MRDowelJoint', 'holeDepth').value



































































































            FdDrMB1L = rdLfSV7L.itemByName('MRDowelJoint', 'dowelLength').value



































































































            g13wJTcV = rdLfSV7L.itemByName('MRDowelJoint', 'locationType').value



































































































            wgJ26kdV = rdLfSV7L.itemByName('MRDowelJoint', 'spacing').value



































































































            RBl3Qd26 = int(rdLfSV7L.itemByName('MRDowelJoint', 'numberOfDowels').value)



































































































            HrFsPC41 = rdLfSV7L.itemByName('MRDowelJoint', 'offset1').value



































































































            nGMd4MTf = rdLfSV7L.itemByName('MRDowelJoint', 'offset2').value



































































































            pj43FN6D = F2SQPL65(rdLfSV7L.itemByName('MRDowelJoint', 'flip').value)  



































































































            FLL52DC8 = F2SQPL65(rdLfSV7L.itemByName('MRDowelJoint', 'holes').value)  



































































































            t7T1T9Js = F2SQPL65(rdLfSV7L.itemByName('MRDowelJoint', 'parametric').value)  



































































































            d6GgpZ2G = F2SQPL65(rdLfSV7L.itemByName('MRDowelJoint', 'dowelChamfer').value)  



































































































            PPs51G4B = F2SQPL65(rdLfSV7L.itemByName('MRDowelJoint', 'areSuppressed').value)  



































































































            if PPs51G4B:



































































































                tflPNvG7 = []



































































































                T1RnVfpM = rdLfSV7L.itemByName('MRDowelJoint', 'suppressedList').value[1:-1].split(', ')



































































































                for wj3TRbDr in T1RnVfpM:



































































































                    tflPNvG7.append(F2SQPL65(wj3TRbDr))



































































































        if D26P8rgj.isCollapsed:



































































































            D26P8rgj.rollTo(True)



































































































            TqnNd8K5 = d9c44dQG.markerPosition + 1



































































































        else:



































































































            bKg8s7qj.timelineObject.rollTo(True)  



































































































            TqnNd8K5 = d9c44dQG.markerPosition + D26P8rgj.count



































































































        RlKhcwhG = None  



































































































        if D26P8rgj.item(1).entity.objectType == adsk.fusion.ExtrudeFeature.classType():



































































































            RlKhcwhG = D26P8rgj.item(1).entity



































































































        elif D26P8rgj.count > 2 and D26P8rgj.item(2).entity.objectType == adsk.fusion.ExtrudeFeature.classType():



































































































            RlKhcwhG = D26P8rgj.item(2).entity



































































































        else:



































































































            return



































































































        hSzzCCB7 = l1Zpd1h3.referencePlane



































































































        s15BhdVN = hSzzCCB7.body



































































































        tbmR5ZNf = len(RlKhcwhG.participantBodies)



































































































        TSm72FhG = None



































































































        if tbmR5ZNf == 2:



































































































            sk11Zg71 = RlKhcwhG.participantBodies[0]



































































































            if not sk11Zg71.physicalProperties.centerOfMass.isEqualTo(s15BhdVN.physicalProperties.centerOfMass):  



































































































                TSm72FhG = sk11Zg71



































































































            else:



































































































                TSm72FhG = RlKhcwhG.participantBodies[1]



































































































        elif tbmR5ZNf == 1:



































































































            TSm72FhG = RlKhcwhG.participantBodies[0]



































































































        D26P8rgj.isSuppressed = True



































































































        ZwNS2R4W.jfW6CB2p.clearSelection()



































































































        lMB54F3t = None



































































































        if TSm72FhG is not None:



































































































            Q66BPtdt = Fg9WMS7K(TSm72FhG)



































































































            try:



































































































                ZwNS2R4W.jfW6CB2p.addSelection(Q66BPtdt)



































































































                lMB54F3t = Q66BPtdt



































































































            except Exception:



































































































                pass



































































































        ZwNS2R4W.P1c4gJfR.clearSelection()



































































































        ZwNS2R4W.P1c4gJfR.addSelection(hSzzCCB7)



































































































        Rj535NrH = 2



































































































        if g13wJTcV == 'Spacing from One Side':



































































































            Rj535NrH = 0



































































































        elif g13wJTcV == 'Symmetrical Spacing':



































































































            Rj535NrH = 1



































































































        elif g13wJTcV == 'Number of Dowels':



































































































            Rj535NrH = 2



































































































        ZwNS2R4W.d1H7V1k2.listItems.item(Rj535NrH).isSelected = True



































































































        if gZzgk1rz != '':



































































































            try:



































































































                ZwNS2R4W.JMp17LRK.expression = gZzgk1rz



































































































            except Exception:



































































































                pass



































































































            try:



































































































                ZwNS2R4W.m5klvjDJ.expression = dhLkHJqk



































































































            except Exception:



































































































                pass



































































































            try:



































































































                ZwNS2R4W.GvRGVm7D.expression = FdDrMB1L



































































































            except Exception:



































































































                pass



































































































            try:



































































































                ZwNS2R4W.KBj2qHB2.expression = wgJ26kdV



































































































            except Exception:



































































































                pass



































































































            ZwNS2R4W.Cvv6nT4S.value = RBl3Qd26



































































































            try:



































































































                ZwNS2R4W.dlCC66hR.expression = HrFsPC41



































































































            except Exception:



































































































                pass



































































































            try:



































































































                ZwNS2R4W.GLRnsR36.expression = nGMd4MTf



































































































            except Exception:



































































































                pass



































































































            ZwNS2R4W.fntr62Mw.value = pj43FN6D



































































































            ZwNS2R4W.kQJ1W3kk.value = FLL52DC8  



































































































            ZwNS2R4W.Tr6qbTcR.value = t7T1T9Js



































































































            ZwNS2R4W.SkVhr2pz.value = d6GgpZ2G



































































































        if PPs51G4B:



































































































            ZwNS2R4W.j7ZGQ7m6.isEnabledCheckBoxChecked = PPs51G4B



































































































            jBzgm24S(True)



































































































        ZwNS2R4W.D9s2QnJf.clearSelection()



































































































        if ZwNS2R4W.P1c4gJfR.selectionCount != 0:



































































































            GL2N2513()



































































































        zvCJLGzL()



































































































    except Exception:



































































































        qN9pKtLP()



































































































def Vhssm1gV():



































































































    try:



































































































        global p169ZFkB



































































































        global wq6D3162



































































































        global QJQwj7K7



































































































        if p169ZFkB.palettes.itemById('dowelJointMRHelpPalette'):



































































































            p169ZFkB.palettes.itemById('dowelJointMRHelpPalette').deleteMe()



































































































            wq6D3162.clear()



































































































        Lm5MVNn6 = p169ZFkB.palettes.add('dowelJointMRHelpPalette', 'Dowel Joint Help', QJQwj7K7 + 'Resources/Help/Help.html', True, True, True, 400, 525)



































































































        Lm5MVNn6.setPosition(5, 300)



































































































        if len(wq6D3162) == 0:



































































































            mp41sz25 = WGv9M3Pw()



































































































            Lm5MVNn6.incomingFromHTML.add(mp41sz25)



































































































            wq6D3162.append(mp41sz25)



































































































    except Exception:



































































































        qN9pKtLP()



































































































class BPdg8Hbp(adsk.core.CommandCreatedEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, j7kLD7nV):



































































































        try:



































































































            global cL62qdlC



































































































            global p169ZFkB



































































































            global P6KQF3wm



































































































            global lMB54F3t



































































































            global s15BhdVN



































































































            global tflPNvG7



































































































            global p591sr8r



































































































            global PPs51G4B



































































































            global TqnNd8K5



































































































            global D26P8rgj



































































































            global B6b7pZF4



































































































            global p1wP7Jl7



































































































            global wq6D3162



































































































            global Sl81K1p9



































































































            global kgmD6nNg



































































































            global f1DG2PWg



































































































            global kcPDHw12



































































































            global ZwNS2R4W



































































































            global BKhfFwk7



































































































            global QJQwj7K7



































































































            CV8r5rTR = False



































































































            lMB54F3t = None



































































































            s15BhdVN = None



































































































            B6b7pZF4 = 0



































































































            tflPNvG7 = []



































































































            PPs51G4B = False



































































































            kgmD6nNg = True



































































































            TqnNd8K5 = None



































































































            D26P8rgj = None



































































































            wq6D3162 = []



































































































            Sl81K1p9 = False



































































































            sv874cfs = j7kLD7nV.command



































































































            sv874cfs.isPositionDependent = True



































































































            SCCnSTpn = cL62qdlC.activeProduct  



































































































            if SCCnSTpn.designType != adsk.fusion.DesignTypes.ParametricDesignType:



































































































                FFLF3ffF = p169ZFkB.messageBox('<div align="left">Parametric design needs to be active to execute Dowel Joint. Would you like to change to the parametric design?', 'Dowel Joint', adsk.core.MessageBoxButtonTypes.YesNoCancelButtonType, adsk.core.MessageBoxIconTypes.QuestionIconType)  



































































































                if FFLF3ffF == adsk.core.DialogResults.DialogYes:



































































































                    SCCnSTpn.designType = adsk.fusion.DesignTypes.ParametricDesignType  



































































































                else:



































































































                    return None



































































































            q5fbft8N = mqN834w4()



































































































            if q5fbft8N:



































































































                kcPDHw12 = q5fbft8N



































































































            z6Z9Cnn8 = SCCnSTpn.unitsManager.defaultLengthUnits



































































































            tflPNvG7 = [True for x in range(p591sr8r)]



































































































            qd7LfHBp = GKvgKwgK()



































































































            if qd7LfHBp:



































































































                if len(qd7LfHBp) == 13:



































































































                    CV8r5rTR = True



































































































            gm83dVfh = sv874cfs.commandInputs



































































































            P6KQF3wm = gm83dVfh



































































































            ZwNS2R4W = H44bB1GG()



































































































            ZwNS2R4W.Ghjt2RRG = gm83dVfh.addTabCommandInput('tabCreate', 'Create')



































































































            ZwNS2R4W.KkqWNNQ8 = gm83dVfh.addTabCommandInput('tabEdit', 'Edit')



































































































            ZwNS2R4W.jfW6CB2p = gm83dVfh.addSelectionInput('selectionBoard', 'Board', 'Select board to cut')



































































































            ZwNS2R4W.jfW6CB2p.setSelectionLimits(0, 1)



































































































            ZwNS2R4W.jfW6CB2p.addSelectionFilter('SolidBodies')



































































































            ZwNS2R4W.jfW6CB2p.tooltip = 'Select board to cut.'



































































































            ZwNS2R4W.jfW6CB2p.toolClipFilename = QJQwj7K7 + 'Resources/Board.png'



































































































            ZwNS2R4W.P1c4gJfR = gm83dVfh.addSelectionInput('selectionFace', 'Face', 'Select face')



































































































            ZwNS2R4W.P1c4gJfR.setSelectionLimits(0, 1)



































































































            ZwNS2R4W.P1c4gJfR.addSelectionFilter('PlanarFaces')



































































































            ZwNS2R4W.P1c4gJfR.tooltip = 'Select face.'



































































































            ZwNS2R4W.P1c4gJfR.toolClipFilename = QJQwj7K7 + 'Resources/Face.png'



































































































            ZwNS2R4W.D9s2QnJf = gm83dVfh.addSelectionInput('existingDowelJoint', 'Existing Dowel Joint', 'Select an existing dowel joint in the timeline to edit.')



































































































            ZwNS2R4W.D9s2QnJf.setSelectionLimits(0, 1)



































































































            ZwNS2R4W.D9s2QnJf.tooltip = 'Select an existing dowel joint in the timeline to edit.'



































































































            ZwNS2R4W.D9s2QnJf.toolClipFilename = QJQwj7K7 + 'Resources/Select.png'



































































































            ZwNS2R4W.D9s2QnJf.isVisible = False



































































































            ZwNS2R4W.D9s2QnJf.isEnabled = False



































































































            ZwNS2R4W.JMp17LRK = gm83dVfh.addValueInput('dowelDia', 'Dowel Diameter', z6Z9Cnn8, adsk.core.ValueInput.createByReal(0.6))



































































































            ZwNS2R4W.JMp17LRK.minimumValue = 0



































































































            ZwNS2R4W.JMp17LRK.isMinimumInclusive = False



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.JMp17LRK.expression = qd7LfHBp[0]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.m5klvjDJ = gm83dVfh.addValueInput('holeDepth', 'Hole Depth', z6Z9Cnn8, adsk.core.ValueInput.createByReal(1.0))



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.m5klvjDJ.expression = qd7LfHBp[1]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.GvRGVm7D = gm83dVfh.addValueInput('dowelLength', 'Dowel Length', z6Z9Cnn8, adsk.core.ValueInput.createByReal(3.0))



































































































            ZwNS2R4W.GvRGVm7D.minimumValue = 0



































































































            ZwNS2R4W.GvRGVm7D.isMinimumInclusive = False



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.GvRGVm7D.expression = qd7LfHBp[2]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.d1H7V1k2 = gm83dVfh.addDropDownCommandInput('locationType', 'Location Type', adsk.core.DropDownStyles.TextListDropDownStyle)  



































































































            PDmP5Dqt = ZwNS2R4W.d1H7V1k2.listItems



































































































            PDmP5Dqt.add('Spacing from One Side', True, '')



































































































            PDmP5Dqt.add('Symmetrical Spacing', False, '')



































































































            PDmP5Dqt.add('Number of Dowels', False, '')



































































































            if CV8r5rTR:



































































































                if int(qd7LfHBp[3]) == 0:



































































































                    ZwNS2R4W.d1H7V1k2.listItems.item(0).isSelected = True



































































































                if int(qd7LfHBp[3]) == 1:



































































































                    ZwNS2R4W.d1H7V1k2.listItems.item(1).isSelected = True



































































































                if int(qd7LfHBp[3]) == 2:



































































































                    ZwNS2R4W.d1H7V1k2.listItems.item(2).isSelected = True



































































































            ZwNS2R4W.KBj2qHB2 = gm83dVfh.addValueInput('spacing', 'Spacing', z6Z9Cnn8, adsk.core.ValueInput.createByReal(3.2))



































































































            ZwNS2R4W.KBj2qHB2.minimumValue = 0



































































































            ZwNS2R4W.KBj2qHB2.isMinimumInclusive = False



































































































            if ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Number of Dowels':



































































































                ZwNS2R4W.KBj2qHB2.isEnabled = False



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.KBj2qHB2.expression = qd7LfHBp[4]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.Cvv6nT4S = gm83dVfh.addIntegerSpinnerCommandInput('numberOfDowels', 'Number of Dowels', 2, 300, 1, 3)



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.Cvv6nT4S.value = int(qd7LfHBp[5])



































































































                except Exception:



































































































                    pass



































































































            if not ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Number of Dowels':



































































































                ZwNS2R4W.Cvv6nT4S.isEnabled = False



































































































            ZwNS2R4W.dlCC66hR = gm83dVfh.addDistanceValueCommandInput('offset1', 'Offset 1', adsk.core.ValueInput.createByReal(1.0))



































































































            ZwNS2R4W.dlCC66hR.minimumValue = 0.01



































































































            ZwNS2R4W.dlCC66hR.isEnabled = False



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.dlCC66hR.expression = qd7LfHBp[6]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.GLRnsR36 = gm83dVfh.addDistanceValueCommandInput('offset2', 'Offset 2', adsk.core.ValueInput.createByReal(1.0))



































































































            ZwNS2R4W.GLRnsR36.minimumValue = 0.01



































































































            ZwNS2R4W.GLRnsR36.isEnabled = False



































































































            if CV8r5rTR:



































































































                try:



































































































                    ZwNS2R4W.GLRnsR36.expression = qd7LfHBp[7]



































































































                except Exception:



































































































                    pass



































































































            ZwNS2R4W.fntr62Mw = gm83dVfh.addBoolValueInput('flip', 'Flip Side', True, '', False)



































































































            if not ZwNS2R4W.d1H7V1k2.selectedItem.name == 'Spacing from One Side':



































































































                ZwNS2R4W.fntr62Mw.isEnabled = False



































































































            if CV8r5rTR:



































































































                ZwNS2R4W.fntr62Mw.value = bool(qd7LfHBp[8])



































































































            ZwNS2R4W.kQJ1W3kk = gm83dVfh.addBoolValueInput('holes', 'Only Holes', True, '', False)



































































































            ZwNS2R4W.kQJ1W3kk.tooltip = "Creates only holes without dowels."



































































































            if CV8r5rTR:



































































































                ZwNS2R4W.kQJ1W3kk.value = bool(qd7LfHBp[9])



































































































            ZwNS2R4W.Tr6qbTcR = gm83dVfh.addBoolValueInput('parametric', 'Constrained', True, '', False)



































































































            ZwNS2R4W.Tr6qbTcR.tooltip = 'Creates constrained geometry. The constrained geometry calculates longer, \nbut it better follows the changes in the board and face dimensions.'



































































































            if CV8r5rTR:



































































































                ZwNS2R4W.Tr6qbTcR.value = bool(qd7LfHBp[10])



































































































            ZwNS2R4W.PkPj6wfk = gm83dVfh.addBoolValueInput('parametricDisabled', 'Constrained', True, '', False)



































































































            ZwNS2R4W.PkPj6wfk.isEnabled = False



































































































            ZwNS2R4W.PkPj6wfk.isVisible = False



































































































            ZwNS2R4W.JSdvj575 = gm83dVfh.addBoolValueInput('preview', 'Preview', True, '', True)



































































































            if CV8r5rTR:



































































































                ZwNS2R4W.JSdvj575.value = bool(qd7LfHBp[11])



































































































            gm83dVfh.addBoolValueInput('helpButton', 'Help', False, QJQwj7K7 + 'Resources/Help', False)



































































































            if kcPDHw12 is False:



































































































                ZwNS2R4W.tcc9nT4f = gm83dVfh.addTextBoxCommandInput('readonlyTextBox', '', '<div align="left">The trial is limited to a preview. You can buy a license at <a href="https://maciejrogowski.com/">maciejrogowski.com</a></div>', 3, True)



































































































                ZwNS2R4W.Wn6ZCbfm = gm83dVfh.addTextBoxCommandInput('validKeyTextBox', '', 'The license key is valid.', 3, True)



































































































                ZwNS2R4W.Wn6ZCbfm.isVisible = False



































































































                ZwNS2R4W.dLK6wJfD = gm83dVfh.addStringValueInput('key', 'License Key', '')



































































































                ZwNS2R4W.dLK6wJfD.tooltip = "Forgot your license key? Contact us at info@maciejrogowski.com. We are here to help you."



































































































            ZwNS2R4W.j7ZGQ7m6 = gm83dVfh.addGroupCommandInput('suppressGroup', 'Suppress')



































































































            ZwNS2R4W.j7ZGQ7m6.isExpanded = False



































































































            ZwNS2R4W.j7ZGQ7m6.isEnabledCheckBoxDisplayed = True



































































































            ZwNS2R4W.j7ZGQ7m6.isEnabledCheckBoxChecked = False



































































































            H55LMFpL = ZwNS2R4W.j7ZGQ7m6.children



































































































            ZwNS2R4W.Kbw14qw6 = H55LMFpL.addTableCommandInput('suppressTable', 'Suppress', 2, '1:5')



































































































            h84s8W5L = ZwNS2R4W.Kbw14qw6.commandInputs



































































































            for qPf1Nk77 in range(p591sr8r):



































































































                Q4L4tbQ1 = h84s8W5L.addStringValueInput("suppressText" + str(qPf1Nk77 + 1), str(qPf1Nk77 + 1), str(qPf1Nk77 + 1))



































































































                Q4L4tbQ1.isReadOnly = True



































































































                Q4L4tbQ1.isVisible = False



































































































                ZwNS2R4W.Kbw14qw6.addCommandInput(Q4L4tbQ1, qPf1Nk77, 0)



































































































                TgtF9c1n = h84s8W5L.addBoolValueInput("suppressBool" + str(qPf1Nk77 + 1), str(qPf1Nk77 + 1), True, '', True)



































































































                TgtF9c1n.isVisible = False



































































































                ZwNS2R4W.Kbw14qw6.addCommandInput(TgtF9c1n, qPf1Nk77, 1)



































































































            S9bFWD5r = gm83dVfh.addGroupCommandInput('settingsGroup', 'Settings')



































































































            S9bFWD5r.isExpanded = False



































































































            S9bFWD5r.isEnabledCheckBoxDisplayed = False



































































































            npP7hCg4 = S9bFWD5r.children



































































































            ZwNS2R4W.SkVhr2pz = npP7hCg4.addBoolValueInput('dowelChamfer', 'Dowel Chamfer', True, '', True)



































































































            if CV8r5rTR:



































































































                ZwNS2R4W.SkVhr2pz.value = bool(qd7LfHBp[12])



































































































            PvmGG6GB = Jj52dk3c()



































































































            sv874cfs.preSelect.add(PvmGG6GB)



































































































            p1wP7Jl7.append(PvmGG6GB)



































































































            ZqQQznHM = cHk88dw1()



































































































            sv874cfs.inputChanged.add(ZqQQznHM)



































































































            p1wP7Jl7.append(ZqQQznHM)



































































































            w1R33pGS = Fd5VHRJV()



































































































            sv874cfs.keyDown.add(w1R33pGS)



































































































            p1wP7Jl7.append(w1R33pGS)



































































































            V3JJ6b5n = tgSDS4Cz()



































































































            sv874cfs.validateInputs.add(V3JJ6b5n)



































































































            p1wP7Jl7.append(V3JJ6b5n)



































































































            z3K3V9sv = QB9cqm6r()



































































































            sv874cfs.executePreview.add(z3K3V9sv)



































































































            p1wP7Jl7.append(z3K3V9sv)



































































































            l8P1p8pd = phQ37n32()



































































































            sv874cfs.execute.add(l8P1p8pd)



































































































            p1wP7Jl7.append(l8P1p8pd)



































































































            WBTbM46k = pJS6qpL1()



































































































            sv874cfs.destroy.add(WBTbM46k)



































































































            p1wP7Jl7.append(WBTbM46k)



































































































        except Exception:



































































































            qN9pKtLP()



































































































class Jj52dk3c(adsk.core.SelectionEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, gr2bWCKM):



































































































        try:



































































































            nsv977v6 = gr2bWCKM.activeInput



































































































            QnFvdcFP = gr2bWCKM.selection.entity



































































































            if nsv977v6.id == 'existingDowelJoint':



































































































                try:



































































































                    zrLqH3ZF = QnFvdcFP.objectType != adsk.fusion.Occurrence.classType() or QnFvdcFP.name[:6] != "Dowels" or QnFvdcFP.component.sketches.count == 0 or QnFvdcFP.component.sketches.item(0).name != 'Dowel Joint'  



































































































                    zrLqH3ZF = zrLqH3ZF or QnFvdcFP.timelineObject.parentGroup.name != "Dowel Joint"  



































































































                    z3rplN6c = QnFvdcFP.objectType != adsk.fusion.Sketch.classType() or QnFvdcFP.name[:11] != "Dowel Joint" or QnFvdcFP.timelineObject.parentGroup.name != 'Dowel Joint' or QnFvdcFP.timelineObject.parentGroup.isCollapsed is False  



































































































                    if zrLqH3ZF and z3rplN6c:



































































































                        gr2bWCKM.isSelectable = False



































































































                        return



































































































                    if F6Dn2jTn(QnFvdcFP):



































































































                        gr2bWCKM.isSelectable = False



































































































                except Exception:



































































































                    gr2bWCKM.isSelectable = False



































































































            if nsv977v6.id == "selectionBoard" or nsv977v6.id == 'selectionFace':



































































































                if F6Dn2jTn(QnFvdcFP):



































































































                    gr2bWCKM.isSelectable = False



































































































        except Exception:



































































































            qN9pKtLP()



































































































class cHk88dw1(adsk.core.InputChangedEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, gr2bWCKM):



































































































        try:



































































































            gm83dVfh = gr2bWCKM.inputs



































































































            HVLm722j = gr2bWCKM.input.id



































































































            global p169ZFkB



































































































            global cL62qdlC



































































































            global lMB54F3t



































































































            global s15BhdVN



































































































            global PPs51G4B



































































































            global Z9QPzJ73



































































































            global kgmD6nNg



































































































            global TqnNd8K5



































































































            global D26P8rgj



































































































            global kcPDHw12



































































































            global f1DG2PWg



































































































            global ZwNS2R4W



































































































            if ZwNS2R4W.jfW6CB2p:



































































































                if HVLm722j == "APITabBar" and not kgmD6nNg and gm83dVfh.itemById('tabCreate'):



































































































                    if ZwNS2R4W.Ghjt2RRG.isActive:



































































































                        kgmD6nNg = True



































































































                        ZwNS2R4W.jfW6CB2p.isVisible = True



































































































                        ZwNS2R4W.P1c4gJfR.isVisible = True



































































































                        ZwNS2R4W.D9s2QnJf.isVisible = False



































































































                        ZwNS2R4W.D9s2QnJf.isEnabled = False



































































































                        TqnNd8K5 = None



































































































                        D26P8rgj = None



































































































                        ZwNS2R4W.D9s2QnJf.clearSelection()



































































































                        ZwNS2R4W.jfW6CB2p.clearSelection()



































































































                        ZwNS2R4W.P1c4gJfR.clearSelection()



































































































                        ZwNS2R4W.JMp17LRK.isEnabled = True



































































































                        ZwNS2R4W.m5klvjDJ.isEnabled = True



































































































                        ZwNS2R4W.GvRGVm7D.isEnabled = True



































































































                        ZwNS2R4W.d1H7V1k2.isEnabled = True



































































































                        ZwNS2R4W.kQJ1W3kk.isEnabled = True



































































































                        ZwNS2R4W.Tr6qbTcR.isEnabled = True



































































































                        ZwNS2R4W.j7ZGQ7m6.isEnabled = True



































































































                        ZwNS2R4W.dlCC66hR.isEnabled = False



































































































                        ZwNS2R4W.GLRnsR36.isEnabled = False



































































































                        ZwNS2R4W.KBj2qHB2.isVisible = True



































































































                        ZwNS2R4W.Cvv6nT4S.isVisible = True



































































































                if HVLm722j == "APITabBar" and kgmD6nNg and gm83dVfh.itemById('tabEdit'):



































































































                    if ZwNS2R4W.KkqWNNQ8.isActive:



































































































                        SCCnSTpn = cL62qdlC.activeProduct  



































































































                        if SCCnSTpn.designType != adsk.fusion.DesignTypes.ParametricDesignType:



































































































                            FFLF3ffF = p169ZFkB.messageBox('<div align="left">Parametric design needs to be active to edit a dowel joint. Would you like to change to the parametric design?', 'Dowel Joint', adsk.core.MessageBoxButtonTypes.YesNoCancelButtonType, adsk.core.MessageBoxIconTypes.QuestionIconType)  



































































































                            if FFLF3ffF == adsk.core.DialogResults.DialogYes:



































































































                                SCCnSTpn.designType = adsk.fusion.DesignTypes.ParametricDesignType  



































































































                            else:



































































































                                ZwNS2R4W.Ghjt2RRG.activate()



































































































                                return None



































































































                        kgmD6nNg = False



































































































                        ZwNS2R4W.jfW6CB2p.isVisible = False



































































































                        ZwNS2R4W.P1c4gJfR.isVisible = False



































































































                        ZwNS2R4W.D9s2QnJf.isVisible = True



































































































                        ZwNS2R4W.D9s2QnJf.isEnabled = True



































































































                        ZwNS2R4W.D9s2QnJf.clearSelection()



































































































                        try:



































































































                            if lMB54F3t is not None:



































































































                                lMB54F3t.opacity = 1



































































































                                lMB54F3t.isSelectable = True



































































































                        except Exception:



































































































                            pass



































































































                        ZwNS2R4W.jfW6CB2p.clearSelection()



































































































                        ZwNS2R4W.P1c4gJfR.clearSelection()



































































































                        ZwNS2R4W.JMp17LRK.isEnabled = False



































































































                        ZwNS2R4W.m5klvjDJ.isEnabled = False



































































































                        ZwNS2R4W.GvRGVm7D.isEnabled = False



































































































                        ZwNS2R4W.d1H7V1k2.isEnabled = False



































































































                        ZwNS2R4W.dlCC66hR.isEnabled = False



































































































                        ZwNS2R4W.GLRnsR36.isEnabled = False



































































































                        ZwNS2R4W.kQJ1W3kk.isEnabled = False



































































































                        ZwNS2R4W.Tr6qbTcR.isEnabled = False



































































































                        ZwNS2R4W.j7ZGQ7m6.isEnabled = False



































































































                        ZwNS2R4W.KBj2qHB2.isVisible = False



































































































                        ZwNS2R4W.Cvv6nT4S.isVisible = False



































































































                if HVLm722j == 'selectionBoard':



































































































                    try:



































































































                        if lMB54F3t is not None:



































































































                            if lMB54F3t.opacity != 1:  



































































































                                lMB54F3t.opacity = 1  



































































































                                if lMB54F3t.isSelectable is False:  



































































































                                    lMB54F3t.isSelectable = True  



































































































                    except Exception:



































































































                        pass



































































































                    if ZwNS2R4W.jfW6CB2p.selectionCount != 0:



































































































                        lMB54F3t = ZwNS2R4W.jfW6CB2p.selection(0).entity  



































































































                if HVLm722j == 'existingDowelJoint':



































































































                    if ZwNS2R4W.D9s2QnJf.selectionCount != 0:



































































































                        ZwNS2R4W.jfW6CB2p.isVisible = True



































































































                        ZwNS2R4W.P1c4gJfR.isVisible = True



































































































                        ZwNS2R4W.JMp17LRK.isEnabled = True



































































































                        ZwNS2R4W.m5klvjDJ.isEnabled = True



































































































                        ZwNS2R4W.GvRGVm7D.isEnabled = True



































































































                        ZwNS2R4W.d1H7V1k2.isEnabled = True



































































































                        ZwNS2R4W.dlCC66hR.isEnabled = True



































































































                        ZwNS2R4W.GLRnsR36.isEnabled = True



































































































                        ZwNS2R4W.kQJ1W3kk.isEnabled = True



































































































                        ZwNS2R4W.Tr6qbTcR.isEnabled = True



































































































                        ZwNS2R4W.j7ZGQ7m6.isEnabled = True



































































































                        ZwNS2R4W.KBj2qHB2.isVisible = True



































































































                        ZwNS2R4W.Cvv6nT4S.isVisible = True



































































































                        WJzw4t6T()



































































































                        ZwNS2R4W.D9s2QnJf.isVisible = False



































































































                if ZwNS2R4W.jfW6CB2p.selectionCount == 0:



































































































                    if (kgmD6nNg or ZwNS2R4W.D9s2QnJf.selectionCount != 0) and ZwNS2R4W.jfW6CB2p.hasFocus is False:



































































































                        ZwNS2R4W.jfW6CB2p.hasFocus = True



































































































                elif ZwNS2R4W.P1c4gJfR.selectionCount == 0:



































































































                    if (kgmD6nNg or ZwNS2R4W.D9s2QnJf.selectionCount != 0) and ZwNS2R4W.P1c4gJfR.hasFocus is False:



































































































                        ZwNS2R4W.P1c4gJfR.hasFocus = True



































































































                    Q66BPtdt = ZwNS2R4W.jfW6CB2p.selection(0).entity  



































































































                    if Q66BPtdt.opacity != 0.5:



































































































                        Q66BPtdt.opacity = 0.5



































































































                        if Q66BPtdt.isSelectable is True:



































































































                            Q66BPtdt.isSelectable = False



































































































                if (HVLm722j == "selectionBoard" or HVLm722j == 'selectionFace') and ZwNS2R4W.P1c4gJfR.selectionCount != 0 and ZwNS2R4W.jfW6CB2p.selectionCount != 0:



































































































                    GL2N2513()



































































































                if HVLm722j == 'selectionFace' and ZwNS2R4W.P1c4gJfR.selectionCount == 0:



































































































                    ZwNS2R4W.dlCC66hR.isEnabled = False



































































































                    ZwNS2R4W.GLRnsR36.isEnabled = False



































































































                if HVLm722j == 'selectionBoard' and ZwNS2R4W.jfW6CB2p.selectionCount == 0:



































































































                    ZwNS2R4W.dlCC66hR.isEnabled = False



































































































                    ZwNS2R4W.GLRnsR36.isEnabled = False



































































































                if HVLm722j == 'selectionFace':



































































































                    ZwNS2R4W.Tr6qbTcR.isVisible = True



































































































                    ZwNS2R4W.PkPj6wfk.isVisible = False



































































































                if HVLm722j == 'locationType':



































































































                    zvCJLGzL()



































































































                if HVLm722j == 'suppressGroup':



































































































                    if ZwNS2R4W.j7ZGQ7m6.isEnabledCheckBoxChecked:



































































































                        PPs51G4B = True



































































































                    else:



































































































                        PPs51G4B = False



































































































                if gr2bWCKM.input.id == 'helpButton':



































































































                    Vhssm1gV()



































































































            if PPs51G4B and HVLm722j[:12] == 'suppressBool':



































































































                qPf1Nk77 = int(HVLm722j[12:]) - 1



































































































                tflPNvG7[qPf1Nk77] = gr2bWCKM.input.value  



































































































            if HVLm722j == 'key':



































































































                H6KqqW1G = ZwNS2R4W.dLK6wJfD.value.upper().strip()



































































































                if CL3tjmwr(H6KqqW1G):



































































































                    ZwNS2R4W.tcc9nT4f.isVisible = False



































































































                    ZwNS2R4W.Wn6ZCbfm.isVisible = True



































































































                    wC12Jb16()



































































































                    kcPDHw12 = True



































































































                    ZwNS2R4W.dLK6wJfD.isVisible = False



































































































        except Exception:



































































































            qN9pKtLP()



































































































class Fd5VHRJV(adsk.core.KeyboardEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, j7kLD7nV):



































































































        try:



































































































            if j7kLD7nV.keyCode == adsk.core.KeyCodes.F1KeyCode:



































































































                Vhssm1gV()



































































































        except Exception:



































































































            qN9pKtLP()



































































































class tgSDS4Cz(adsk.core.ValidateInputsEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, gr2bWCKM):



































































































        global cL62qdlC



































































































        global ZwNS2R4W



































































































        try:



































































































            ZwNS2R4W.fbk2MbtH = ZwNS2R4W.Jj7nd432



































































































            ZwNS2R4W.Jj7nd432 = False



































































































            if ZwNS2R4W.jfW6CB2p.selectionCount != 1:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            if ZwNS2R4W.P1c4gJfR.selectionCount != 1:



































































































                gr2bWCKM.areInputsValid = False



































































































                Q66BPtdt = ZwNS2R4W.jfW6CB2p.selection(0).entity  



































































































                if Q66BPtdt.opacity != 0.5:



































































































                    Q66BPtdt.opacity = 0.5



































































































                    if Q66BPtdt.isSelectable is True:



































































































                        Q66BPtdt.isSelectable = False



































































































                cL62qdlC.activeViewport.refresh()



































































































                return



































































































            if ZwNS2R4W.JMp17LRK.value <= 0:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            if ZwNS2R4W.GvRGVm7D.value <= 0:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            if ZwNS2R4W.d1H7V1k2.selectedItem.name in ("Spacing from One Side", "Symmetrical Spacing"):



































































































                if ZwNS2R4W.KBj2qHB2.value <= 0:



































































































                    gr2bWCKM.areInputsValid = False



































































































                    return



































































































            if ZwNS2R4W.dlCC66hR.value <= 0:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            if ZwNS2R4W.GLRnsR36.value <= 0:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            try:



































































































                ZwNS2R4W.JMp17LRK.expression



































































































                ZwNS2R4W.m5klvjDJ.expression



































































































                ZwNS2R4W.GvRGVm7D.expression



































































































                ZwNS2R4W.KBj2qHB2.expression



































































































                ZwNS2R4W.dlCC66hR.expression



































































































                ZwNS2R4W.GLRnsR36.expression



































































































            except RuntimeError:



































































































                gr2bWCKM.areInputsValid = False



































































































                return



































































































            ZwNS2R4W.Jj7nd432 = True



































































































        except Exception:



































































































            qN9pKtLP()



































































































class QB9cqm6r(adsk.core.CommandEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, j7kLD7nV):



































































































        global lMB54F3t



































































































        global s15BhdVN



































































































        global PPs51G4B



































































































        global ZwNS2R4W



































































































        try:



































































































            if lMB54F3t.opacity != 0.5:  



































































































                lMB54F3t.opacity = 0.5  



































































































            if lMB54F3t:



































































































                if lMB54F3t.isSelectable is True:



































































































                    lMB54F3t.isSelectable = False



































































































            if s15BhdVN.opacity != 0.5:  



































































































                s15BhdVN.opacity = 0.5  



































































































            if ZwNS2R4W.JSdvj575.value:



































































































                gtGtR4Z2(True)



































































































                if PPs51G4B:



































































































                    jBzgm24S()



































































































                if ZwNS2R4W.fbk2MbtH is False:



































































































                    cL62qdlC.activeViewport.refresh()



































































































        except Exception:



































































































            qN9pKtLP()



































































































class phQ37n32(adsk.core.CommandEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, j7kLD7nV):



































































































        global P6KQF3wm



































































































        global cL62qdlC



































































































        global p169ZFkB



































































































        global FLL52DC8



































































































        global Sl81K1p9



































































































        global TqnNd8K5



































































































        global kcPDHw12



































































































        global ZwNS2R4W



































































































        try:



































































































            SCCnSTpn = cL62qdlC.activeProduct  



































































































            if kcPDHw12:



































































































                if SCCnSTpn.designType == adsk.fusion.DesignTypes.ParametricDesignType:



































































































                    d9c44dQG = SCCnSTpn.timeline



































































































                    cc4BN23g = d9c44dQG.markerPosition



































































































                    if TqnNd8K5 is None:



































































































                        dbhqvMn2 = cc4BN23g



































































































                    else:



































































































                        dbhqvMn2 = TqnNd8K5



































































































                gtGtR4Z2(False)



































































































                if SCCnSTpn.designType == adsk.fusion.DesignTypes.ParametricDesignType:



































































































                    q8Vp3f6K = 0



































































































                    if Sl81K1p9:



































































































                        q8Vp3f6K = 1



































































































                        dbhqvMn2 += q8Vp3f6K



































































































                    if abs(dbhqvMn2 - d9c44dQG.markerPosition) > 1:



































































































                        PDl4khfQ = d9c44dQG.timelineGroups.add(dbhqvMn2, d9c44dQG.markerPosition - 1)



































































































                        PDl4khfQ.name = 'Dowel Joint'



































































































                    if TqnNd8K5 is not None:



































































































                        d9c44dQG.markerPosition = cc4BN23g + (d9c44dQG.markerPosition - (dbhqvMn2 - q8Vp3f6K))



































































































                qd7LfHBp = []



































































































                qd7LfHBp.append(ZwNS2R4W.JMp17LRK.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.m5klvjDJ.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.GvRGVm7D.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.d1H7V1k2.selectedItem.index)



































































































                qd7LfHBp.append(ZwNS2R4W.KBj2qHB2.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.Cvv6nT4S.value)



































































































                qd7LfHBp.append(ZwNS2R4W.dlCC66hR.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.GLRnsR36.expression)



































































































                qd7LfHBp.append(ZwNS2R4W.fntr62Mw.value)



































































































                qd7LfHBp.append(ZwNS2R4W.kQJ1W3kk.value)



































































































                qd7LfHBp.append(ZwNS2R4W.Tr6qbTcR.value)



































































































                qd7LfHBp.append(ZwNS2R4W.JSdvj575.value)



































































































                qd7LfHBp.append(ZwNS2R4W.SkVhr2pz.value)



































































































                SGlFLNcV(qd7LfHBp)



































































































            else:



































































































                if ZwNS2R4W.dLK6wJfD.value != '':



































































































                    p169ZFkB.messageBox("An incorrect license key has been entered.")



































































































                else:



































































































                    p169ZFkB.messageBox("The trial is limited to a preview.")



































































































        except Exception:



































































































            qN9pKtLP()



































































































class pJS6qpL1(adsk.core.CommandEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, j7kLD7nV):



































































































        global p1wP7Jl7



































































































        global wq6D3162



































































































        global P6KQF3wm



































































































        global ZwNS2R4W



































































































        global lMB54F3t



































































































        global s15BhdVN



































































































        global FLL52DC8



































































































        global tflPNvG7



































































































        global Z9QPzJ73



































































































        global TqnNd8K5



































































































        global D26P8rgj



































































































        try:



































































































            p1wP7Jl7 = []



































































































            wq6D3162 = []



































































































            P6KQF3wm = None



































































































            ZwNS2R4W = None  



































































































            lMB54F3t = None



































































































            s15BhdVN = None



































































































            FLL52DC8 = None



































































































            tflPNvG7 = []



































































































            Z9QPzJ73 = None



































































































            TqnNd8K5 = None



































































































            D26P8rgj = None



































































































        except Exception:



































































































            qN9pKtLP()



































































































class WGv9M3Pw(adsk.core.HTMLEventHandler):



































































































    def __init__(Q7B515Ph):



































































































        super().__init__()



































































































    def notify(Q7B515Ph, sV3bfrlq):



































































































        global cL62qdlC



































































































        try:



































































































            zVv1w469 = json.loads(sV3bfrlq.data)



































































































            if 'url' in zVv1w469:



































































































                vHRDm54N = zVv1w469['url']



































































































                if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):



































































































                    os.startfile(vHRDm54N)



































































































                elif sys.platform.startswith('darwin'):



































































































                    subprocess.Popen(['open', vHRDm54N])



































































































        except Exception:



































































































            qN9pKtLP()