EDA365电子论坛网

标题: {求助}SILK 依照零件本體大小變換 源碼有錯誤 [打印本页]

作者: Pkron    时间: 2025-4-30 16:40
标题: {求助}SILK 依照零件本體大小變換 源碼有錯誤
請大佬幫忙除錯


*WARNING* (reader): a '(' at line 2 was still unclosed on EOF, ')' added
                    at line 69
*WARNING* (reader): a '(' at line 1 was still unclosed on EOF, ')' added
                    at line 69

procedure()
    let((texts sym p uFc symBBox assemblyHeight)
        ;; Get unit conversion factor
        if(car(axlDBGetDesignUnits()) == "mils" then
            uFc = 1
        else
            uFc = 25.4 / 1000
        )

        ;; Set visible layers
        axlVisibleDesign(nil)
        axlVisibleLayer("Ref Des/DISPLAY_Top" t)
        axlVisibleLayer("Ref Des/DISPLAY_Bottom" t)
        axlVisibleLayer("PACKAGE GEOMETRY/ASSEMBLY_TOP" t)
        axlVisibleLayer("PACKAGE GEOMETRY/ASSEMBLY_BOTTOM" t)
        axlVisibleUpdate(nil)

        ;; Select all reference designator texts
        axlClearSelSet()
        axlSetFindFilter(?enabled `("noall" "text") ?onButtons `("noall" "text"))
        axlAddSelectAll()

        ;; Process each selected text
        foreach(texts axlGetSelSet()
            sym = texts->parent
            when(sym && texts->text == sym->component->name
                ;; Get ASSEMBLY layer bounding box
                symBBox = axlPolyFromDB(sym ?layer strcat("PACKAGE GEOMETRY/ASSEMBLY_" sym->side) ?noFill t ?union t)

                when(symBBox
                    ;; Calculate ASSEMBLY layer height and set text size to 70%
                    assemblyHeight = yCoord(cadr(symBBox)) - yCoord(car(symBBox))

                    p = axlGetParam("paramTextBlock:13")
                    p->width = assemblyHeight * 0.7 * 0.6  ;; 70% height with 0.6 aspect ratio
                    p->height = assemblyHeight * 0.7        ;; 70% of height
                    p->lineSpace = 0.0 * uFc
                    p->charSpace = 0.0 * uFc
                    p->photoWidth = max(1.0 * uFc, assemblyHeight * 0.7 * 0.05)  ;; min 1mil
                    axlSetParam(p)

                    ;; Modify text properties
                    axlDBChangeText(texts nil 13)

                    ;; Rotate text to match component
                    axlTransformObject(texts ?angle sym->rotation - texts->rotation)

                    ;; Handle upside-down text
                    when(texts->rotation >= 90 && texts->rotation < 270
                        axlTransformObject(texts ?angle 180)
                    )

                    ;; Position text at ASSEMBLY layer center
                    let((assemblyCenter)
                        assemblyCenter = list(
                            (xCoord(car(symBBox)) + (xCoord(cadr(symBBox)) - xCoord(car(symBBox)))/2,
                            (yCoord(car(symBBox)) + (yCoord(cadr(symBBox)) - yCoord(car(symBBox)))/2
                        )
                        axlTransformObject(texts ?move axlMXYSub(assemblyCenter axlDBAltOrigin('center texts)))
                    ) ;; End of inner let
                ) ;; End of when symBBox
            ) ;; End of when sym && texts->text
        ) ;; End of foreach
        axlClearSelSet()
        axlVisibleUpdate(t)  ;; Final screen update
    ) ;; End of let
) ;; End of procedure

printf("mcenter command loaded. Use 'mcenter' to center reference designators (based on ASSEMBLY layer)\n")


作者: ashnoer    时间: 2025-5-1 16:12
1.第一行错误
2.AssemblyCenter创建list时没闭合,里面的表达式都少了反阔号
作者: zsking_SKillDev    时间: 2025-5-1 21:38
括号不匹配,提示的内容不是error 不影响运行。




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2